how to identify a color from an image
Show older comments
the color component should be the output eg-if the color of the image is green i need the output green. if the color is burgundy red,or crimson,or any mix output should say its presence. i tried documentation on matlab but could understand like how to specifically apply specification and thresholding.
Answers (1)
Image Analyst
on 13 Dec 2013
0 votes
Did you try any of my color segmentation demos yet? They're in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
4 Comments
nida
on 13 Dec 2013
Image Analyst
on 13 Dec 2013
Edited: Image Analyst
on 13 Dec 2013
Those are for beginners. If you want it simpler, just strip out the fancy stuff like where I display intermediate images, add titles and axes, mask the images, etc. If you know the thresholds in advance and don't do any displaying, then you can do the whole thing in one line:
detectedColor = rgb(:,:,1)>redThresh & rgb(:,:,2)<greenThresh & rgb(:,:,3)<blueThresh;
There - one line of code. Pretty simple. Will that work for you? My code adds all the other necessary things you'll need to do, or want to do, to make it into a full blown program, like determining what the thresholds should be, like displaying the image, like masking out non-desired colors, etc.
nida
on 27 Dec 2013
Image Analyst
on 27 Dec 2013
It depends on the shape of your gamut in the different color spaces as to which colorspace it would be easier to segment your color. You might be able to use RGB color space, lab color space, or hsv color space. The hue is constant as the color goes from bright to dark or from vivid red to pink to crimson, so if you want all those colors in the same segmentation you could use hsv space. You could also get just dark reds if you specify that the V or L value is less than, say, 50 or whatever darkness value you want.
Categories
Find more on Images 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!