Re: Find all colors in an image and compare?
- From: "Hans Kesting" <news.2.hansdk@xxxxxxxxxxxxxxx>
- Date: Mon, 13 Feb 2006 15:03:46 +0100
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
.
- Follow-Ups:
- References:
- Find all colors in an image and compare?
- From: Jmc
- Find all colors in an image and compare?
- Prev by Date: Re: How to develop a HOOK application?
- Next by Date: Re: Locking Question around hashtable
- Previous by thread: Find all colors in an image and compare?
- Next by thread: Re: Find all colors in an image and compare?
- Index(es):
Relevant Pages
|
Loading