# Simple question on cv::remap()

**URL:** <https://forum.opencv.org/t/simple-question-on-cv-remap/17313>\
**Category:** C++\
**Tags:** imgproc\
**Created:** [April 16, 2024, 10:02am UTC](https://forum.opencv.org/t/simple-question-on-cv-remap/17313 "2024-04-16T10:02:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nji9](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nji9](https://forum.opencv.org/u/nji9)\
**Post date:** [April 16, 2024, 10:02am UTC](https://forum.opencv.org/t/simple-question-on-cv-remap/17313/1 "2024-04-16T10:02:07Z")

</div>

There must be some misunderstanding from my side, as this code doesn’t output the original image (as expected) but a single color one:

```
Mat myMat;

myMat = imread ("image.png");

Mat mapIt (myMat.size(), CV_32FC2, Scalar (0,0)),
    matDst;

remap (myMat, matDst, mapIt, noArray(), INTER_LINEAR);

imwrite ("result.png", matDst);

```

Where’s my mistake?

---

<div class="post-metadata">

**Author:** ![nji9](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nji9](https://forum.opencv.org/u/nji9)\
**Post date:** [April 16, 2024, 10:09am UTC](https://forum.opencv.org/t/simple-question-on-cv-remap/17313/2 "2024-04-16T10:09:03Z")

</div>

OK, [got it](https://github.com/opencv/opencv/issues/24603).

So it’s about `WARP_RELATIVE_MAP` that is mentioned in the doc (without any explanation) but isn’t defined at all (4.8.0).

The “neutral” element for remap:

```
for(int i=0;i<mapIt.rows;i++)
  for(int j=0;j<mapIt.cols;j++){
    mapIt.at<Vec2f>(i, j)[0] = j;
    mapIt.at<Vec2f>(i, j)[1] = i;
}

```

(Maybe can be built much more efficient?)
