随机点立体图的抗锯齿

时间:2022-06-17 21:23:55

I recently completed some Python (2.7) code for generating random dot stereograms based on this paper. The output is fairly good, though I have noticed that, even with a smooth gradient in the depth map, the output stereogram lacks these smooth gradients, instead having varying levels of depth. I believe this to be due to the DPI chosen when generating the image. While the detail of the depth can be increased by increasing the DPI, this becomes impractical as the convergence point becomes more difficult to reach.

我最近完成了一些Python(2.7)代码,用于生成基于本文的随机点立体图。输出相当不错,但我注意到,即使在深度图中有平滑的渐变,输出立体图也缺少这些平滑的渐变,而是具有不同的深度级别。我相信这是由于生成图像时选择的DPI。虽然可以通过增加DPI来增加深度的细节,但是这变得不切实际,因为会聚点变得更难以到达。

Here are two examples. First at 75 DPI and second at 175 DPI. On the 75 DPI image, distinct "triangles" of depth can be seen. In the 175 DPI image, these are less pronounced but the guidance dots at the bottom of the image are further apart, and therefore viewing the 3D image is more difficult.

这是两个例子。首先是75 DPI,第二是175 DPI。在75 DPI图像上,可以看到不同的深度“三角形”。在175 DPI图像中,这些不太明显,但是图像底部的引导点更远,因此观看3D图像更加困难。

随机点立体图的抗锯齿 随机点立体图的抗锯齿

I'm looking to modify my current code to anti-alias the 3D image in order to smooth out the gradients even with a lower DPI. I have tried using SSAA on the depth map and pattern and generating the stereogram, then reducing the image size again with an antialiasing filter. However this seems to just contain the stereogram to the left of the image. For example, if I make the image 4 times bigger, the stereogram is limited to the left hand quarter of the image. The rest is just random noise and cannot be viewed. How would I go about antialiasing the image hidden in the stereogram? My code is almost the same as the algorithm described in the paper, so an antialiasing algorithm based on that would be perfect.

我正在修改我当前的代码以对3D图像进行抗锯齿处理,以便在DPI较低的情况下平滑渐变。我尝试在深度图和图案上使用SSAA并生成立体图,然后使用抗锯齿滤镜再次缩小图像尺寸。然而,这似乎只包含图像左侧的立体图。例如,如果我将图像放大4倍,立体图仅限于图像的左手四分之一。其余的只是随机噪音,无法查看。我如何对立体图中隐藏的图像进行抗锯齿处理?我的代码几乎与本文中描述的算法相同,因此基于此的抗锯齿算法将是完美的。

1 个解决方案

#1


0  

The solution for the problem I was having, with the stereogram being contained to the left of the image, was caused by not extending the same array to reflect the larger depth map. This caused everything beyond the original length of the depth map to be randomly generated noise.

我所遇到的问题的解决方案,其中立体图包含在图像的左侧,是由于没有扩展相同的阵列以反映更大的深度图而引起的。这导致超出深度图原始长度的所有内容都是随机生成的噪声。

After solving this problem, a second problem arose, in that the 3D image was distorted by the anti-aliasing, causing more gradient issues than it was solving. My solution for this was to increase the DPI setting in the code. For example, if I increased the size of the depth map by 4x, the stereogram must be generated with a DPI 4 times greater (300, rather than 75). When scaled down again, this produced excellent results.

解决了这个问题之后,出现了第二个问题,即3D图像因抗锯齿而失真,导致比解决时更多的梯度问题。我的解决方案是增加代码中的DPI设置。例如,如果我将深度图的大小增加4倍,则必须使用4倍大的DPI(300,而不是75)生成立体图。当再次缩小时,这产生了极好的结果。

随机点立体图的抗锯齿

This image uses 2x SSAA, making the gradients comparable with the 175DPI image from the question, but with a much easier converging point.

此图像使用2x SSAA,使得渐变与问题中的175DPI图像相当,但具有更容易的会聚点。

随机点立体图的抗锯齿

This image uses 4x SSAA, and I find the jaggies barely visible at all. The noise here becomes a lot more blurred and the general colour of the image becomes quite grey. I have found this effect can be avoided by pregenerating the noise and scaling that up by the same AA factor. This is demonstrated in the next image.

这个图像使用4x SSAA,我发现锯齿几乎看不到。这里的噪音变得更加模糊,图像的一般颜色变得非常灰暗。我发现这种效果可以通过预先生成噪声并按相同的AA因子进行缩放来避免。这将在下一张图片中进行说明。

随机点立体图的抗锯齿

#1


0  

The solution for the problem I was having, with the stereogram being contained to the left of the image, was caused by not extending the same array to reflect the larger depth map. This caused everything beyond the original length of the depth map to be randomly generated noise.

我所遇到的问题的解决方案,其中立体图包含在图像的左侧,是由于没有扩展相同的阵列以反映更大的深度图而引起的。这导致超出深度图原始长度的所有内容都是随机生成的噪声。

After solving this problem, a second problem arose, in that the 3D image was distorted by the anti-aliasing, causing more gradient issues than it was solving. My solution for this was to increase the DPI setting in the code. For example, if I increased the size of the depth map by 4x, the stereogram must be generated with a DPI 4 times greater (300, rather than 75). When scaled down again, this produced excellent results.

解决了这个问题之后,出现了第二个问题,即3D图像因抗锯齿而失真,导致比解决时更多的梯度问题。我的解决方案是增加代码中的DPI设置。例如,如果我将深度图的大小增加4倍,则必须使用4倍大的DPI(300,而不是75)生成立体图。当再次缩小时,这产生了极好的结果。

随机点立体图的抗锯齿

This image uses 2x SSAA, making the gradients comparable with the 175DPI image from the question, but with a much easier converging point.

此图像使用2x SSAA,使得渐变与问题中的175DPI图像相当,但具有更容易的会聚点。

随机点立体图的抗锯齿

This image uses 4x SSAA, and I find the jaggies barely visible at all. The noise here becomes a lot more blurred and the general colour of the image becomes quite grey. I have found this effect can be avoided by pregenerating the noise and scaling that up by the same AA factor. This is demonstrated in the next image.

这个图像使用4x SSAA,我发现锯齿几乎看不到。这里的噪音变得更加模糊,图像的一般颜色变得非常灰暗。我发现这种效果可以通过预先生成噪声并按相同的AA因子进行缩放来避免。这将在下一张图片中进行说明。

随机点立体图的抗锯齿