First time here? Check out the FAQ!
Maybe you can try with Gaussian Diff (Java code):
Mat g0 = src.clone(); Mat g1 = src.clone(); Imgproc.GaussianBlur(g0, g0, new Size(21, 21), 0); Imgproc.GaussianBlur(g1, g1, new Size(3, 3), 0); Core.subtract(g0, g1, nombreMat); // or absdiff Core.normalize(nombreMat, nombreMat, 0, 255, Core.NORM_MINMAX); // Invert 8UC Mat white = new Mat(nombreMat.size(), CvType.CV_8UC1); white.setTo(new Scalar(255)); Core.subtract(white, nombreMat, nombreMat);