如何比较两种颜色的相似度/差异 [英] How to compare two colors for similarity/difference

查看:1104
本文介绍了如何比较两种颜色的相似度/差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个程序,可以帮助我评估5种预定义的颜色之间的一种,哪种颜色更类似于可变颜色,以及百分比。事实是,我不知道如何一步一步地手动进行操作。因此,想一个程序就更加困难。

I want to design a program that can help me assess between 5 pre-defined colors which one is more similar to a variable color, and with what percentage. The thing is that I don't know how to do that manually step by step. So it is even more difficult to think of a program.

更多详细信息:颜色来自带有凝胶的管的照片,它们是不同的颜色。我有5个颜色不同的试管,每个试管代表5个级别中的1个。我想拍摄其他样本的照片,然后在计算机上通过比较颜色来评估该样本属于哪个级别,我也想知道它的近似百分比。我想要一个执行以下操作的程序: http://www.colortools.net/color_matcher.html

More details: The colors are from photographs of tubes with gel that as different colors. I have 5 tubes with different colors were each is representative of 1 of 5 levels. I want to take photographs of other samples and on the computer assess to which level that sample belongs by comparing colors, and I want to know that with a percentage of approximation too. I would like a program that does something like this: http://www.colortools.net/color_matcher.html

如果您可以告诉我要采取什么步骤,即使这些是我要手动思考和执行的事情。这将非常有帮助。

If you can tell me what steps to take, even if they are things for me to think and do manually. It would be very helpful.

推荐答案

请参见Wikipedia上有关颜色差异以获取正确的线索。
基本上,您想在某些多维色彩空间中计算距离度量。
但是RGB并不是感知上统一的,因此Vadim建议的欧几里得RGB距离度量将与人类感知的颜色之间的距离不匹配。首先,L a b *旨在成为感知上统一的色彩空间,并且通常使用deltaE度量。但是,还有更多精致的色彩空间和更精致的deltaE公式更接近于匹配人类的感知。

See Wikipedia's article on Color Difference for the right leads. Basically, you want to compute a distance metric in some multidimensional colorspace. But RGB is not "perceptually uniform", so your Euclidean RGB distance metric suggested by Vadim will not match the human-perceived distance between colors. For a start, Lab* is intended to be a perceptually uniform colorspace, and the deltaE metric is commonly used. But there are more refined colorspaces and more refined deltaE formulas that get closer to matching human perception.

您必须了解有关色彩空间和光源的更多信息才能进行转换。但是,要使用比欧几里得RGB指标更好的快速公式,只需执行以下操作:假设您的RGB值在sRGB色彩空间中,找到sRGB到L a b *转换公式,将sRGB转换颜色为L a b *,并计算两个L a b *值之间的deltaE。它在计算上并不昂贵,它只是一些非线性公式以及一些乘加运算。

You'll have to learn more about colorspaces and illuminants to do the conversions. But for a quick formula that is better than the Euclidean RGB metric, just do this: assume that your RGB values are in the sRGB colorspace, find the sRGB to Lab* conversion formulas, convert your sRGB colors to Lab*, and compute deltaE between your two Lab* values. It's not computationally expensive, it's just some nonlinear formulas and some multiplies and adds.

这篇关于如何比较两种颜色的相似度/差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆