Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can calculate the variance of the laplacian in java with:

Mat gray = new Mat();
Imgproc.cvtColor(image, gray, Imgproc.COLOR_BGR2GRAY);

Mat lap = new Mat();
Imgproc.Laplacian(gray, lap, CvType.CV_64F);

MatOfDouble mean = new MatOfDouble ();
MatOfDouble dev = new MatOfDouble ();

Core.meanStdDev(lap, mean, dev);
double value = dev.get(0,0)[0];

(note, that you will get much smaller values, than in the python blog, since opencv returns the root of it

please also have an eye on the docs !