我可以对HSV空间进行采样(固定s
和v
)
hue_gradient = np.linspace(0, 360,16)#sample 16 different equally spread hues
hsv = np.ones(shape=(1, len(hue_gradient), 3), dtype=float)*0.75#set sat and brightness to 0.75
hsv[:, :, 0] = hue_gradient#make one array
hsv
array([[[ 0. , 0.75, 0.75],
[ 24. , 0.75, 0.75],
[ 48. , 0.75, 0.75],
[ 72. , 0.75, 0.75],
[ 96. , 0.75, 0.75],
[120. , 0.75, 0.75],
[144. , 0.75, 0.75],
[168. , 0.75, 0.75],
[192. , 0.75, 0.75],
[216. , 0.75, 0.75],
[240. , 0.75, 0.75],
[264. , 0.75, 0.75],
[288. , 0.75, 0.75],
[312. , 0.75, 0.75],
[336. , 0.75, 0.75],
[360. , 0.75, 0.75]]])
然而,所有这些颜色在感知上并不一致
我可以通过运行colormath软件包中的deltaE2000方程(deltaE2000)来确认这一点。结果如下所示:
这些值是三角形值,颜色0-15对应于色调角度位置。如您所见,有些颜色低于感知阈值
所以,问题是,我是否有可能在s
和v
固定的情况下对hsv空间进行统一采样?如果没有,我如何以一种方式对空间进行采样,使颜色排列为色调相似的邻域,并且s
和v
的变化尽可能小
我尝试了一些方法,但最终似乎奏效了。它均匀地隔开色调值,然后轻推它们,直到它们在视觉上是一致的
NUDGE_SIZE
如果设置错误(将其更改为2
在这里不会产生类似彩虹的效果),那么NUDGE_SIZE
可能会把它搞砸,我认为最佳值取决于您进行了多少次迭代以及生成了多少种颜色。相邻颜色的delta_e_cie2000
值(给定设置)是[16.290288769191324, 16.290288766871242, 16.290288753399196, 16.290288726186013, 16.290288645469946, 16.290288040904777, 16.290288035037598, 16.290288051426675, 16.290288079361915, 16.290288122430887, 16.290288180738187, 16.290288265350803, 16.290288469198916, 16.29028866254433, 16.2902887136652]
,这是非常一致的:我认为iters=1000
对于这几个颜色来说太过分了。我在这里使用普通列表,但它应该转换为NumPy数组,并且可能运行得更快一些算法的工作原理如下:
NUDGE_SIZE
成正比李>iters
次李>相关问题 更多 >
编程相关推荐