how to divide the image into regions based on color values.

8 views (last 30 days)
hi. may i know how to divide the image into regions based on color values. for example gold coin and silver coin. how can i differentiate between gold and silver and get the each of color pixel value. tq

Accepted Answer

Image Analyst
Image Analyst on 6 Dec 2015
If you need color to distinguish between the two (which you may not), I have several color segmentation demos in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
If you know you have 3 colors, gold, silver, and the background color, you can use rgb2ind() to classify them
classifiedImage = rgb2ind(rgbImage, 3);
though it won't work if only one color coins is present - you'd have to change the 3 to 2 in that case.

More Answers (1)

Walter Roberson
Walter Roberson on 6 Dec 2015

Community Treasure Hunt

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

Start Hunting!