문제

I am converting an OpenCV image to SimpleCV via simple Image(opencv_image) call and using Image.findBlobs() to get the blob. However, I can not get the bounding box using Blobs.getBoundingBox() as I get the error :

blobs.draw() AttributeError: 'NoneType' object has no attribute 'draw'

fgmask is the foreground mask I have received after background subtraction.

Here is my code:

simplecvimg = Image(fgmask, cv2image=True)
blobs = simplecvimg.findBlobs()
blobs.draw()
simplecvimg.show()
도움이 되었습니까?

해결책

If findBlobs doesn't find any blobs, or if there's some problem with input image, it returns None. And hence the error. So you might want to add a check if blobs is None or not.

if blobs is not None:
    blobs.draw()
simplecvimg.show()

Also, try using some other image to see if the error persists.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top