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'
Asked
Active
Viewed 650 times
2

Christoph Rackwitz
- 11,317
- 4
- 27
- 36

bbbeenn32
- 89
- 6
-
question requires a [mre]. -- original code is faulty already. `remap()` __can't__ take such flags in principle. it uses lookup tables. those are _not_ invertible trivially. – Christoph Rackwitz Sep 15 '22 at 00:06
1 Answers
0
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.

dinarkino
- 167
- 1
- 9
-
1"seems like not supported"? `WARP_INVERSE_MAP` is very much supported... **but not by remap()** because that's using big lookup tables, which aren't trivially invertible. **the original code was wrong already**. why answer such an old question now? why answer in such a vague/confusing way? – Christoph Rackwitz Sep 15 '22 at 00:03
-
Yes, I'm wrong. I faced the same error while working with cv2.warpAffine() function. Now, I tried to do reproducible example and I have the same remap error for cv2.INTER_LINEAR_EXACT, cv2.INTER_NEAREST_EXACT, cv2.INTER_MAX. But it works for cv2.WARP_FILL_OUTLIERS and cv.WARP_INVERSE_MAP. I could delete my answer and create a new question about cv2.warpAffine(). But the behavior of opencv is the same, even though I don't use remap() directly. – dinarkino Nov 24 '22 at 07:46