如何算法上色歌曲列表在iTunes 11的工作?歌曲列表、算法、工作、iTunes

2023-09-10 23:23:02 作者:凌希.

新的iTunes 11的专辑的歌曲列表,挑选颜色的字体和背景在专辑封面的功能,一个非常漂亮的景色。任何人都知道如何在算法的工作?

The new iTunes 11 has a very nice view for the song list of an album, picking the colors for the fonts and background in function of album cover. Anyone figured out how the algorithm works?

推荐答案

我在近似数学iTunes的11色算法给出的专辑封面作为输入:

I approximated the iTunes 11 color algorithm in Mathematica given the album cover as input:

经过反复试验,我想出了一个算法,适用于〜80%,与我测试过它的专辑。

Through trial and error, I came up with an algorithm that works on ~80% of the albums with which I've tested it.

的算法处理找到图像的主色的大部分。甲prerequisite找到主色,但是,在计算两种颜色之间的量化差值。计算两个颜色之间的差别的一种方法是计算在RGB色彩空间中的欧几里得距离。然而,人类色彩感觉不与距离在RGB颜色空间匹配得很好。

The bulk of the algorithm deals with finding the dominant color of an image. A prerequisite to finding dominant colors, however, is calculating a quantifiable difference between two colors. One way to calculate the difference between two colors is to calculate their Euclidean distance in the RGB color space. However, human color perception doesn't match up very well with distance in the RGB color space.

所以,我写了一个函数来转换RGB颜色(格式为 {1,1,1} )来的