1

I have an intrinsic parameter(fx,fy, cx,cy, k1~k4) of fisheye camera obtained by OpenCV's fisheye::calibrate(). How can I convert the fisheye image to an equirectangular image?

I have seen some similar questions but none of them seems to reflect the calibration results. Are distortion parameters k1~k4 not necessary in this conversion?

urotanke
  • 11
  • 2

1 Answers1

0

This Medium article, while in Python might offer some further reading on the topic. It seems to indicate that once you have obtained the K and D values from fisheye::calibrate you can then use fisheye::initUndistortRectifyMap (note that D can be empty, as it seems to be in your case) to generate two Maps, which can then be used with remap to transform the warped input image into a dewarped output image (further reading on remapping here).

In python (for anyone looking at this later) this is done as such:

ap1, map2 = cv2.fisheye.initUndistortRectifyMap(K, D, np.eye(3),
                                                K, DIM, cv2.CV_16SC2)
undistorted_img = cv2.remap(img, map1, map2,
                            interpolation=cv2.INTER_LINEAR, 
                            borderMode=cv2.BORDER_CONSTANT)
Blayzeing
  • 696
  • 4
  • 12
  • I don't have the time at the moment to append a C++ sample, but I hope this helps put you on the right path. – Blayzeing Jun 25 '20 at 12:58
  • I've referred to [this page](https://tenteroring.luna.ddns.vc/tenteroring/2017/04/1697) to obtain undistorted image and the steps include what you have suggested. But obviously this is not an equirectangular image. – urotanke Jun 25 '20 at 17:44
  • Ah, my mistake. I misinterpreted your question. – Blayzeing Jun 25 '20 at 19:18