Re: Find all colors in an image and compare?



Hi
Need some advice on how to get all colors in an image.
I wish to have an input file, in my case it will be a scanned piece of
fabric.
I would like to first of all gen an array with all the colors
represented in the image.
and an percentage of how much the color exists.

Lets assume that the color of the fabric is blue, it will probably have
pixels that are not #0000FF since the diferent threads in the fabric
creates darker areas.
So when getting the colors I need to have a threshold, a percentage
that a color needs to differ to "become" a new bolor in the color
array.
So the problem is how do I get all unique colors from an imaga, (with a
threshold) bacically
#0000FF = blue #0000EE probably the same blue therefore not a new
color.
I guess that its the most light color tha should be assumed to be the
color, what do you think?

(Hope this makes sence).
best regards
/Jimmy

probably something along the lines of:
1) loop through all pixels of the image, reading color values
2) change the color value to some "normalized value" to group similar colors (maybe: forget some least-significant bits of the R,G&B values)
3) mark those color values in some list: key = color value; value = count (if it is not in the list, add with value 1; if it is, increase the value)

Note: you can't just go through some sorted list to compare values and see if they are "similar". Say you have numbers from 1 to 10. 1 is almost equal to 2, so let's group them together. And 3 is almost 2, so group together. And 4 is almost 3 and ... and 9 is almost 10. So is now 1 almost equal to 10??

Hans Kesting


.



Relevant Pages

  • Find all colors in an image and compare?
    ... Need some advice on how to get all colors in an image. ... I wish to have an input file, in my case it will be a scanned piece of ... I would like to first of all gen an array with all the colors ... So when getting the colors I need to have a threshold, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: how to select a certain percentage of "bright" pixels from an array
    ... I cannot come up with a reliable solution. ... If I have a 2D array, all elements of which are real numbers. ... And I'd like to keep 20% of the pixels whose values are higher than ... once you find the threshold you can set the ones below it to 0 using logical idexing: ...
    (comp.soft-sys.matlab)
  • Re: How to put pixels and RGB in m-file??
    ... > particular threshold, then try the following. ... >>>what you are saying is that you have a colour image with RGB ... >>>You want to find pixels within the colour image whose value ... >> total RGB is above a certain value it will trigger an interupt. ...
    (comp.soft-sys.matlab)
  • Re: How to put pixels and RGB in m-file??
    ... If you want the user to mouse over the image and have a M-function tell you a new pixel value based on whether the "total" RGB value is over a particular threshold, ... I used imtool and it gives the pixels and RGB of the image ... You want to find pixels within the colour image whose value is above a given threshold on all three planes. ...
    (comp.soft-sys.matlab)
  • Re: Bayes classifier and Gaussian distribution
    ... belong to a person on an image, and pixels belonging to the ... belonging to a person, and bg being pixels belonging to backgroung). ... you will get a quadratic equation with two solutions TL and TR ... is only one threshold, it is not a quadratic classifier. ...
    (sci.stat.math)

Loading