How to create a binary image from hsv image?

I have an hsv image which contains some yellow colored regions and other colored regions, my aim is to get an image in which the pixels that do not satisfy the yellow shaded regions are removed(i.e, represented by black color) and yellow colored regions represented by white color.
Please help me to accomplish the same.
P.S. I am a newb to image processing, don't have much experience in this field. So, any detailed help would b really useful.
Thanks in advance!!! :)

回答(1 个)

See my demo on "Simple color detection by hue": http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. It does that, and it's well commented.

2 个评论

How Can I get Hue as number not as histogram??
Each pixel has a hue. You can get the hue of each pixel in the image like this:
hsv = rgb2hsv(rgbImage);
hueImage = hsv(:, :, 1);
You can get a histogram of the hue, you can view it as an image, you can extract out the hue of one or more pixels, or you can get the mean of a box or irregular shape that you specify. What do you want to do? Originally I thought you wanted to get all the yellow pixels, which is why I gave you code to do that. But now you want something different that I don't know what it is.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Image Processing Toolbox 的更多信息

提问:

2013-3-31

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by