6

I plan to start experimenting with blobs as a C++ user, with some experience at cv::Mat's from the OpenCV.

Now the question is, which blobs library should I use if at all?

I have seen these alternatives so far:

  1. cvBlobs (on google code) -- that is a c library really, working with IplImage so it needs serious adaptation to c++.
  2. CvBlobsLib (on willowgarage opencv webpage) -- that looks like a c++ library but has quite bad docs with plenty of stuff left unexplained and barely any code example.
  3. I have seen cv::findContours, cv::moments and cv::drawContours in the OpenCV 2.4.3 library.

What do you suggest as an expert? My pressing issue: what will the new OpenCV not cover of cvBlobs on google code?


Here is the link for the follow-up question on this subject, where I ask about SimpleBlobDetector. You might be interested.

Community
  • 1
  • 1
Barney Szabolcs
  • 11,846
  • 12
  • 66
  • 91

2 Answers2

5

You should use the SimpleBlobDetector class in OpenCV 2.4. You pretty much create an object of type SimpleBlobDetector and then call the detect(cv::Mat input, vector<cv::KeyPoint> keypoints, cv::Mat mask) function with a cv::Mat image as input, an empty vector for keypoints, and another cv::Mat as an optional mask for a specific area of the image to look for keypoints in.

Note that the cv::Mat object has taken over image and matrix storage duty for all of the formerly separate image and matrix classes in the earlier releases of OpenCV.

thealmightygrant
  • 701
  • 1
  • 5
  • 11
  • OK, this answer looks exciting! I am just not sure I can make it work. I have the following concerns: this one only returns center of the blob, I can't have an entire, labelled Mat, can I? Also, how can I access the features of the detected blobs like area, convexity, color and so on? Should I pose it as a separate question and you promise me to have a look? :) – Barney Szabolcs Nov 23 '12 at 18:51
  • It looks now rather like a tutorial class for me with a not so mature concept, it is not very extendable either. :( Maybe I'll implement my wrapper over CBlob and I put it up opensource somewhere. – Barney Szabolcs Nov 23 '12 at 19:03
  • The [link](http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html#keypoint)`Keypoint` class (i.e. the output of the detect function) contains the size as a diameter in addition to the center of each blob detected. Also, in the constructor of the `SimpleBlobDetector`, you can specify desired colors, circularity, area, convexity, and inertia. You just put these into the constructor as so: `SimpleBlobDetector myBlobDetector(bool filterByArea=true, float minArea=10, float maxArea = 100);` – thealmightygrant Nov 23 '12 at 19:07
  • hang on, man, I think it is time to pop up a new question, I'll link it here so you can find it :) – Barney Szabolcs Nov 23 '12 at 19:11
  • 1
    I screwed up the constructor anyways. It should be something like: `cv::SimpleBlobDetector::Params params; params.minDistBetweenBlobs = 10.0; params.filterByArea = true; params.minArea = 20.0; params.maxArea = 500.0; SimpleBlobDetector myBlobDetector(params);` – thealmightygrant Nov 23 '12 at 19:15
  • hold your horses :) and please read my updated question, you can find this new question in a link, and post your answer there. (It scores more for you anyway, for me it will be easier to read back.) This is a Q&A site where every page contains only a single, specific Q and A's to that with very brief discussions in comment. – Barney Szabolcs Nov 23 '12 at 19:20
2

You should take a look at the new opencvblobslib. It has great features like multi core support.

rold2007
  • 1,297
  • 1
  • 12
  • 25