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

https://imgur.com/dxlo01O

d_fov results in correct proportions:

% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125 b.png

https://imgur.com/Ti96A7o

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

https://imgur.com/B0tJctX

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

https://imgur.com/tl6CbJq

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

https://imgur.com/XydgshW

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

https://imgur.com/uNHThfJ

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

https://imgur.com/evVUX5i

This allows us to output any ratio

% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125:w=1440:h=1440 g.png

https://imgur.com/OC8pwQE

But unfortunately bringing that back to equirectangular breaks proportions

% ffmpeg -i g.png -vf v360=rectilinear:e:id_fov=125 i.png

https://imgur.com/TP8wXzF

Is this a bug or am I doing something wrong?

Change History (1)

comment:1 by 0kajuna0, 6 weeks ago

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?

Note: See TracTickets for help on using tickets.