从图像中获取并比较对象的颜色
我的目标是确定物体的颜色。并进行分类,例如一些蓝色、一点深蓝色或浅蓝色可以归为一类——蓝色。我有一些模板对象图像。其中有很多。我想要的是手动对这些图像进行分组。例如,有些对象有蓝色文本,但有些区域是黄色等。首先通过某种算法我手动将它们分组,然后应通过计算机分析每个组以进行一些特征提取。然后,当从相机获取随机选定对象的视频或图像时,我想正确识别它的组。我该怎么做呢?应该提取哪些特征以及如何比较它们?我正在考虑 HSV 中 Hue 平面的直方图。但不知道从该直方图中获得什么特征,然后将其与另一个(来自模板图像)进行比较
编辑1:应该分类的图像示例,如有必要,稍后将发布更多。 图像示例
My aim is to determine the color of object. And make a classification, for example some blue, little bit dark blue or light blue can be classified to one type - Blue. I have some template objects images. There are many of them. What I want is to group this images manually. For example some objects have blue colored text, but some areas of yellow etc. By some algorithm at first I group them manually, and then each group should be analyzed by computer to make some feature extraction. And then while getting from camera as video or image of the random selected object, I want to identify it's group correctly. How can I do it? Which features should be extracted and how can they be compared? I was thinking of histogram of a Hue plane in HSV. But don't know what features to get from that histogram and then to compare it with another(from template images)
EDIT 1: Example of images that should be classified, later will post more if neccessary.
image example
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 LAB 色彩空间来模仿人类感知总是好的。
http://en.wikipedia.org/wiki/Lab_color_space
这是因为该颜色空间中的欧几里得度量表示颜色之间的感知距离,即它们的接近程度。
您应该按 A、B 进行聚类并忽略 L 值(即亮度)。
It is always good to use the LAB color space in order to mimic human perception.
http://en.wikipedia.org/wiki/Lab_color_space
That is because the Euclidean metric in this color space represents the perceptual distance between colors, that is, how close they are.
You should cluster by A,B and ignore L value which is the brightness.
HSV 在不同的光照条件下使用可能会很棘手。在室外尤其如此,那里的阴影比阳光区域蓝得多。
理想情况下,您可以使用色调和饱和度分量并忽略明度分量。这将使浅蓝色和深蓝色之间的距离非常小:
dist = sqrt((h1 - h2)^2 + (s1 - s2)^2
问题是色调实际上是一个连续的尺度(就像一个角度) 255 和 0 之间应该只有 1。
HSV can be tricky to use in varying light situations. This is especially true outside, where shadows are a lot bluer than sunlight areas.
Ideally, you can use the hue and saturation components and ignore the value component. This would make the distance between a light blue and a dark blue very small:
dist = sqrt((h1 - h2)^2 + (s1 - s2)^2
The gotcha is that hue is actually a continuous scale (like an angle). The difference between 255 and 0 should only be 1.