Mathematica渲染并输出为不同颜色的RGB颜色值的最小差异是什么? [英] What is the minimal difference in RGB color values which Mathematica renders and exports as different colors?
问题描述
我很惊讶发现,其中 Mathematica 为以下代码提供了True
(在具有 Mathematica 8.0.1的32位Windows XP上):
I was amazed when I found that Mathematica gives True
for the following code (on 32 bit Windows XP with Mathematica 8.0.1):
Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]] ===
Rasterize[Graphics[{RGBColor[0, 0, 1/257], Disk[]}]]
Mathematica渲染并导出为不同颜色的RGB颜色值的最小差异是什么?是机器相关的吗?
What is the minimal difference in RGB color values which Mathematica renders and exports as different colors? Is it machine-dependent?
推荐答案
我相信此行为与计算机有关,但是我不知道它与操作系统之间的依赖程度.在我的机器上,仅当分母为511
时,它的计算结果才为True
.
I believe this behaviour is machine dependent, but I do not know how exactly it depends on the OS. On my machine, it evaluates to True
only when the denominator is 511
.
n = 257;
While[(Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]] ===
Rasterize[Graphics[{RGBColor[0, 0, 1/n], Disk[]}]]) != True,
n++];
Print@n
Out[1]=511
n<511
p1 = ImageData@Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]];
p2 = ImageData@Rasterize[Graphics[{RGBColor[0, 0, 1/257], Disk[]}]];
ArrayPlot[p1 - p2]
该差在整个n=510
期间都是恒定的,并且等于1/255
.
This difference is constant all the way through n=510
and is equal to 1/255
.
Max[p2 - p1] === N[1/255]
Out[1]=True
这篇关于Mathematica渲染并输出为不同颜色的RGB颜色值的最小差异是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!