RGB image to HSV image conversion
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello all
I have an rgb image and I want to convert it into HSV image and want to get only SV image.I have code like that
img=imread('lena.bmp');
[H S V]=rgb2hsv(img);
this computes each H,S and V channel individual I want to compute only SV only how can I do it..
it is not possible to o it like
cat(2,S,V);...?
or
rgbimage=img;
rgbimage(:,:,2)=S;
rgbimage(:,:,3)=V;
Any help is appreciated...
0 Commenti
Risposte (1)
Image Analyst
il 9 Set 2013
No - none of that is right. For one, you can't get the separate channels out of rgb2hsv(), though that might be a nice new enhancement/feature to add. You can do this:
hsv = rgb2hsv(rgbImage);
h = hsv(:, :, 1); % Hue image.
s = hsv(:, :, 2); % Saturation image.
v = hsv(:, :, 3); % Value (intensity) image.
You certainly would not want to combine them into a 3D image called anything like rgbimage because that would be very deceptive since it's not an RGB image.
6 Commenti
azam sayeed
il 17 Set 2015
Modificato: Walter Roberson
il 17 Set 2015
sir when i apply meanValue to different images i still get the same mean value based on hue component
%window1
hsv2=rgb2hsv('testw1.png');
hueImage2 = hsv2(:,:, 1);
meanHue2 = mean2(hueImage2);
display(meanHue2 );
%window4
hsv3=rgb2hsv('test.png');
hueImage3 = hsv3(:,:, 1);
meanHue3 = mean2(hueImage3);
display(meanHue3);
output:
meanHue2 =
38.9913
meanHue3 =
38.9913
Image Analyst
il 17 Set 2015
You need to send in an image to rgb2hsv, not a string that happens to be a filename:
rgbImage = imread('testw1.png'); % Get image from file
hsv2=rgb2hsv(rgbImage); % Convert image, not string.
Vedere anche
Categorie
Scopri di più su Convert Image Type in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!