Вопрос

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