python - SimpleCV NameError: name 'images' is not defined

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

1 Answer

  1. Lorin- Reply

    2019-11-14

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>