How to create a binary image from hsv image?

2 visualizzazioni (ultimi 30 giorni)
Deepak
Deepak il 31 Mar 2013
Commentato: Image Analyst il 29 Mar 2014
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!!! :)

Risposte (1)

Image Analyst
Image Analyst il 31 Mar 2013
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 Commenti
elaf
elaf il 29 Mar 2014
How Can I get Hue as number not as histogram??
Image Analyst
Image Analyst il 29 Mar 2014
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.

Accedi per commentare.

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by