Issue
I'm trying to extract the hue
channel from a pillow image. Below is an illustration:
In [40]: from PIL import Image
In [41]: pillow_img = Image.open('lekha.jpg')
# convert to HSV
In [42]: hsv_img = pillow_img.convert('HSV')
# cast it as NumPy array
In [43]: arr_hsv = np.asarray(hsv_img)
Now, how can I extract only the hue
channel from the array arr_hsv
?
If it's an RGB image, extracting the red
channel would translate to:
red_channel = arr_rgb[:, :, 0]
However, I'm unsure whether this is the same case for HSV as well.
Solution
It's the same (I added this as the answer, so you can close the question).
hue_channel = arr_hsv[:, :, 0]
Answered By - Amir Hossein Kargaran
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.