如何检测不同光照条件下的颜色 [英] How to detect colors under different illumination conditions

查看:33
本文介绍了如何检测不同光照条件下的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆不同颜色的衣服图像,我想检测每个图像的颜色.假设我在日光条件下有一张蓝色裙子图像,我可以通过 RGB 分布获得正确的颜色.然而,在晚上很难分辨颜色,蓝色"被识别为黑色".很难制定一个统一的标准来通过 RGB 分布来指定颜色.

I have a bunch of images of clothes of many colors and I want to detect the colors of each image. Say that I have a blue skirt image in daylight conditions and I can get the correct color through RGB distributions. However, at night it's difficult to tell the color and the "blue" is recognized as "black". It's very hard to make a unified standard to specify colors through RGB distributions.

因此,我想知道是否有一种方法或算法可以检测不同照明下的颜色?

As such, I am wondering is there a way or algorithm to detect colors under different illuminations?

顺便说一句:我也尝试了 HSV 色彩空间,结果并不好.

BTW: I also tried HSV color space and the results were not good.

推荐答案

这是一个非常困难的问题,今天仍在努力解决.它的要点是使用一组具有代表性的图像基本颜色来找到 颜色量化对不同的外部刺激具有鲁棒性……照明、阴影、照明不足等.

That's a very hard problem and it's still trying to be solved today. The gist of it is to find a colour quantization using a representative set of basic colours of an image that is robust against different external stimuli... lighting, shade, poor illumination etc.

很遗憾,我无法推荐任何一种算法来为您解决所有情况.但是,过去对我有用的一种算法是在我从事图像检索工作时.具体来说,来自柯达研究实验室的 Jiebo Luo 和 David Crandall 的工作:http://vision.soic.indiana.edu/papers/compoundcolor2004cvpr.pdf

Unfortunately I can't suggest any one algorithm that would do the work for you for all cases. However, one algorithm that has worked for me in the past was when I was doing work in image retrieval. Specifically, the work by Jiebo Luo and David Crandall from Kodak Research Labs: http://vision.soic.indiana.edu/papers/compoundcolor2004cvpr.pdf

基本算法是看一下ISCC-NBS调色板设置.此外,此链接更有成效:https://www.w3schools.com/colors/colors_nbs.asp.它是一组 267 种颜色,代表了我们今天在现代社会中看到的颜色.通常,当我们描述颜色时,我们有一组一个或多个形容词,然后是主色调.例如,那件衬衫是深浅的蓝色,或者是浅亮的黄色等.这个算法的美妙之处在于,当所讨论的颜色受到不同的外部刺激时,我们拥有所有这些赋予颜色意义的形容词,但归根结底,颜色的最后一部分——主要色调——是我们所追求的.

The basic algorithm is to take a look at the ISCC-NBS colour palette set. Also, this link is much more fruitful: https://www.w3schools.com/colors/colors_nbs.asp. It is a set of 267 colours that are representative of the colours that we see in modern society today. Usually when we describe colours, we have a set of one or more adjectives, followed by the dominant hue. For example, that shirt is a darkish pale blue, or a light bright yellow, etc. The beauty of this algorithm is that when the colour in question is subject to different external stimuli, we have all of these adjectives that give meaning to the colour, but at the end of the day, the last part of the colour - the dominant hue - is what we're after.

这些颜色中的每一种都有一个关联的 RGB 值.这些颜色被转换成 CIE Lab 颜色空间,形成 267 个 CIE Lab 查找表.

Each of these colours has an associated RGB value. These colours are transformed into the CIE Lab colour space which form a 267 CIE Lab lookup table.

要对特定输入颜色进行分类,您需要将此输入的 RGB 值转换为 CIE Lab 颜色空间,然后确定最接近此查找表的颜色.已经表明,CIE Lab 颜色空间中两种颜色之间的欧几里得距离最能代表人类对颜色的感知差异.一旦我们确定了颜色最接近查找表中的哪个位置,我们就会去掉所有的形容词,看看主要色调是什么,从而对颜色进行相应的分类.

To classify a particular input colour, you would transform this input's RGB values into the CIE Lab colour space, then determine the closest colour to this lookup table. It has been shown that the Euclidean distance between two colours in the CIE Lab colour space best represents the difference in human perception of colours. Once we determine which location in the lookup table the colour is closest to, we strip out all of the adjectives and see what the dominant hue is and we thus classify that colour accordingly.

例如,如果我们有一个 RGB 像素并将其转换为 Lab,然后发现最接近的颜色是亮黄色,我们将删除亮"并且代表该 RGB 像素的最终颜色将是黄色.

For example, if we had a RGB pixel and we converted it to Lab, then found that the closest colour was bright yellow, we would remove the "bright" and the final colour that is representative of that RGB pixel would be yellow.

因此,最终的算法是这样的:

Therefore, the final algorithm is this:

  1. 找到 ISCC-NBS 颜色集的 RGB 值并转换到 CIE Lab 并创建一个查找表,我称之为 LUT1.例如,在 Python 中,您可以简单地将其设为 2D 列表或 2D NumPy 数组.
  2. 创建另一个查找来存储 ISCC-NBS 颜色集中每种颜色的主色调 - 因此去掉所有形容词并留下主色调,我称之为 LUT2.例如,在 Python 中,您可以创建一个字典,其中键是 LUT1 的相应行,值是实际的基本颜色本身.是字符串表示还是表示基本颜色的 RGB 三元组取决于您.
  3. 对于有问题的像素,通过该像素的 CIE Lab 组件与 LUT1 中的组件之间的欧几里德距离,找到与 LUT1 匹配的最接近的 ISCC-NBS 颜色.
  4. 在 LUT1 中找到该位置后,使用相同的索引对 LUT2 进行索引,并获取最终颜色以对该输入像素的颜色进行分类.

<小时>

希望这会有所帮助!


Hope this helps!

这篇关于如何检测不同光照条件下的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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