Since the color conversion RGB to EGray 256 didn't work in imageoperation.py file of PYNCV Lib , I'm writing the code for it as below(part of the main code is shown here which implements the color conversion and find the edge detection of the gray scale image).A syntax error occurs when i execute the script on N95.It is showing error in the line where it is calculating (2*r + 5*g + b)/8. Error:Invalid syntax..Please tell me the problem and also rectify the following lines if you find any error in that.
if self.mode == Transliteration:
width, height = self.sNokiaCVImage1.size
for y in range(1,height):
for x in range(1,width):
[(r , g , b)] =self.sNokiaCVImage1.getpixel((x,y))
tNokiaCVImage = (2*r + 5*g + b)/8
self.tNokiaCVImage1(x,y) = tNokiaCVImage
self.sNokiaCVImage2 =self.tNokiaCVImage1
self.PyCImageOperations.EdgeDetect(self.sNokiaCVImage2, self.tNokiaCVImage2, 4)# canny edge is done
filename=u'e:\\images\\edge.jpg'
self.target_image2.save(filename)
self.display_image = self.target_image2
self.fullupdate()
lock.wait()

Reply With Quote


