Ask Your Question

Knn match for blobs

asked 2015-07-03 09:34:50 -0500

Doomb0t gravatar image

Is there a ready made solution to match blobs (detected by the SimpleBlobDetector) the same way that one may match keypoint descriptors such as ORB in OpenCV?

I mean, when using the "detect" method of the blob detector, it stores the blobs as a vector of keypoints and, given that I used the relevant parameters, it gives me the area of each blobs. Now, I have two vectors of keypoints/blobs from two images and I want to match the blobs. Using something like knnmatch requires descriptors as inputs.

I thought of 2 possibilities, but I would prefer if there was something already optimized.

  • Implement by myself the matching algorithm so that it takes as input two vector of keypoints and as output a vector of vector of DMatches (I don't trust myself to make this more efficient than a naive implementation) OR
  • Create a routine that fills a mat of descriptors, with each areas encoded as a bit vector to make it look like a standard descriptors. Then use knnmatch.

Does anyone know of an alternative? Thanks :)

edit retag flag offensive close merge delete


I do not think that the area is enough, imagine a blob that is coming closer to the camera, so its size will grow... Or supposing that the frames are very close in time, then it shouldn't be too different... Maybe it will work for some cases...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-03 09:39:48 -0500 )edit

Yeah, I know this is only relevant in some special cases. Right now, I use synthetic images that are simple enough for it to work...

Doomb0t gravatar imageDoomb0t ( 2015-07-03 09:51:43 -0500 )edit

Why the knnMatch with ORB descriptors is not enough?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-03 10:11:04 -0500 )edit

Well, actually I must do a comparative study between some methods such as ORB, BRISK, etc. and blob detection, over a wide range of synthetic and real life images, in order to characterize their functioning under some circumstances... This is in relation with my master's thesis. So it is normal that blobs won't work well in a lot of situations, but I need to show which ones...

Doomb0t gravatar imageDoomb0t ( 2015-07-03 10:28:05 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-03 11:04:13 -0500

Eduardo gravatar image

updated 2015-07-03 11:19:38 -0500

SimpleBlobDetector (as you can deduce from the name) will return the list of detected blobs in an image.

If you want to match the list of blobs detected in one image with the list of blobs detected in another image, you have to extract some relevant information that will characterize the local information around the blob location.

You have several possibilities in my opinion:

The matching procedure is simple enough to be implemented yourself but you can also try to fill the descriptors matrices like for ORB to exploit the built-in BruteForce matcher like you said if performance matters or if you don't want to recreate the wheel.

edit flag offensive delete link more


Thanks! Actually, I already know the area of each of my blobs, so right now I am able to pair them "by hand". I was just looking if there was an already made function in OpenCV instead of having to do it myself. It's Friday and I don't want to reinvent the wheel if possible :)

Doomb0t gravatar imageDoomb0t ( 2015-07-03 11:55:00 -0500 )edit

I think that you can try to fill the descriptor matrix in the same way the compute method works.

You will have a descriptor matrix with the number of rows equals to the number of blobs and with the number of columns equal to 1 if you want to use only the area.

Compare the SimpleBlobDetector with other features using only the area information is not completly fair in my opinion as you can extract some other relevant information.

Eduardo gravatar imageEduardo ( 2015-07-03 12:13:33 -0500 )edit

Question Tools

1 follower


Asked: 2015-07-03 09:34:50 -0500

Seen: 1,646 times

Last updated: Jul 03 '15