RGB相似颜色近似算法 [英] RGB Similar Color Approximation Algorithm
问题描述
压缩算法在这个基础上工作,当我逼近一帧的颜色范围的空间差异。考虑到这一点,如何可靠地计算给定的颜色是否在相似的范围内?
当然,相似性将是某种可以调整的任意/可调参数,但无论如何,这是一个近似。
非常感谢您的帮助
div class =h2_lin>解决方案感知色差可以使用 CIEDE2000色差公式。 CIEDE2000公式基于LCH颜色空间(亮度,色度和色相)。 LCH颜色空间表示为圆柱(请参见此处)。
不太准确(但更易于管理)的模型是 CIE76 颜色差异公式,基于 Lab色彩空间(L * a * b *)。没有简单的公式用于RGB或CMYK值和L * a * b *之间的转换,因为RGB和CMYK颜色模型是设备相关的。首先需要将RGB或CMYK值转换为特定的绝对颜色空间,例如sRGB或Adobe RGB。这种调整将取决于设备,但是来自变换的结果数据将是设备无关的,从而允许将数据变换到CIE 1931色彩空间,然后变换成L * a * b *。 此文章介绍了过程和公式。
Given that in RGB we can represent 256^3 combinations = 16,777,216 colors, and since the human eye can only distinguish roughly 10,000,000, there is obviously a surplus of 6,777,216 RGB combinations that chromatically are indistinguishable from counterpart colors.
Compression algorithms work on this basis when approximating out spacial difference in color ranges across a frame I believe. With that in mind, how can one reliably compute whether a given color is within a range of 'similarity' to another?
Of course, 'similarity' will be some kind of arbitrary/tunable parameter that can be tweaked, but this is an approximation anyway. So any pointers, pseudocode, intuitive code samples, resources out there to help me model such a function?
Many thanks for your help
Perceptual color difference can be calculated using the The CIEDE2000 Color-Difference Formula. The CIEDE2000 formula is based on the LCH color space (Luminosity, Chroma, and Hue). LCH color space is represented as a cylinder (see image here).
A less accurate (but more manageable) model, is the CIE76 Color-Difference formula, which is based on the Lab color space ( L*a*b*). There are no simple formulas for conversion between RGB or CMYK values and L*a*b*, because the RGB and CMYK color models are device dependent. The RGB or CMYK values first need to be transformed to a specific absolute color space, such as sRGB or Adobe RGB. This adjustment will be device dependent, but the resulting data from the transform will be device independent, allowing data to be transformed to the CIE 1931 color space and then transformed into L*a*b*. This article explains the procedure and the formulas.
这篇关于RGB相似颜色近似算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!