I need a bit of help with blobs in opencv (python).

This is the thing:

I've already written the preprocessing functions that work properly, they isolate the areas of interest and return a thresholded image, where these areas are white, the rest is black. The thing is, I'm only interested in the white areas but no matter what I do, I keep getting the background as a blob too. I can't filter by size because I don't know how far the object is.

Is there a way to just process white blobs?

This is the gist of what i have now:

mask = cv.cvCreateImage(frame_size,8,1)
cvSet(mask,1)
.
.
.
blob_a_matches = CBlobResult(blob_a,mask,100, True)
blob_a_matches.filter_blobs(10, 1000)
for i in range(blob_a_matches.GetNumBlobs()):
    numbered_blob = blob_a_matches.GetBlob(i)
    area = numbered_blob.Area()
    .
    .
    .

Except for the fact that the background is treated as a blob too, this works.

share|improve this question
feedback

1 Answer

CvSet is a class - so not sure what second line is doing. Also no Blobs as native in Python - is this a cv.CvSet or a cv.CvSeq sequence that is being returned ?

or are you finding contours after thresholding - then traversing them as in contours.py example ? which may be a better approach...

share|improve this answer
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.