Conversion between javacv and opencv to get mean and stdDev from a Mat

i can successfully access the value of mean and stdDev using opencv in eclipse. But i am fail to do so with javacv in Android. There are two main problems. First, no MatODouble is supported in javacv. Second, no "get" function can be called. Anyone here know how to translate these code for javacv.

Please give me a helping hand, i need you all indeed......

MatOfDouble mu = new MatOfDouble();
MatOfDouble sigma = new MatOfDouble();
Core.meanStdDev( detected_edges, mu, sigma);
double m = mu.get(0,0)[0];
double d = sigma.get(0,0)[0];

Answers


The following example may helps: ColorCalibrator.java

CvMat b = CvMat.create(referenceColors.length*3, 1);

...

CvScalar mean = new CvScalar(), stddev = new CvScalar();
cvAvgSdv(b, mean, stddev, null);

After that mean and stddev can be used as a 4-element vector (i.e. stddev.val(0)).


Update #1 on how to create CvMat from BufferedImage:

// To get a BufferedImage from an IplImage, or vice versa, we can chain calls to
// Java2DFrameConverter and OpenCVFrameConverter, one after the other.
Java2DFrameConverter cvt1 = new Java2DFrameConverter();
OpenCVFrameConverter.ToIplImage cvt2 = new OpenCVFrameConverter.ToIplImage();

BufferedImage img = ImageIO.read(new File(imagePath));
IplImage image1 = cvt2.convert(cvt1.convert(img));

CvMat image2 = image1.asCvMat();

Need Your Help

ShareKit 2.0: Facebook already authenticated

ios facebook sharekit

I am using ShareKit 2.0 (installed via cocoapods) to post text and image to facebook from my iOS app.

Bundler is being blocked by Rubygems website using RVM with Ruby 2.3.0

ruby jenkins rubygems rvm bundler

I am using Jenkins to automate a build process. I am pulling code from git, then running a bundle install to load the correct gems. However when I do so, I am getting an error message (see below)