知道要用于像素(RGB)“色差"的距离度量 [英] Knowing which distance metric to use for 'color differences' in pixels (RGB)

查看:91
本文介绍了知道要用于像素(RGB)“色差"的距离度量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在使用灰度缩放来比较像素,我认为这并不是很理想,因为它会丢失大量信息.有哪些常用的算法可以做到这一点?例如,通常认为欧几里得距离是一个好的指标吗?我敢肯定有很多,我想知道一种方法,可以根据我使用的图像类型(铁路)选择最佳图像.

我想到的是在两幅图像上采样一千个点,一个带火车,一个不带火车.然后,我可以利用它们之间的差异(使用任何通用指标),然后为初学者绘制分布.理想情况下,一旦有了这种分布,就可以执行某种统计测试以确定哪种算法表现最佳.

解决方案

使用欧几里德距离的主要优点之一是计算简单.但是,RGB空间不是比较色差的好颜色空间.灰度投影的适应性甚至更低.

基于这些前提,历史上已经提出了几种颜色空间,以测量人类在欧氏距离上的色差.

然而,人类感知的复杂性与尝试使用简单公式来相对于不同颜色空间映射坐标相冲突.这导致了许多解决方案的泛滥,这些解决方案在近似于人类感知的目标与公式的简单性之间取得了平衡.

CIELAB是评估色差最广泛使用的色彩空间之一.根据维基百科

CIELAB旨在作为一个感知上统一的空间,其中给定的数字变化对应于相似的感知颜色变化.

仅使用欧氏距离的原始定义可以追溯到1976年.另一个维基百科页面解释说,为了纠正后来发现的不均匀性,历史上已经发表了各种改进.

总而言之,为了评估两种颜色之间人类感知的差异,我建议您按照以下方式进行操作:

  1. 使用可以在网上找到的公式将颜色从RGB颜色空间转换为CIELAB颜色空间(您可能希望将RGB转换为CIEXYZ,然后将CIEXYZ转换为CIELAB);
  2. 计算两种映射颜色之间的欧几里得差.当然,您可以根据需要使用其他指标之一.

Currently, I'm using grayscaling to compare pixels, which is not really ideal I think since it loses a ton of information. What are some common algorithms for doing this? Is Euclidean distance, for example, generally considered a good metric? I'm sure there are many and I'd like to know of a way to pick the best one for the type of images I work with, railway tracks.

I was thinking of something like sampling a thousand points on two images, one with a train present and one without. Then I could take the difference between them (using any common metric) and then plot the distribution for starters. Ideally, once I have this distribution, I can perform some sort of statistical test to determine which algorithm behaves best.

解决方案

One of the main advantages of using euclidean distance is that is simple to compute. However, the RGB space is not a good color space in which to compare color differences. Its grayscale projection is even less adapt.

Based on these premises, several color spaces have been proposed in history in order to measure human-perceived color differences with the euclidean distance.

The complexity of the human perception, however, collides with the attempt to use simple formulas for mapping coordinates relative to different color-spaces. This led to the proliferation of a number of solutions that balance the objective to approximate the human perception with the simplicity of the formulas.

The CIELAB is one of the most broadly used color-spaces for evaluating color differences. According to Wikipedia

CIELAB was intended as a perceptually uniform space, where a given numerical change corresponds to similar perceived change in color.

The original definition that uses just the euclidean distance dates back to 1976. Another Wikipedia page explains that various refinements have been published in history in order to correct the non-uniformities that were discovered later.

To summarize, for evaluating the human-perceived difference between two colors, I suggest you to proceed in the following way:

  1. Convert the colors from RGB color space to CIELAB color space by using the formulas you can find online (you may want to convert RGB to CIEXYZ and then CIEXYZ to CIELAB);
  2. Compute the euclidean difference between the two mapped colors. You can of course use one of the other metrics according to the accuracy you need.

这篇关于知道要用于像素(RGB)“色差"的距离度量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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