Colors Distance - Measurement & Visualization

in #utopian-io6 years ago (edited)

While human beings are able to easily differentiate basic colors such as red, green, blue, and etc., this gets harder when the colors are mixed up. You have probably seen the following picture on the internet:


source

Repository

https://github.com/BrightTux/ColorDistance

New Projects

  • What is the project about?

Inspired by the work of https://blog.xkcd.com/2010/05/03/color-survey-results/, the aim of this project is to create a metric system which allows users to empirically determine which color it is based on the 11 basic colors as proposed by Berlin and Kay.

The 11 basic colors described were:
Black, White, Gray, Red,Green, Blue, Yellow, Orange, Pink, Purple, Brown

This work helps both humans and computers to empirically measure the distance between a "query" color and the estimated difference. This color distance measure is important as humans and computers view colors in a very different manner as visualized below:


source

In a typically JPEG image, the color range for each channel in each pixel is from 0 to 255 where 0 is usually minimum and 255 is Maximum.

Since there are 3 channels in each typically image (Red, Green and Blue) there's too many combinations of colors which exist for the purpose of this Color Distance measurement and visualization. (256*256*256 = 16777216 COMBINATIONS!)

Hence, to reduce redundancy, I've selected to use 960 different shades of colors and compare them to the "ground truth" supplied by xkcd for each of the 11 basic colors.

The 960 color shades is generated using the HSV (Hue, Saturation, Value) color space where we quantized the values of Hue to 15, and Saturation and Value to 8 values. This process greatly reduces the total number of samples to 960 samples while providing a comprehensive analysis for visualization purposes.

The measurement of each sample shade is compared using 3 different comparisons, namely RGB (low-cost estimation of Luv distance), HSV distance, as well as LAB distance. The "Average" score is also provided as a means to see how much the data varies among the 3 different distance measure functions.

Sample use case:
You may also opt to use the values/mathematical operations from the repository for your work, in my case, i used the values for my research work to identify the colors of a vehicle.

Given an image:

I took the dominant color, and compared it with the list of values to determine the dominant color of this vehicle.

Sample screenshot of the output:

Final output can be found here: https://github.com/BrightTux/ColorDistance/blob/master/output/colorIndexes_wTable.pdf

  • Technology Stack

C++, OpenCV

  • Roadmap
    In the future, i plan to:
    1. Allow users to submit an image, and from the image, the program will compute the closest color score.
    2. Allow users to compare between the RGB, HSV, and Lab distance to see which one provides the BEST results.

GitHub Account

https://github.com/BrightTux

Sort:  

haha interesting co-relation to your previous steemit post: https://steemit.com/life/@joannewong/pkmfljl2s

Yeah, I was answering the ​question at Musing.io.

Hi @brighttux! You have received 0.1 SBD tip from @myach!

Chck out this new post from @myach: Click. Feel free to follow @myach if you like it :)

Earn daily income on steem: @tipU distributes 100% profit + 60% curation rewards to all investors.

Your Post Has Been Featured on @Resteemable!
Feature any Steemit post using resteemit.com!
How It Works:
1. Take Any Steemit URL
2. Erase https://
3. Type re
Get Featured Instantly & Featured Posts are voted every 2.4hrs
Join the Curation Team Here | Vote Resteemable for Witness

Thanks for the contribution!

It seems like an intersting project! What kind of use do you see for this for others and where and how do you think it would be implemented? What were the biggest challenges you faced when implementing it?

I am curious to see where you take this, good luck!

Click here to see how your contribution was evaluated.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Heys @amosbastian thanks for reviewing my work here :)

The work done here is part of a bigger project which i'm working on, specifically for my postgraduate studies..

Personally, i think the biggest challenge i face while implementing this was the idea formulation...
When i first implemented a color detection tool, i realize that it's rather difficult to pin point an exact color name for each color... and especially if you take into consideration of all the color names ..

The tool was too rigid as it only identified a single color given a query ... example: a pink object is somewhat similar to a red object and different people may describe those colors differently...

So when a person describes a pink object, they may actually see it as red... and those objects may not be retrieved in a retrieval system...

In order to make the system somewhat flexible, i decided to compute the similarity score of the query color againt's all other colors... this way, if a pink object was queried, a red object would have high similarity score as well, hence, it would be retrieved!

The following link contains a snippet of how it works in my retrieval system:

Hey @brighttux
Here's a tip for your valuable feedback! @Utopian-io loves and incentivises informative comments.

Contributing on Utopian
Learn how to contribute on our website.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

thanks for the invaluable tip!

Hey @brighttux
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Your post has been featured in TeamMalaysia TehTarik Sundays . Here is a little tip!

You've been upvoted by TeamMalaysia Community :-

To support the growth of TeamMalaysia Follow our upvotes by using steemauto.com and follow trail of @myach

Vote TeamMalaysia witness bitrocker2020 using this link vote for witness

P/S: First time trying to contribute to utopian-io :)

Do feel free to comment and provide constructive criticism.

Keep up the good work of posting #teammalaysia.

thanks for dropping by Ray :) you too!

It will be great if it squeezes all 32/16 bits colors into 256 colors since I need most of it for GIF file. Thanks for sharing.

hmm, i don't quite get what you mean... because an 8-bit color = 2^8, which already produces 256 colors..

a 16-bit color = 2^16 = 65536 colors...
a 32-bit color = 2^32 = 4294967296 colors!

i think photoshop and gimp can "auto" select their color tables to limit the colors to 256 or something..
example from this video:

Now you confuse me... 😆

haha.. i guess i understand what u mean... that it'll be great if there's some tool to "compress" 16/32 bit colors into 256 colors...


however, here's the problem... when you try to squeeze 65k colors into 256 colors, you lose information, hence... kindda pointless....

BUT, nowadays technology quite advance, you can sort of manually "select" which colors you want in your 256 color palettes ... which would improve the GIF quality

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.032
BTC 64555.14
ETH 3086.03
USDT 1.00
SBD 3.85