What is the correct way to sort colors when calculating a median value?
-
Unlike with grayscale values there are many ways how to sort a set of colors: luminance, hue, saturation etc. The common way is probably to sort the rgb, yuv or lab components separately and recombine them, but then the resulting color is very likely not in the original set. And sorting them numerically (24 bit rgb values for example) somehow doesn't feel correct either.
-
Answer:
If you are after the central tendency of a set of colors and want to pick one of the set as its representative, I'd compute all pairwise distances in the set and pick the color whose sum of pairwise distances is the smallest (this is the same as picking the color with the lowest mean distance to all other colors). To make the distances more visually meaningful I would use a color space like CIE LAB (or, even better, CIE CAM02).
Ján MoroviÄ at Quora Visit the source
Other answers
to continue Jan's answer: ... and if you insist on finding the median rather than the mean, you can approximate it by raising Jan's pairwise distances to the power of a number between 0 and 1, call it Gamma, for example Gamma=0.1 or 0.01. Distance_for_color(a) = Power( Sum[ over all colors b]( Power(Distance_between_two_colors(a,b), Gamma) ), (1/Gamma) ).
Yoav Bressler
Related Q & A:
- What is the correct way to do pin curls?Best solution by Yahoo! Answers
- What's the best way to get smudges off of a plasma?Best solution by Yahoo! Answers
- What is the best way to find new members for a yahoo group?Best solution by Yahoo! Answers
- What is the best way to get back links to a website?Best solution by Yahoo! Answers
- What is the correct way to do the robot?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.