合并povray的任意大小的部分图像

发布于 2024-10-05 01:24:01 字数 960 浏览 0 评论 0原文

起始情况:

使用 povray 创建场景的 4 个部分图像。

povray +SR1 +ER200 +SC0 +EC200 +W400 +H400 +OPART1 povray.pov
povray +SR1 +ER200 +SC201 +EC400 +W400 +H400 +OPART11 povray.pov
povray +SR201 +ER400 +SC0 +EC200 +W400 +H400 +OPART2 povray.pov
povray +SR201 +ER400 +SC201 +EC400 +W400 +H400 +OPART22 povray.pov

要解决的问题:

  • 以编程方式合并 4 个图像。

需要考虑的事项:

  • 大多数部分图像不是有效图像,无法打开。例如,可以打开第一部分图像,显示一个矩形,图像位于左上角,其他所有内容都是黑色的。但其余图像仅包含有关他所在区域的信息。我们可以说这些图像已经被破坏了。
  • 输出格式用 +F 设置,可以是 PPM、PNG、未压缩和压缩 Targa。有效的解决方案可以使用这些格式中的任何一种。
  • 重点关注如何合并图像。您知道每个部分图像所具有的矩形。

已尝试过的事情:

Starting situation:

Using povray I create 4 partial images of a scene.

povray +SR1 +ER200 +SC0 +EC200 +W400 +H400 +OPART1 povray.pov
povray +SR1 +ER200 +SC201 +EC400 +W400 +H400 +OPART11 povray.pov
povray +SR201 +ER400 +SC0 +EC200 +W400 +H400 +OPART2 povray.pov
povray +SR201 +ER400 +SC201 +EC400 +W400 +H400 +OPART22 povray.pov

Problem to solve:

  • Merge the 4 images programmatically.

Things to take in consideration:

  • Most of the partial images are NOT valid images and cannot be opened. For example, the first partial image can be opened, showing a rectangle with the image at the top left and everything else is black. But the rest of the images contain only the information regarding his zone. We could say that those images are broken.
  • The output format is set with the +F and could be PPM, PNG, Uncompressed and Compressed Targa. A valid solution could use any of those formats.
  • Focus on how to merge the images. You know the rectangle that each partial image have.

Things that have been tried:

  • Concatenating the images with Tail as described in http://povray.tashcorp.net/tutorials/qd_multicpu_render/ . It only works if the partial images are complete on the width axis, that is if PART1 is a set of lines, PART2 another set of lines...and no column division. But we have column division.
  • Use ImageMagick. It cannot open the partial images. It says they are broken.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那伤。 2024-10-12 01:24:01

我找到了如何实现这一目标。

您需要修补 Povray,以便它保存有关 PNG 文件的偏移量的信息。

这就是补丁。
https://gist.github.com/721862

您需要下载 povray 的源代码并应用补丁。要应用补丁,请将补丁文件保存在 povray-3.6.1/source/patch.patch 中,然后:

cp patch.patch povray-3.6.1/source/
cd povray-3.6.1/source/
patch png_pov.cpp patch.patch

I found how this could be achieved.

You need to patch Povray so that it saves information about the offset of PNG files.

This is the Patch.
https://gist.github.com/721862

You need to download the sources for povray and apply the patch. To apply the patch you save the patch file in povray-3.6.1/source/patch.patch and then:

cp patch.patch povray-3.6.1/source/
cd povray-3.6.1/source/
patch png_pov.cpp patch.patch
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文