确定颜色名称的人工智能/统计方法

发布于 2024-09-13 16:12:48 字数 810 浏览 5 评论 0原文

我正在考虑编写一个小库来从预定的候选颜色列表中猜测(RGB 值)颜色的名称。

我的第一次尝试纯粹基于三维 RGB 颜色空间内的毕达哥拉斯距离 - 这并不是很成功,因为大多数指定的颜色点都位于空间的边缘(例如,蓝色位于 0、0、255),所以,对于空间中间的大多数颜色来说,它最接近的命名颜色是相当任意的。

因此,我正在考虑更好的方法,并提出了一些候选方案

  • HSV 颜色空间内的圆柱距离 - 这很可能与上述问题有类似的问题,但是,HSV 似乎对人类更有意义 是

  • 上述任一情况,但每个指定的颜色点都使用任意值进行加权,该值表示其对周围空间中的点的吸引力的强度。这样的模型有名字吗?我意识到这有点模糊,但对我来说似乎是一个相当直观的想法。

  • 贝叶斯网络,检查 HSV 颜色的属性并返回最可能的颜色名称(我想象的节点类似于 P(Black | Saturation < 10)、P(Red | Hue = 0)、然而,这似乎不太理想 - 例如,给定颜色为红色的概率与其色调与 0 的接近程度成正比,而不是一个离散值是否有一种方法可以采用贝叶斯网络来处理以下概率。在被测试的变量上是连续的?

  • 最后,我想知道 HSV 或 RGB 颜色空间中是否存在某种基于支持向量机的分类,但不太熟悉这些,我不确定这是否会比我最初尝试的基于毕达哥拉斯距离的方法提供任何特殊的优势,特别是因为我只处理三维空间。

因此,我想知道,你们中是否有人有类似问题的经验,或者知道任何资源可以帮助我决定一种方法?如果有人能指出我正确的方向(无论是上述之一,还是完全不同的方向),我将非常感激。

干杯!

蒂姆

I'm thinking about writing a little library to make a guess at the name of an (RGB value) colour, from a predetermined list of candidates.

My first attempt was based purely on pythagorean distance within the three-dimensional RGB colour space - this wasn't massively succesful as most of the named colour points were at the edges of the space (eg Blue at 0, 0, 255), so, for most colours in the middle of the space, the named colour that it was closest too was fairly arbitrary.

So, I'm thinking about better approaches and have come up with a few candidates

  • Cylindrical distance within an HSV colourspace - which may well have similar problems to the above, however, HSV seems to be more meaningful in a human sort of sense than RGB, which could be useful.

  • Either of the above, but with each named colour point being weighted with an arbitrary value that denotes the strength of its attraction to points in the surrounding space. is there a name for such a model? I realise this is a bit vague, but it seems like a fairly intuitive idea to me.

  • A Bayesian network that examines properties of an HSV colour and returns the most likely colour name (I'm imagining nodes similar to, for instance P(Black | Saturation < 10), P(Red | Hue = 0), However, this seems less than ideal - for instance, the probability that a given colour is red is proportional to how close its hue is to 0, rather than being a discrete value. Is there a way of adapting bayesian networks to deal with probabilities that are continuous on the variable being tested?

  • Finally, I was wondering if some sort of Support Vector Machine-based classification within either the HSV or RGB colour space, but not being massively familiar with these, I'm unsure whether this will offer any particular advantage over the pythagorean distance based approach I tried originally, especially as I'm only dealing with a three dimensional space.

Therefore, I was wondering, do any of you have any experience with similar problems, or know of any resources that might be able to help me to decide on an approach? If anyone could point me in the right direction (whether it's one of the above, or something entirely different) I'd be extremely grateful.

Cheers!

Tim

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

少跟Wǒ拽 2024-09-20 16:12:48

命名该颜色似乎根据 RGB 和 HSL 值确定名称,也许你可以使用类似的东西。

快速浏览一下脚本后,它似乎会选择在 RGB 和 HSL 方面最接近给定颜色的颜色。它基本上只是一个预定义颜色的大地图,并且不执行任何高级操作,例如加权值,但考虑到大量定义的颜色名称,它可能“足够好”,具体取决于您的要求。

Name that Color seems to determine the name based on both the RGB and HSL values, perhaps you could use something similar.

After having a quick look at the script, it seems to pick the color that is closest to the given color in terms of both RGB and HSL. It's basically just a big map of predefined colors and does nothing advanced, such as weighted values, but given the large amount of defined color names, it may be 'good enough', depending on your requirements.

忆悲凉 2024-09-20 16:12:48

是否有一种方法可以调整贝叶斯网络来处理正在测试的变量上连续的概率?

是的。我不是回答如何执行此操作的最佳人选,但应该有关于如何执行此操作的现有信息。只需在搜索过程中使用“连续”即可。

Is there a way of adapting bayesian networks to deal with probabilities that are continuous on the variable being tested?

Yes. I'm not the best person to answer how to do this, but there should be existing information on how to do this. Just use "continuous" during your search.

送你一个梦 2024-09-20 16:12:48

对于我的回答,我将跳出贝叶斯盒子进行思考。如果我必须解决这个问题,我会尝试以下三种方法之一:

1)模糊逻辑,可能基于从用户收集的经验数据。模糊逻辑可能比清晰的统计测量更好地捕捉人们谈论颜色时的意思,并使其更容易自动推断。 (还有一些将贝叶斯推理和模糊逻辑相结合的技术,IIRC。)

2)我曾经尝试过使用 Kohonen 网络自动分类颜色的想法。我并没有走得太远,但早期的结果是有希望的,因为网络倾向于收敛于从人类角度来看令人愉悦且直观的解决方案。这些节点倾向于以与人类标签(如“红色”、“橙色”)相对应的模式聚集,并且具有明显的过渡区域(如“红橙色”)。

3)我还做了一些实验,使用遗传算法为特定图像开发优化调色板。再说一遍,我并没有走得太远,但最初的测试显示出希望。

For my answer, I'm going to think outside the Baysian box. If I had to tackle this problem, I would try one of three approaches:

1) Fuzzy logic, perhaps based on empirical data gathered from users. It's possible that fuzzy logic may capture, and make it easier to automatically infer, what people mean when they talk about color better than would crisp statistical measures. (There are also techniques which combine Baysian inference and fuzzy logic, IIRC.)

2) I once played around with the idea of using Kohonen networks to automatically classify colors. I didn't take it very far, but the early results were promising in that that networks tended to converge on solutions that were pleasing and intuitive from a human perspective. The nodes tended to cluster in patterns that seemed to correspond to human labels like "red," "orange," and had obvious transition zones like "red-orange."

3) I also did some experiments which used genetic algorithms to develop optimized pallettes for particular images. Again, I didn't take it very far, but the initial tests showed promise.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文