AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Finding the closest color

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

Finding the closest color

Postby njsokalski » Wed Jan 09, 2019 2:42 am

I am relatively new to AForge and image analysis, so maybe there is an easy way to do this that I am unaware of. I am writing an app to scan a simple card that has a 5x5 grid of colored squares, each of which is one of 4 colors (red, blue, tan, black). Once I have found a blob for each square (which is obviously a topic for it's own thread), I plan on determining the color based on the ColorMean property of the blob. However, because the ColorMean will rarely 100% match any of the colors exactly, I need to figure out which one is closest. Does anybody have any suggestions on the most efficient way to do this? Thanks.
njsokalski
 
Posts: 10
Joined: Thu Dec 20, 2018 11:46 pm

Re: Finding the closest color

Postby andrew.kirillov » Wed Jan 09, 2019 7:57 am

For example, Euclidean distance between the found mean color and those colors in your data set. Pick the one which gives the smallest distance.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3427
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to AForge.NET Framework