1

I am experimenting with the mexopencv project that allows using the OpenCV library from MATLAB .m files in order to compare the performance of the native MATLAB functions with the OpenCV functions

I would like to substitute a call to the MATLAB interp2 function:

Vq = interp2(X,Y,V,Xq,Yq) returns interpolated values of a function of two variables at specific query points using linear interpolation. The results always pass through the original sampling of the function. X and Y contain the coordinates of the sample points. V contains the corresponding function values at each sample point. Xq and Yq contain the coordinates of the query points.

The substitute shall be a call to the cv.remap function.

Applies a generic geometrical transformation to an image

dst = cv.remap(src, map1, map2)
dst = cv.remap(src, map1)
dst = cv.remap(..., 'OptionName',optionValue, ...)

The three SO questions Similar OpenCV Api for interp2 in Matlab, How to do grid interpolation interp2 in OpenCV and cv::remap (in opencv) and interp2 (matlab) state that the OpenCV function remap can be used instead of the native MATLAB function interp2, but I have no idea how-to correctly interpret/transform the arguments (I have no experience regarding MATLAB and computer vision).

How can I use the mexopencv function cv.remap to get the same effect as if one would call Vq = interp2(X,Y,V,Xq,Yq)?

Community
  • 1
  • 1
Florian Wolters
  • 3,820
  • 5
  • 35
  • 55
  • Hum, I think the docs are quite clear, what do you have problem with? – Ander Biguri Apr 24 '17 at 11:58
  • I understand that `V` (`interp2`) is `src` (`cv.remap`) and `Vq` is `dst`, but I do not understand how `X`, `Y`, `Xq` and `Yq` should be mapped to `map1` and `map2`. – Florian Wolters Apr 24 '17 at 12:17
  • I believe that `(x,y)` is`map1` and `(xq,yq)` is `map2` – Ander Biguri Apr 24 '17 at 12:32
  • Sadly it seems not that simple (or can you provide me with a working example?)... I do not understand the concept of OpenCV maps. I am afraid I have to dig deeper and get a better understanding, e.g. maybe additional conversions are required. I had the hope that the conversion from MATLAB to OpenCV would be easier... – Florian Wolters Apr 24 '17 at 12:46

0 Answers0