Andrew Wilson
unread,Jul 16, 2010, 2:31:36 PM7/16/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ctypes...@googlegroups.com
Hello,
I'm trying to remove some contours from the sequence output from cvFindContours. The code is listed below, for small sets of contours it works fine but when there are many contours retrieved I get a ctypes ValueError Exception "ctypes object structure too deep". Any idea what this means and how to fix it?
Thanks
Andrew
def FilterContours(contour, fxn, *fxnargs):
c = contour
while(True):
args = (c,) + fxnargs
if(fxn(*args)): #remove it from the seq
if(c.h_prev and c.h_next):
try:
c.h_prev[0].h_next = c.h_next
c.h_next[0].h_prev = c.h_prev
except ValueError as e:
print e
pass # why do I get a "ctypes object structure too deep"
elif(c.h_next): #first one
contour = c.h_next[0]
if(c.h_next): #increment it
c = c.h_next[0]
else:
break
return contour