Ask Your Question
0

NameError: name 'Image' is not defined

asked 2014-09-10 01:37:44 -0500

Andrew1108 gravatar image

I try to find blobs using python here my code:

import cv2
import SimpleCV

bgsMOG = cv2.BackgroundSubtractorMOG2()
cap    = cv2.VideoCapture("d:\MOV_5702.avi")
if cap:
    while True:
        ret, frame = cap.read()
        if ret:
            fgmask     = bgsMOG.apply(frame, None, 0.01)
            simplecvimg=Image(fgmask, cv2image=True)
            blobs      = simplecvimg.findBlobs()
            if blobs is not None:
                blobs.draw()
            simplecvimg.show()
            key = cv2.waitKey(100)
            if key == ord('q'):
                break

cap.release()
cv2.destroyAllWindows()

but when I run it, get error in:

Traceback (most recent call last):
  File "C:\Users\LENOVO\Documents\try_using_simplecv.py", line 11, in <module>
    simplecvimg=Image(fgmask, cv2image=True)
NameError: name 'Image' is not defined

How I can fix it?

edit retag flag offensive close merge delete

Comments

I re-install all, and follow these http://ib-krajewski.blogspot.com/2012/11/simplecv-install-and-you-need-python.html and it's work.. But I got another problem, the simplecvimg is rotate, and even using rotate it can't fix...

Andrew1108 gravatar imageAndrew1108 ( 2014-09-10 07:17:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-09-13 08:55:58 -0500

this error is because you not import class Image of SimpleCV try using from SimpleCV import Image or from SimpleCV import *

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

1 follower

Stats

Asked: 2014-09-10 01:37:44 -0500

Seen: 7,479 times

Last updated: Sep 13 '14