cv2.warpAffine for large images (Bug #3871)
Description
I am using python wrapper cv2 to OpenCV and I found a problem while I want use Affine transform for large images lets say more then 4.000x4.000 pixels. In this case it returns absolutely non sens image, even hard to describe, so please see attachment. If I scale these images before everything is fine but not for full scale images.
Associated revisions
Merge pull request #3871 from potpath:patch-1
History
Updated by Jirka Borovec over 10 years ago
one small mistake, the refered image size was over 20kx20k pixels
Updated by Ryan Wong over 10 years ago
Please see http://code.opencv.org/issues/1337 , and also http://code.opencv.org/issues/3187 , to verify if they are the same issue.
If they are indeed the same issue, currently cv::remap has an architectural limitation that prevents it from processing input images where the "imageStep" (number of bytes per row of pixels) exceeds 32767, when x86/x86-64 SSE2 code is enabled.
I have a proof-of-concept workaround at https://gist.github.com/kinchungwong/141bfa2d996cb5ae8f42 (which is not publicly shared, and cannot be contributed to OpenCV due to copyright issues). The workaround involves creating crops of the original image (which requires a clone (copy), not just an ROI into the input image) and then rendering (calling remap) on tiles of the output. This approach is amendable to multi-threading.
If necessary, I can provide a written description of the approach, see http://answers.opencv.org/question/22079/volunteer-for-fixing-bug-1337-rotate-remap-crash/, so that a programmer can re-implement the approach without dealing with the copyright issues.
The pull-request mentioned at issue #3187 merely rejects input images where the imageStep exceeds 32767 bytes when x86 SSE2 code is enabled.
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4816