Error .. Please Help

inshu chauhan insideshoes at gmail.com
Wed Dec 12 16:00:18 CET 2012


In this code :

import cv
g = open("PointCloudmitClass.txt", "w")
image = cv.LoadImageM("Z:/modules/intensity_000001.tif",
cv.CV_LOAD_IMAGE_UNCHANGED)
print image
for y in xrange(0,image.height):
    for x in xrange(0,image.width):
        color = image[y,x]
        if color == (0.0,0.0,0.0):
            continue
        else :

            if color == (0.0,255.0,0.0):
                classification = 1
            elif color == (128.0, 0.0, 255.0):
                classification = 2
            elif color == (255.0,0.0,0.0):
                classification = 3
            elif color == (128.0, 128.0, 128.0):
                classification = 4
            elif color == (128.0, 64.0, 0.0):
                classification = 5
            elif color == (0.0, 0.0, 255.0):
                classification = 6
            elif color == (255.0, 0.0, 255.0):
                classification = 7

            print >> g, x , y , color, classification


I am getting the following error..

Traceback (most recent call last):
  File "Z:\modules\Get_Classification.py", line 27, in <module>
    print >> g, x , y , color, classification
NameError: name 'classification' is not defined

Its simple error of name but m not getting why it should come as I have
already defined Classification in between if-else loop ??

Thanks in Advance !!!


IC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121212/d82cd9de/attachment.html>


More information about the Python-list mailing list