cv2.warpAffine for large images (Bug #3871)


Added by Jirka Borovec over 10 years ago. Updated over 9 years ago.


Status:New Start date:2014-08-18
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:python bindings
Target version:2.4.10
Affected version:2.4.9 (latest release) Operating System:Linux
Difficulty: HW Platform:x64
Pull request:

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.


case04-2-psap.jpg - original image (709.8 kB) Jirka Borovec, 2014-08-18 01:26 pm

case04-2-psap_warp-affine.jpg - wrapped image (672.9 kB) Jirka Borovec, 2014-08-18 01:26 pm


Associated revisions

Revision 10e0540e
Added by Vadim Pisarevsky almost 10 years ago

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

Also available in: Atom PDF