Info
This question is closed. Reopen it to edit or answer.
iam having a problem in finding hsv..
1 view (last 30 days)
Show older comments
hi i am new to matlab .i know that HSV is an m-by-3 matrix where the first column represents the hue,the 2nd one saturation...but when i try this code
p=imread('football.jpg');
>> r=rgb2hsv(p);
>> h=p(:,:,1);
>> s=p(:,:,2);
i am not getting m-by-3 matrix. if the image size is 200x200 i want to get hue value as 200x1 matrix anyone help me out to do this
2 Comments
Jan
on 28 Sep 2012
Your assumption, that "HSV" is an m-by-3 matrix is not sufficient. Usually HSV means an m-by-n-by-3 array, with m and n are the pixel sizes of the image.
Answers (1)
Image Analyst
on 28 Sep 2012
Edited: Image Analyst
on 28 Sep 2012
Why should it be 200x1? The hue image, saturation image, and value image will ALL be the same size as the original image (200x200). Why would they be anything different than that? You say "i know that HSV is an m-by-3 matrix where the first column represents the hue,the 2nd one saturation" but that is simply not true. Every pixel in the image has RGB components, and has HSV components. These HSV components are laid out in a rectangular array just like the image. If you wanted them in the inconvenient layout of (rowsOfrgbImage * columnsOfrgbImage) by 3, then you'd have to call reshape(). But I don't know why you'd want that - it would just make it harder to work with.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!