warpAffine generates an incorrect picture when using ROI sub-array. (Bug #3187)
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))
;
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 functionwarpAffine
is sub-image ofbigImage
. IfcropImg
is copy of some
area of the imagebigImage
(e.g.cropImg
is defined as:bigImg(Rect(5000,5000,300,300)).copyTo(cropImg)
),
then error will not occur. - interpolation parameter in
warpAffine()
isINTER_LINEAR
(orINTER_AREA
as follows from
code functionwarpAffine
/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.
Associated revisions
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
the problem is fixed in PR https://github.com/Itseez/opencv/pull/2087
- Assignee changed from Vadim Pisarevsky to Ilya Lavrenov
- Status changed from Open to Done
- Difficulty set to Medium