Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34693

Error .. Please Help

Date 2012-12-12 16:00 +0100
Subject Error .. Please Help
From inshu chauhan <insideshoes@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.776.1355324421.29569.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Error .. Please Help inshu chauhan <insideshoes@gmail.com> - 2012-12-12 16:00 +0100
  Re: Error .. Please Help Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-12-12 16:46 +0100

csiph-web