About SHRT_MAX in function 'cv::remap'

Dear All,

   When I run the python program with the cv2.wrapPerspective function, the following error occurs :  

 File "<ipython-input-1-3f9916624c9a>", line 1, in <module>
    runfile('C:/Users/Hui Tik Ho/ChanZhan/Multimodal MR Image Analysis/Veterinary/veterinary_registration.py', wdir='C:/Users/Hui Tik Ho/ChanZhan/Multimodal MR Image Analysis/Veterinary')

  File "C:\Users\Public\Anaconda\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\Public\Anaconda\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Hui Tik Ho/ChanZhan/Multimodal MR Image Analysis/Veterinary/veterinary_registration.py", line 107, in <module>
    affined_l_mask = cv2.warpPerspective(l_mask[:, :], H, (r_img.shape[1], r_img.shape[0]))

error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-52oirelq\opencv\modules\imgproc\src\imgwarp.cpp:1724: error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX in function 'cv::remap'

How can we solve the above problem ???

remapping uses (short) integer arithmetics for performance reasons,

so your image cannot be larger than 0x7fff

Thanks ! And may I ask can the parameter SHRT_MAX be changed in the case. I am using Python under Anaconda environment ???

no, you can’t change it (also remember, it’s a c++ library, not python)

you have to use smaller images, that’s it.