Perspective-and-Equirectangular icon indicating copy to clipboard operation
Perspective-and-Equirectangular copied to clipboard

hFOV calculation is wrong

Open a1ex90 opened this issue 2 years ago • 1 comments

Hey, first of all thanks for this nice library. I stumbled on a bug inside Perspec2Equirec.py in the calculation of the hFOV.

instead of self.hFOV = float(self._height) / self._width * FOV the correct formula to calculate the horizontal FOV would be:

self.hFOV = np.rad2deg(2 * np.arctan(self._height * np.tan(np.radians(FOV/2)) / self._width))

see here.

It makes no difference as long as the input images are squared but when using images with a different aspect ratio it leads to incorrect projections.

a1ex90 avatar Dec 14 '22 14:12 a1ex90

The auther used wFOV and hFOV in his source code, it seems that wFoV refers to widthFoV (actually horizontal FOV) and hFOV refers to heightFOV (actually vertical FOV)?

bbbbbMatrix avatar Mar 05 '24 00:03 bbbbbMatrix