How to count the number of colored objects in a picture?

13 visualizaciones (últimos 30 días)
NASADUDE
NASADUDE el 4 de Feb. de 2017
Editada: Image Analyst el 28 de Ag. de 2017
Hi Everyone I am just starting image processing with matlab, I need to find how many colored pins in the picture attached and how many of each color and then find and count individual colors, then detect the white and transparent pins can someone help please and keep in mind I never did any image processing before what so ever.
  2 comentarios
dusi jayasree
dusi jayasree el 28 de Ag. de 2017
i m a newbie..and wanted to know if we can count the colors in as image directly by any process or count the colors present in image by segmentation....is it possible to count colors after an image segmentation..???plz help me wit th is question
Image Analyst
Image Analyst el 28 de Ag. de 2017
Editada: Image Analyst el 28 de Ag. de 2017
I'd probably convert to HSV color space and threshold on saturation. Then I'd convert to lab colorspace with rgb2lab() and get the lab mean for each blob (pushpin). Any blobs that are within a certain distance (Delta E color difference) of each other, I'd consider them to be the same color pushpin. Then count the number of clusters you have after this merging operation. This should work for most colored pushpins, though the white and clear ones will be problematic and might have to be detected by a different algorithm.

Iniciar sesión para comentar.

Respuesta aceptada

Carl
Carl el 6 de Feb. de 2017
Editada: Carl el 6 de Feb. de 2017
It looks like you'd like to perform some standard image segmentation. See the following page for an example on doing Color-based Segmentation:
https://www.mathworks.com/help/images/examples/color-based-segmentation-using-k-means-clustering.html?prodcode=IP&language=en
You should also take a look at the following tutorial on image segmentation:
In general, you could convert your image to a L*a*b* colorspace, classify each color with clustering, label your original image, and then count each component or manipulate your image as necessary.

Más respuestas (1)

Image Analyst
Image Analyst el 6 de Feb. de 2017
See my Color segmentation demos in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
As far as determining how many colors there are you'll have to use some unsupervised clustering methods in the Statistics and Machine Learning Toolbox. Since you don't know how many colors in advance, you can't use easy methods like kmeans or k-nearest neighbor. See http://www.mathworks.com/help/stats/cluster-analysis.html At one extreme, you could consider that every pixel in the image is a different color, so you probably have literally thousands of unique colors, but you don't want that so you have to do cluster analysis.
  1 comentario
NASADUDE
NASADUDE el 7 de Feb. de 2017
Hi Image Analyst I am trying all this but again I am very new and this is way over my head, anyway I can have some direct contact to you for questions ?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by