比较RGB颜色,使色差更显著那么强总和 [英] Compare RGB colors so that color difference is more significant then intensity sum

查看:415
本文介绍了比较RGB颜色,使色差更显著那么强总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当谈到在图像分析比较的颜色,你很快就会发现,你可以只使用灰度图像。为什么?因为通常你这样做:

When it comes to comparing colors during image analysis, you'll soon discover that you can just use grayscale image. Why? Because usually you do this:

double average = (color.r+color.g+color.b)/3;

基于grascale平均颜色

,我做了一个算法,实际上是当涉及到​​寻找,屏幕上的对象很满意的(我用整个桌面,但是很好,这就够了):

Based on grascale average colors, I made an algorithm that is actually quite satisfying when it comes to find an object on screen (I used whole desktop, but well, this is enough):

由平均颜色搜索花去67ms,同时通过精确的像素匹配(蓝框)搜索了1.255的的! (和前终止发现的第一场比赛之后,而普通色算法循环整个图像)。

Search by average color took 67ms while searching by exact pixel match (blue frame) took 1.255 seconds! (and the former terminated right after finding first match, while the average color algorithm loops whole image).

不过,我想,以改善GUI的precision。在GUI红色按钮看起来就像蓝色的按钮,并可能被错误地匹配。这就是为什么我实现了色彩敏感整体形象。现在我发现,我不知道如何正确地比较出彩的款项得到一些的真正的色差。

But I wanted to improve precision on GUI's. In GUI red button looks just like blue button and may be matched wrongly. This is why I implemented color-sensitive integral image. Now I discovered that I don't know how to properly compare the color sums to get some real color difference.

所以,想象一下,你有2个数组3个元素。

So imagine you have 2 arrays of 3 elements.

//Summed colors on the image you're looking for
double sumOnSearchedImage[3];
//Summed colors on currently checked rectangle (in some loop we'll not bother with here)
double sumOnBigImage[3];

在阵列的每个号码分别重新presents红色,蓝色和绿色的总和(未平均值)。你如何比较这些所谓的 RGB(0,255,255) RGB(255,255,255)是差大于的区别 RGB(170170170) RGB(255,255,255)

Every number in the arrays represents red, blue and green sum (not average) respectively. How do you compare these so that difference between rgb(0, 255, 255) and rgb(255,255,255) is larger than difference between rgb(170,170,170) and rgb(255,255,255)?

推荐答案

在度量空间(255 0,255)的RGB之间的距离和RGB(255,255,255)已经远远超过RGB(170170170)和RGB之间距离大(255,255,255)。

In the metric space the distance between rgb(0, 255, 255) and rgb(255,255,255) is already far larger than distance between rgb(170,170,170) and rgb(255,255,255).

只是不可将自己的距离,但他们的正方形,速度。

Only use not distances themselves, but their squares, for speed.

|(0, 255, 255), (255,255,255)|^2 = 255^2 = 9*85^2
|(170,170,170), (255,255,255)|^2 = 3*85^2

顺便说一句,不要惊奇地发现灰阶看到的是往往不够。好的设计,使设计人员能够让事情)以及可见光和b)至少以某种方式可见约18%的人,只是这么多有问题的颜色看。 http://www.colour-blindness.com/general/$p$pvalence/

这篇关于比较RGB颜色,使色差更显著那么强总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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