How to create a binary image from hsv image?

2 次查看(过去 30 天)
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 个)

Image Analyst
Image Analyst 2013-3-31
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 个评论
elaf
elaf 2014-3-29
How Can I get Hue as number not as histogram??
Image Analyst
Image Analyst 2014-3-29
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by