# Question about initUndistortRectifyMap & remap function

**URL:** <https://forum.opencv.org/t/question-about-initundistortrectifymap-remap-function/12696>\
**Category:** C++\
**Tags:** calib3d, fisheye, imgproc\
**Created:** [April 6, 2023, 9:28am UTC](https://forum.opencv.org/t/question-about-initundistortrectifymap-remap-function/12696 "2023-04-06T09:28:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_rtx](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@Joe\_rtx](https://forum.opencv.org/u/Joe_rtx)\
**Post date:** [April 6, 2023, 9:28am UTC](https://forum.opencv.org/t/question-about-initundistortrectifymap-remap-function/12696/1 "2023-04-06T09:28:42Z")

</div>

Hi,  
I study opencv finsheye calibration document, and using **initUndistortRectifyMap** and **remap** function to get undistortion result. Then there ara some question:

1). The output of **initUndistortRectifyMap** map1 and map2 are 2 channels and 1 channel respectively. According to document about remap, I know the reason why map1 is 2 channels, but what is map2 meaning?  
2). I use **remap** funcion, and try to let map2 be None, but get the wrong result, the pixel values in result are all (0, 1, 0). Why?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/e/e856179adaa52415d7bf33d015181adaae33d324.png)

Thanks

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 6, 2023, 10:08am UTC](https://forum.opencv.org/t/question-about-initundistortrectifymap-remap-function/12696/2 "2023-04-06T10:08:22Z")

</div>

Welcome!

> See [convertMaps](https://docs.opencv.org/4.x/da/d54/group __imgproc__ transform.html#ga9156732fa8f01be9ebd1a194f2728b7f) for details

---

<div class="post-metadata">

**Author:** ![Joe\_rtx](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@Joe\_rtx](https://forum.opencv.org/u/Joe_rtx)\
**Post date:** [April 7, 2023, 9:14am UTC](https://forum.opencv.org/t/question-about-initundistortrectifymap-remap-function/12696/3 "2023-04-07T09:14:02Z")

</div>

Hi crackwitz,

Thanks for your prompt reply.  
There are some questions I still don’t understand:

1. According to **convertMaps** page I know that the first output array contains the rounded coordinates. But I still don’t understand why the second output array contains indices in the interpolation tables ?

2. I understand interpolation, but what is interpolation table doning? In my situation, map2 is a output array with size w\*h, and value between 0~1024.

3. In **remap** function, When map1 and map2 are both 1-channel, representing map\_x and map\_y, I can clearly understand what the remap function is doing.  
However, when map1 and map2 are 2-channel and 1-channel respectively, I am not sure what the remap function does.

Thanks
