[Tutor] Error in get pixel value in coordinate (x, y) using getPixel(x, y)
Please help me... I'm using python 2.7.6, numpy 1.8.1, opencv 2.4.9.. I want to get pixel value in one number like 255 not each value like these R(190), G(23), B(45) from coordinate (x,y)... I try these code m_samples[k][i][j]=getPixel(img,row,col) But get error: NameError: name 'getPixel' is not defined If I change the format become: m_samples[k][i][j]=img.getPixel(row,col) Still error: AttributeError: 'numpy.ndarray' object has no attribute 'getpixel' Please help me.. Thanks, Northbee ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Error in get pixel value in coordinate (x, y) using getPixel(x, y)
On 07/08/14 12:49, Whees Northbee wrote: Please help me... I'm using python 2.7.6, numpy 1.8.1, opencv 2.4.9.. I want to get pixel value in one number like 255 not each value like these R(190), G(23), B(45) from coordinate (x,y)... What do you expect that number to look like? The pixels are represented by the 3 colours RGB. Are you wanting to just join the 3 bytes together to create an arbitrary number? Or do you think this number will mean something? I try these code m_samples[k][i][j]=getPixel(img,row,col) But get error: NameError: name 'getPixel' is not defined So the getPixel function doesn't exist in your namespace. Where do you think it comes from? If I change the format become: m_samples[k][i][j]=img.getPixel(row,col) Still error: AttributeError: 'numpy.ndarray' object has no attribute 'getpixel' And its not a part of a numpy ndarray - what made you think it was? Arte you just guessing? Or did you saee some code that uses getPixel() somewhere? Please help me.. The tutor list is for those learning Python and its standard library. Numpy is not part of that, so your question is slightly off list. but your error looks so elementary that we may be able to help if you give us more information. Also, please *always* send full error messages, not just the last line. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Error in get pixel value in coordinate (x, y) using getPixel(x, y)
On Thu, Aug 7, 2014 at 7:49 AM, Whees Northbee wrote: > Please help me... I'm using python 2.7.6, numpy 1.8.1, opencv 2.4.9.. > I want to get pixel value in one number like 255 not each value like these > R(190), G(23), B(45) from coordinate (x,y)... > I try these code > m_samples[k][i][j]=getPixel(img,row,col) > > But get error: > NameError: name 'getPixel' is not defined > > If I change the format become: > m_samples[k][i][j]=img.getPixel(row,col) > > Still error: > AttributeError: 'numpy.ndarray' object has no attribute 'getpixel' > > Please help me.. > > Thanks, > > Northbee > >What module is getPixel from? Do you have that module imported? Its best if you show complete traceback, and other relevant code I'm guessing that img is what you imported from numpy.ndarray. But it looks to me like getPixel comes from pil > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick http://joelgoldstick.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor