SimpleCV NameError: name 'images' is not defined
Asked Answered
P

1

0

I try Library SimpleCV. I have Ubuntu 11.10, Python 2.7 with PIL (python-imaging ver. 1.1.7-3ubuntu1)

According to Install instructions I downloaded SimpleCV_1.1_linux_all.deb package. Then I install: sudo apt-get install python-numpy python-scipy.

Since Ubuntu 11.10 has python-opencv library I don't install any other opencv library (I dont upgrade from OpenCV 2.1 to OpenCV 2.3) library. Then I installed SimpleCV_1.1_linux_all.deb package. It installed to /usr/lib/pymodules/python2.7/SimpleCV. I try test this library and have problem:

#!/usr/bin/python

from SimpleCV import *

my_image = Image(images/redeye.jpg)<br>
my_image.show()

it shows error:

Traceback (most recent call last):
File "./simplecvimg.py", line 6, in
my_image = Image(images/redeye.jpg)
NameError: name 'images' is not defined

Preponderant answered 13/12, 2011 at 0:31 Comment(0)
C
2

Pass images/redeye.jpg as a string: Image("images/redeye.jpg").

my_image = Image("images/redeye.jpg")

You are currently passing that literally to the Image() class, hence why python is intepreting it as a variable, and as such, raising a NameError exception because the images local or global name is not found.

Claytonclaytonia answered 13/12, 2011 at 0:32 Comment(1)
@marinex: You're welcome. Don't forget to accept an answer if it's helped and worked for you. It will also get rid of it from the 'unanswered' section!Claytonclaytonia

© 2022 - 2024 — McMap. All rights reserved.