How To Extract Green Channel From Rgb Image In Python Using Scikit-image Library?
Solution 1:
What you are extracting is just a single channel and this shows you how much green colour each pixel has. This will ultimately be visualized as a grayscale image where darker pixels denote that there isn't much "greenness" at those points and lighter pixels denote that there is a high amount of "greenness" at those points.
If I'm interpreting what you're saying properly, you wish to visualize the "green" of each colour. In that case, set both the red and blue channels to zero and leave the green channel intact.
So:
green_image = rgb_image.copy() # Make a copygreen_image[:,:,0] = 0green_image[:,:,2] = 0
Note that I've made a copy of your original image and changed the channels instead of modifying the original one in case you need it. However, if you just want to extract the green channel and visualize this as a grayscale image as I've mentioned above, then doing what you did above with the setting of your green_image
variable is just fine.
Post a Comment for "How To Extract Green Channel From Rgb Image In Python Using Scikit-image Library?"