warpAffine generates an incorrect picture when using ROI sub-array. (Bug #3187)


Added by Alexander Kalinovsky over 11 years ago. Updated about 11 years ago.


Status:Done Start date:2013-08-02
Priority:Normal Due date:
Assignee:Ilya Lavrenov % Done:

0%

Category:imgproc, video
Target version:2.4.8
Affected version:2.4.0 - 2.4.6 Operating System:Any
Difficulty:Medium HW Platform:Any
Pull request:

Description

how to reproduce the bug:
1. load(or create) image bigImg with size ~(1100x1100)
2. get transform matrix: mrot = getRotationMatrix2D(..);
3. define subimage with small size (~500x500): Mat cropImg = bigImg(Rect(5000,5000,300,300))
4. apply a function warpAffine to the image cropImg with default
interpolation parapeter (INTER_LINEAR) : warpAffine(imgCrop, imgCropRot, mrot, Size(500,500));

generated image imgCropRot will be incorrect in the following cases:
  • size of the image bigImg more than ~[11000x11000]. When the resolution is [10000,10000] or less,
    then error will not occur.
  • src-image cropImg for function warpAffine is sub-image of bigImage. If cropImg is copy of some
    area of the image bigImage (e.g. cropImg is defined as: bigImg(Rect(5000,5000,300,300)).copyTo(cropImg)),
    then error will not occur.
  • interpolation parameter in warpAffine() is INTER_LINEAR (or INTER_AREA as follows from
    code function warpAffine /imgproc.cpp)

Bug is verified on the windows7(x32) and Ubuntu-Linux 12.04 (x64) and OpenCV
version 2.4.5 and latest-release 2.4.6.1.

I attached a small project with the code and a screenshot confirming the bug with incorrect images.


test_ocv_affine_transform.tgz - small project with code-bug (464.7 kB) Alexander Kalinovsky, 2013-08-02 12:27 pm

opencv_warp_affine_bug_0.png - incorrect image processed in Linux (408.8 kB) Alexander Kalinovsky, 2013-08-02 12:27 pm

opencv_warp_affine_bug_1.png - incorrect image processed in Windows (356.9 kB) Alexander Kalinovsky, 2013-08-02 12:27 pm


Associated revisions

Revision 97ab91dc
Added by Alexander Alekhin over 10 years ago

Merge pull request #3187 from akarsakov:ocl_disabled_minmaxidx

History

Updated by Victor Kocheganov over 11 years ago

Hello Alexander,

thank you for reporting the issue!

Do you think you are able to handle this issue by yourself? If so, it would be great and much appreciated by the community!
Please see http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute for details.

Thank you in advance,
Victor Kocheganov

  • Status changed from New to Open
  • Target version set to 2.4.7

Updated by Alexander Smorkalov over 11 years ago

  • Target version changed from 2.4.7 to 2.4.8
  • Affected version changed from 2.4.6 (latest release) to 2.4.0 - 2.4.6

Updated by Ilya Lavrenov about 11 years ago

  • Assignee changed from Vadim Pisarevsky to Ilya Lavrenov
  • Status changed from Open to Done
  • Difficulty set to Medium

Also available in: Atom PDF