I have a figure of paddy's leaf. I want to extract only paddy's leaf to R, G, B, H, S, V value. I have done to separate background and object. But I haven't been able to extract the value of color space. Can you help me? Thank you before.
this is my code:
rmat=Im(:,:,1)
gmat=Im(:,:,2);
bmat=Im(:,:,3);
subplot(2,2,1), imshow(rmat);
title('Red Plane');
subplot(2,2,2), imshow(gmat);
title('Green Plane');
subplot(2,2,3), imshow(bmat);
title('Blue Plane');
subplot(2,2,4), imshow(I);
title('Original Image');
%%levelr = 0.63;
levelg = 0.5;
levelb = 0.4;
i1=im2bw(rmat,levelr);
i2=im2bw(gmat,levelg);
i3=im2bw(bmat,levelb);
Isum = (i1&i2&i3);
and I want to know example: R= 60 B= 85 G=125
I am using MATLAB.
If Im
is your run-of-the-mill image, it will likely be in RGB. Thus,
rgb = Im(x,y,:)
will be a 3-element vector containing the RGB values of the pixel at (x,y)
.
Next, use the rgb2hsv
function to convert that triplet to an HSV triplet:
hsv = rgb2hsv(rgb)
You can also convert the whole image to HSV with that function in you want.