loading
 
comparing the color of two blobs
Dawson from Malaysia  [173 posts]
5 years
Hi STeven,

I would like to compare the color of two blobs and determine if they are both of a similar color. It would be great if the sample color module had a feature to add a second sample coordinate.
Anonymous 5 years
Dawson,

Can you not use two color sample modules?

Once you get both samples you can compare the actual color values using some form of comparison. For example a VBScript can generate that ratio with 0 being very similar and 1 being very different.

Note there are many ways to compare colors ... the attached is a simple one.

See the attached robofile as an example.

STeven.



program.robo
Dawson from Malaysia  [173 posts] 5 years
STeven

Yes that works fine. I wasn't sure how to do the comparison and if i would have to use the HLS or HSV color space instead of RGB.
Thanks.
Dawson from Malaysia  [173 posts] 5 years
I have been testing the program and i am getting inconsistent results
Around 5.0 E-2 for similar colors
0.2 for dissimilar colors

And certain conditions the result shows similar when it is clearly not similar.
Also the color window (sampled color) doesn't seem to show the correct color of the sampled area.
The code does not seem to be very reliable. Test was done with remo.gif

Is there a standard algorithm or module for color comparison? I did some searching and found that most people measure the distance of the
samples in a HSL plot to determine similarity. Not sure how reliable this is
from a human perception standpoint.

In any case this seems more complex then i expected.

Anonymous 5 years
"the attached is a simple one" - yes, color theory is huge ... you can spend many years on that one!

Ok, but 0.20 and 0.05 seem like good numbers? Or were you expecting different?

Can you include your robofile where you are seeing the really different colors come up as the same? We can take a quick look if we have something to test against.

STeven.

Dawson from Malaysia  [173 posts] 5 years
Hi STeven,

The problem was that i sampled a large area instead of a small area. I did that the first time but the second time i assumed it was sampling the COG of the sample area. My mistake.

The numbers are ok. i was expecting it to be closer to 1 for dissimilar color but
o.2 is good enough :)
Dawson from Malaysia  [173 posts] 5 years
Hi STeven,

The following is an example of a problem i am trying to solve. There are 5 blobs. 3 are different shades of red i.e. similar color. one is blue and one is green. I am trying to filter out the blue and green blob as they are the odd ones out. I only need to sample one pixel of each blob i.e. the blobs COG.
Any idea how i could go about this?

ps. i dont know the blob colors before hand. I just want to filter the odd colors
out.
Dawson from Malaysia  [173 posts] 5 years
I will use the color statistics module to get the blob color data. Thanks.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index