Simple question on cv::remap()

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?

OK, got it.

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?)