Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top