Opened 6 weeks ago
Last modified 6 weeks ago
#10912 new defect
d_fov and h_fov not working well when converting equirectangular to rectilinear (v360)
Reported by: | 0kajuna0 | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | v360, equirect, rectilinear |
Cc: | 0kajuna0 | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug: When trying to convert a 360 frame from equirectangular to rectilinear with the v360 filter, the d_fov (diagonal field of view) works well, but h_fov (horizontal) and v_fov (vertical) don't seem to produce the expected results. The image gets distorted. This also happens if no fov is specified.
How to reproduce:
(tested with recent git master versions)
Equirectangular test file: https://en.wikipedia.org/wiki/Equirectangular_projection#/media/File:Plate_Carr%C3%A9e_with_Tissot's_Indicatrices_of_Distortion.svg
No fov results in a distorted output
% ffmpeg -i in.png -vf v360=e:rectilinear a.png
d_fov results in correct proportions:
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125 b.png
Using h_fov and v_fov to output a different aspect ratio results in a very distorted image
% ffmpeg -i in.png -vf v360=e:rectilinear:h_fov=56:v_fov=112 c.png
We can try to correct this by specifying width and height, but the result is still distorted
% ffmpeg -i in.png -vf v360=e:rectilinear:h_fov=56:v_fov=112:w=1440:h=2880 d.png
As a partial workaround, we can use d_fov and apply a roll and transpose to output a correct vertical ratio
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125:roll=90,transpose=1 e.png
This also works for converting the image back to equirectangular
% ffmpeg -i e.png -vf transpose=2,v360=rectilinear:e:id_fov=125:roll=-90 h.png
Another workaround is to use d_fov and trigonometry to define the output resolution
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125:w=1440:h=2880 f.png
This allows us to output any ratio
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125:w=1440:h=1440 g.png
But unfortunately bringing that back to equirectangular breaks proportions
% ffmpeg -i g.png -vf v360=rectilinear:e:id_fov=125 i.png
Is this a bug or am I doing something wrong?
Correction: When using w and h, I was assuming constant pixel per degree measurements, that wouldn't be correct, but shouldn't ffmpeg output at the right dimensions to avoid distortion when w and h are not specified?