按颜色对图像排序

发布于 2024-11-09 11:38:21 字数 636 浏览 5 评论 0原文

我正在寻找一种对图像进行排序的方法,如以下屏幕截图所示:

http://www.pixolution .de/sites/LargeImages_en.html

我已经查看了 stackoverflow 上有关此主题的所有线程,但没有一个建议的解决方案能够接近为我提供上面的图像。

我尝试过的方法:

  1. 对于每个图像,按出现的降序构建 RGB 颜色的直方图
  2. 对于每个直方图,计算与黑色 (r:0,g:0,b:0) 的距离,如下所示:

    图像直方图中的颜色:
      总距离 += 图像颜色.百分比 * 距离(BLACK_RGB, color.rgb)
    

然后按距离对图像进行排序

我希望相似颜色分布的图像能够结束具有相似的距离并导致按颜色进行视觉排序。事实并非如此,它似乎有点工作,但不像上图所示。

对于距离函数,我尝试过欧氏距离、hsv 排序(h->s->v)甚至 Lab 距离排序。这些都没有帮助

如果有人有更好的方法,我很想知道!

I'm looking for a way to sort images as in the following screenshot:

http://www.pixolution.de/sites/LargeImages_en.html

I've looked at all the threads on this topic on stackoverflow but none of the proposed solutions even come close to giving me the image above.

Approaches I've tried:

  1. for each image, build histogram of rgb colors in descending order of occurrence
  2. for each histogram, calculate a distance from black (r:0,g:0,b:0) as follows:

    for color in image_histogram:
      total_distance += color.percentage_of_image * distance(BLACK_RGB, color.rgb)
    

then sort images by their distances

I was hoping that images of similar color distribution would end up with a similar distance and result in a visual ordering by color. This was not the case, it seems to somewhat work but not like in the image above.

For the distance function, I've tried euclidean distance, hsv sorting (h->s->v) and even Lab distance sorting. None of which has helped

If anyone has a better approach, I would love to know!

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

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

发布评论

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

评论(4

清眉祭 2024-11-16 11:38:21

我自己从来没有做过这样的事情,所以请原谅我,如果以下方法是幼稚的:

  • 对于每个图像,通过将所有像素的 R、G、B 值相加,将其归结为 1 个平均 RGB 值,然后除以总和# 像素。将分量标准化为 [0..1]
  • 根据 RGB 值在 2D 颜色空间中绘制图像。这可以是 3D(r、g、b)矢量变换的 2D 投影。

I've never done something like this myself, so forgive me if the following approach is naive:

  • For each image, boil it down to 1 average RGB value by summing the R, G, B values of all pixels, and divide by the total # pixels. Normalize the components to [0..1]
  • Plot the image in your 2D color space based on the RGB values. This can be a 2D projection of a 3D (r, g, b) vector transformation.
时间你老了 2024-11-16 11:38:21

您可以转换为 HSV 并按 H 排序

大多数人在想到“颜色”时想到的就是

色调: PHP 中的 RGB 到 HSV

you could convert to HSV and sort by H

Hue is what most people think of when they think "color"

see: RGB to HSV in PHP

伤感在游骋 2024-11-16 11:38:21

使用相似颜色之间的距离而不是它们与黑色之间的距离对相似颜色进行分组,并使用图像中的平均颜色。

Group similar colors using the distance between them and not between them and black, and use the average color in the image.

原谅过去的我 2024-11-16 11:38:21

您可能想查看 ImagePlot。我不确定系统背后的算法是否可用,但您当然可以通过免费软件下载并运行您的图像集来分析它们。

该软件用于海量图像集合的许多有趣的可视化,数百万+

信息:http://lab .softwarestudies.com/p/imageplot.html#whatsnew
来源:https://github.com/culturevis/imageplot

You might want to check out ImagePlot. I'm not sure if the algorithms behind the system are available, but you can certainly download and run your image collection through the free software to analyze them.

This software is used in many interesting visualizations of massive image collections, millions+

Info: http://lab.softwarestudies.com/p/imageplot.html#whatsnew
Source: https://github.com/culturevis/imageplot

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