Ask Your Question
0

looking for blobs not in Featureset

asked 2013-03-19 08:41:12 -0500

decrot gravatar image

I've asked many questions lately, this will be my last I promise.

How would you find blobs that do not meet your featureset criteria? Specifically geometric shapes. Lets say I filtered blobs that are squared and circular. How would you create a list that are not one of these two? for example:

blobs = img.findBlobs(minsize, maxsize)

if blobs:
    circles = blobs.filter([c.isCircle() for c in blobs])
    squares = blobs.filter([b.isSquare() for b in blobs])

so here I have a list of circles and squares stored in their respective variables. what about the other blobs that do not meet either of these criteria but do meet the min and max size blobs. How can I store the 'foreign' blobs in a list that are not circular or squared?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-03-19 11:18:26 -0500

xamox gravatar image

Another option is to use Set's which are built into python and then you could do the difference, union, etc. To easily map various tests so you don't have to write loops. For example:

blobs = img.findBlobs(minsize, maxsize)
if blobs:
    blob_set = set(blobs) #convert featureset from list into set
    circles = blobs.filter([c.isCircle() for c in blobs])
    squares = blobs.filter([b.isSquare() for b in blobs])

not_a_circle_or_square_list = list(blob_set.difference(circles,squares))
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-03-19 08:41:12 -0500

Seen: 308 times

Last updated: Mar 19 '13