【问题标题】:How to add a 2D texture to an Equirectangular image如何将 2D 纹理添加到 Equirectangular 图像
【发布时间】:2017-04-14 14:22:50
【问题描述】:

我有一个像一些文本一样的 2D 纹理,我想将它添加到一个 equirectangular 图像中,而不会像我将它粘贴到顶部那样扭曲。

澄清一下:

我有一个 2D 纹理:

我有一个 equirectangular 图像 (source):

如果我只是将 2D 纹理放在 360 度查看器的顶部,它看起来会变形,那么我该如何解决这个问题并将其转换为 equirectangular 纹理?非常感谢任何帮助:)

【问题讨论】:

  • 你做到了吗?我已经被困了好几个星期了..
  • 我最终对项目采取了不同的方式,但我确实想过我现在该怎么做,我想我会制作一个 opengl 着色器或二维纹理在平面上的东西,你可以定位在 3d 空间中,相机以 360° fov 捕捉,因为这将是一个等角投影。或者,您可以将投影转换为立方体贴图进行任何更改,然后将其转换回来,希望这会有所帮助。

标签: theory projection 360-degrees


【解决方案1】:

我使用这个 Windows Shell/DOS 脚本,但有一些注意事项,见下文:

:: Parameters:
:: 1: source equirectangular image
:: 2: folder of the image
:: 3: yaw of the point of interest
:: 4: pitch of the point of interest

@set LOGL=error

Rem Inserts strings into the command environment. The set values
Rem can be used later by programs.
::----------- Extract image section ------------
@echo.
@echo Centering image on desired point...
ffmpeg -hide_banner -loglevel %LOGL%   -i %2%1 -vf v360=e:e:yaw=-%3:pitch=-%4 -y %2test_equi_rotated-%1

@echo.
@echo Extracing region to edit...
ffmpeg -hide_banner -loglevel %LOGL%   -i %2test_equi_rotated-%1 -vf v360=e:flat -y %2test_crop_flat-%1

@echo.
@echo Please write your text onto "test_crop_flat-%1"
@echo.
@set /p=Hit ENTER to continue...

::-------- Convert edited extracted section back to equirectangular ---------------
@echo.
@echo Converting crop+text back to equirectangular...
ffmpeg  -hide_banner -loglevel %LOGL% -i %2test_crop_flat-%1 -vf v360=flat:e -y %2test_crop_equi-%1

@echo.
@echo Please save "%2test_crop_equi-%1" with transparency
@echo.
@set /p=Hit ENTER to continue...

::--------- Overlay edited extracted section on original image --------------

@echo.
@echo Merging edited crop into rotated image...
ffmpeg  -hide_banner  -loglevel %LOGL% -i %2test_equi_rotated-%1 -i  %2test_crop_equi-%1 -filter_complex "overlay" -y %2test_merge_rotated-%1

@echo.
@echo Rotating the image back to original direction:
ffmpeg  -hide_banner -loglevel %LOGL%  -i %2test_merge_rotated-%1 -vf v360=e:e:yaw=%3:pitch=%4:roll=2.1  -y %2test_merge-%1
@del %2test_merge_rotated-%1

@echo.
@echo Output saved in "test_merge-%1"

示例用法:

overlay.bat test-base.png .\ 10 10 

脚本分为三部分:

  1. 从原始 ER 图像中提取感兴趣区域并转换为平面投影

在这部分脚本停止后,等待用户随意编辑提取的图像。

  1. 将已编辑的部分重新投影为 equirectangular

在这部分脚本停止后,等待用户保存临时输出,为图像添加透明度(我不知道如何用 ffmpeg 做到这一点)。

  1. 将该部分粘贴回原始图像上

警告:我必须在最终图像中添加一个小卷,否则在转换回 equirectangular 后它会出现轻微旋转,不知道为什么。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-16
    • 2018-02-16
    • 2018-03-25
    • 2017-11-08
    • 2013-08-15
    • 1970-01-01
    • 2018-07-31
    • 2019-12-24
    相关资源
    最近更新 更多