Ask Your Question

OpenCV - Blob detection Java with params

asked 2015-11-05 13:57:06 -0500

fabiano moreira gravatar image

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();


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


Highgui.imwrite("e:\\PhotoOut.jpg", MatOut);
edit retag flag offensive close merge delete


didn't you want : FeatureDetector.create(FeatureDetector.SIMPLEBLOB); (not SIFT) ?

berak gravatar imageberak ( 2015-11-06 02:24:23 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-11-06 02:30:38 -0500

berak gravatar image

updated 2015-11-06 02:34:35 -0500

unfortunately, there's no straightforward way to do so, we need the backdoor (save/read xml):

// make a simpleblob detector:
FeatureDetector blobby = FeatureDetector.create(FeatureDetector.SIMPLEBLOB);
// save the original config:
// (or use the one below)    

<?xml version="1.0"?>

// now edit params as you like, and read it back in:"/mnt/sdcard/blob.xml"); // wherever you put it.
edit flag offensive delete link more


great berak. It worked perfect. thank you

fabiano moreira gravatar imagefabiano moreira ( 2015-11-06 21:06:48 -0500 )edit

Question Tools

1 follower


Asked: 2015-11-05 13:57:06 -0500

Seen: 3,990 times

Last updated: Nov 06 '15