找到一组图像中色彩最丰富的图像
给定一组图像,有什么方法可以按照哪些图像具有最完整的全色谱覆盖的顺序来对它们进行评级?
更新我发布了一个姐妹问题,它是“最“彻底”的点围绕圆的分布”。
Given a set of images what would be a way to rate them in order of which ones have the most complete coverage of the full colour spectrum?
UPDATE I've posted a sister question which is an abstraction of one approach at "Most “thorough” distribution of points around a circle".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将像素想象为 RGB 空间中的一组 3D 点。根据图像像素的 3d 凸包体积对图像进行评级。
Imagine pixels as a set of 3D points in an RGB space. Rate the images by the volume of the 3d convex hull of their pixels.
建议将图像从 RGB 值转换为 HSV 值。
那么图像的离散色调越多,它的色彩就越丰富。
为了提高性能,您可能只需获取图像的子样本,和/或减少色调“筒仓”或量子的数量。
Wiki 是你的朋友
编辑“均匀度”:
嗯,我想你可以使用标准差方法来解决这个问题假设理想的“平均值”是色相箱中像素的“均匀”分布(即平均值 = 总像素数除以离散色相箱总数)。标准差就是实际计数与平均值之差的平方。这种方法有一些警告,因为平方会严重惩罚任何计数非常低或非常高的色相箱(您可能想要“限制”直方图范围)。您还需要标准化像素数(用于计数)和图像之间的色相箱数,以标准化比较。
另一个问题是,对于大量的色相箱,所有色调都被赋予相同的权重,而不管它们之间的光波长“距离”如何(例如,仅具有许多不同蓝色色调的图像与具有许多不同蓝色色调的图像同等重要)一些离散的红、绿和蓝色色调 - 这是其他海报提到的体积方法可能更可取的地方。
Recommend converting the image from RGB values into HSV values.
Then the more discrete Hues the image has, the more colourful it can be considered.
For performance, you you can probably just take a subsample of the image, and / or reduce the number of Hue 'silos' or quanta.
Wiki is your friend
Edit 'Evenness':
Well, I guess you could use standard deviation approach to this by assuming that the ideal 'mean' would be an 'even' distribution of pixels across the Hue bins (i.e. mean = Total #Pixels divided by Total number of discrete Hue bins). Standard deviation would then be the square of the difference between the actual count and this mean. There are some caveats with this approach, as the squaring would heavily penalise any Hue bins with very low or very high counts (you might want to 'cap' the histogram range). You would also need to standardise the number of pixels (for counting) and the number of Hue bins across images to normalise the comparisons.
Another issue is that for a high number of Hue bins, that equal weighting is given to all hues, irrespective of the 'distance' of light wavelength between them (e.g. an image with just lots of different blue hues would count equally to an image with a few discrete shades of red green and blue - this is where volume approaches mentioned by other posters may be preferable.
每个通道运行一个直方图,正如尼古拉斯所说,对它们进行评分。
编辑:
直方图将为您提供离散值和频率。
您需要考虑离散值,例如,如果等于 0 fq,则意味着您的图像没有有关该通道和值的信息。您不能直接将该值乘以 fq,因为这会扰乱评级的计算,因为例如全黑图像可以具有具有非常高 fq 的单个离散值。
因此,您需要将最丰富多彩的图像视为包含零 fq 离散值的图像。
run a histogram per channel and as Nicolas said rate them.
Edit:
Well the histogram will provide you with discrete values and the frequency.
You need to consider the discrete values e.g. if equal to 0 fq that means your image has no info on that channel and value. You can't directly multiply the value by the fq because that will mess the calculation for rating, since e.g. a whole black image can have a single discrete value with a very high fq.
so you need to consider the most colorful image as the less containing zero fq discrete values.
如果“完全覆盖全色谱”意味着给定色彩空间中可能的每个离散颜色值至少一次,那么您可以只计算每个图像中的所有唯一颜色,并且具有最高值的颜色可以称为最丰富多彩。
如果光谱指的是色调数量,那么您可以将每个像素的颜色转换为 HSV 或 HSL,计算图像具有的唯一色调值的数量,并再次将数量最多的颜色视为色彩最丰富的颜色。
如果从完整的角度来看,您的意思类似于您关于圆周围的点的其他问题,我认为定义某种线性密度度量可能很有用 - 尽管我不完全知道如何最好地应用于手头的数据...或者即使这就是你的意思。
If by "complete coverage of the full colour spectrum" you mean having every discrete colour value possible in a given colorspace at least once, then you could just count all the unique colours in each image and the one with the highest value could be called the most colourful.
If, by spectrum, you mean number of hues, then you could convert each pixel's colour to HSV or HSL, tallying the number of unique hue values an image has, and again consider the one with the highest number of them the most colourful.
If, by complete, you mean something like in your other question about points around a circle, I think it might be useful to define some sort of linear density metric -- although I'm not exactly how best to apply to the data at hand...or even if that's what you mean.