Pixel brightness level

asked 2014-12-27 06:04:18 -0500

marklasta gravatar image

Hi everyone, I'm currently working on some fuzzy pattern recognition algorithm and trying to apply it in image processing. The preprocessing step is shown as follow.

Starting from a bitmap image, I need to convert it in grayscale doing so:

retina_image = Image('img/retina.ppm') # load input image
grey_retina_image = retina_image.greyscale() # convert input image to grayscale

Next I need to work on each pixel brightness level so I used getNumpy():

grey_matrix = grey_retina_image.getNumpy() # get pixel brightness matrix

If I try to print grey_matrix the output kinda weird:

[[[2 2 2] [3 3 3] [2 2 2] ...,
[2 2 2] [1 1 1] [4 4 4]]

I mean, if my input image size is 700 x 605 pixels, how can I get its 700 x 605 matrix ? That is what I need to work on. Recap... Starting from an image of 700 x 605 pixels (grayscale), how can I get the 'whole matrix' associated with it ?

Thank you in advance.

edit retag flag offensive close merge delete