samedi 18 avril 2015

How to extract green channel from RGB image in Python using Scikit-Image library?

I am extremely new to scikit-image (skimage) library in Python for image processing (started few minutes ago!). I have used imread to read an image file in a ndarry. The array is 3 dimensional where the size of the third dimension is 3 (namely one for each of Red, Green and Blue components of an image).



rgb_image = imread("input_rgb_image.jpg")
rgb_image.shape # gives (1411L, 1411L, 3L)


I tries to extract green channel as



green_image = rgb_image[:,:,1]


But when I write this image matrix to an output file as :



imsave("green_output_image.jpg",green_image)


I get an image which doesn't really look ONLY green!


Aucun commentaire:

Enregistrer un commentaire