What is the discrete step size after rgb2hsv conversion
2 views (last 30 days)
Show older comments
Hi everyone,
For my internship I'm doing some image processing, just starting out and it is a surprisingly large and interesting field :-) Currently I'm thresholding HSV images, but my input images are in the RGB 24 bit color space.
I'm converting my 8 bit RGB colour channels to HSV channels with the matlab 'rgb2hsv' function. Quite an easy step, but I also need to know what the discrete step size of the different channels (i.e. H, S and V) are. Is there some way to calculate this? Is there a general formula that you can apply to an X-bit RGB image to obtain the discrete steps in the HSV colour space?
Thanks in advance for your comments!
0 Comments
Accepted Answer
Image Analyst
on 13 Dec 2013
What do you mean by the step size? The spatial quantization of the hsv images is the same as your input images. The intensity quantization depends on the range of what you put in. Try this code and examine the output
rgbImage = imread('peppers.png');
hsvInt = rgb2hsv(rgbImage);
hsvDouble = rgb2hsv(double(rgbImage));
rgbScaled = im2double(rgbImage);
hsvScaled = rgb2hsv(rgbScaled);
whos hsvInt
hsvInt(200,200,3)
whos hsvDouble
hsvDouble(200,200,3)
whos hsvScaled
hsvScaled(200,200,3)
4 Comments
Image Analyst
on 16 Dec 2013
I don't know what you're doing when you do the optimization but if you're adjusting values, you don't have to change them in jumps of 0.0000000001, you can do larger jumps. Just see what a one gray level difference corresponds to. Find the hue for (128,128,128) and for (128,128,129) and see how much the hue is different, then just change your steps by that much.
Anyway, it really depends on what shape of the gamut do you want to carve out of the image. HSV will get you a cylindrical pie shaped sector. Delta E will get you a sphere. RGB will get you a rectangular block (in RGB space). It also depends on if you want to apply the same color classification to each image or if you want it to adapt thresholds depending on the image content.
Maybe you can try Brett's tool for exploring your data: http://www.mathworks.com/matlabcentral/fileexchange/38484-segmenttool-an-interactive-gui-for-segmenting-images
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!