开发者

Opencv + blobs in python

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 开发者_JAVA百科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.


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜