Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV - Blob detection Java with params

I need a Java code with blob detection using parameters (example filterByCircularity). I found several examples in C ++ and Python, but none in Java with OpenCV. I have the code below and need to implement the parameters of blobs detection, (example filterByCircularity). Someone has already implemented this?

Mat orig = Highgui.imread("E:\\PhotoIn.jpg",Highgui.IMREAD_GRAYSCALE);

Mat MatOut= new Mat();

FeatureDetector blobDetector;

blobDetector = FeatureDetector.create(FeatureDetector.SIFT);

MatOfKeyPoint keypoints1 = new MatOfKeyPoint();

blobDetector.detect(orig,keypoints1); 

org.opencv.core.Scalar cores = new org.opencv.core.Scalar(0,0,255);

org.opencv.features2d.Features2d.drawKeypoints(orig,keypoints1,MatOut,cores,2);

Highgui.imwrite("e:\\PhotoOut.jpg", MatOut);