kaustubh-sadekar / OmniCV-Lib

A computer vision library for omnidirectional (360 degree) cameras.
MIT License
144 stars 21 forks source link

Error in Fisheye2Equirectangular Conversion #43

Closed jorgejgnz closed 6 months ago

jorgejgnz commented 6 months ago

The function fisheyeImgConv.mapper.fisheye2equirect() seems to ignore delx and dely parameters.

I'm using applications/set_fisheye_params_gui.py without modification and the resulting equirectangular image from fisheye is incorrect. The sliders delCx and delCy don't have any effect on resulting image. fisheyeImgConv.Cx and fisheyeImgConv.Cy vary when the slider is used but these variations have no effect on resulting image.

Expected result

According to documentation delCx and delCy sliders should have effect on resulting image:

Expected

How to replicate

For the following fisheye image:

Fisheye

This is the resulting equirectangular image (for any delCx and delCy values):

Equirect

jorgejgnz commented 6 months ago

In this part of fisheye2equirect function at omnicv.py, +self.Cx and +self.Cy were considered as independent instructions:

        self.map_x = np.multiply(r, np.cos(theta)).T.astype(np.float32)
        + self.Cx
        self.map_y = np.multiply(r, np.sin(theta)).T.astype(np.float32)
        + self.Cy

Changing it to this fixed the problem:

        self.map_x = np.multiply(r, np.cos(theta)).T.astype(np.float32) + self.Cx
        self.map_y = np.multiply(r, np.sin(theta)).T.astype(np.float32) + self.Cy