bbbeenn32
bbbeenn32

Reputation: 87

Unknown interpolation method in function 'remap' error

Trying to update old Python code from

cv.Remap(src,dst,map1,map2,interpolation)

to

remapped_image = cv2.remap(src,map1,map2,interpolation).

The issue is the interpolation option. The original interpolation was cv.INTER_LINEAR+cv.WARP_FILL_OUTLIERS+cv.WARP_INVERSE_MAP, however, when I use that interpolation code changing all the cv to cv2, I receive a (-5 Bad argument) Unknown Interpolation method in function 'remap'

Upvotes: 1

Views: 1034

Answers (2)

Rosa Gronchi
Rosa Gronchi

Reputation: 1911

WARP_INVERSE_MAP is a flag used in cv::warpPolar which is the function used by cv::linearPolar and cv::logPolar.

cv::warpPolar calls cv::remap, but the inverse mapping is implemented in cv::warpPolar and is not supported by cv::remap (both python and C++ versions).

You can implement the inverse mapping yourself (take a look at the source code of cv::warpPolar for reference)

Upvotes: 0

dinarkino
dinarkino

Reputation: 394

The reason for the error is a cv.WARP_INVERSE_MAP flag, which seems like not supported in opencv (at least in python version). The same error appears for cv2.INTER_LINEAR_EXACT, cv2.INTER_NEAREST_EXACT, cv2.INTER_MAX, cv2.WARP_FILL_OUTLIERS. Even though there is documentation for such flags. I checked my version of cv2 as well as installed opencv_contrib and there is still an error. It seems that these flags are not supported even in source code.

Upvotes: -1

Related Questions