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
-- http://mail.python.org/mailman/listinfo/python-list