2

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

澄清:

我有一个 2D 纹理:

2D 纹理

我有一个 equirectangular 图像(来源): 等距

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

4

1 回答 1

0

我使用这个 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 

脚本分为3部分:

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

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

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

在这部分脚本停止之后,等待用户保存临时输出,为图像添加透明度(我不知道如何使用 ffmpeg 进行操作)。

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

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

于 2021-08-15T13:37:52.080 回答