Skip to content

WarpAffine unexpected results using OpenCl #25853

@JuanDYB

Description

@JuanDYB

System Information

I'm using UMat type frames to make use of my Intel UHD Graphics 620 and I have discovered a bug in WarpAffine function returning unexpected results.

I have opened a blog post on forum for more information.

OpenCV python version: 4.10.0
Operating System / Platform: Windows 10
Python version: 3.12.2

Detailed description

As you can see in my following code I'm using same UMat for input and output.
I have tried using new UMatfor output and seems it works.

Note: I have discovered the bug using EmguCv because I'm working on C#. But to be sure I have tested the issue in Python to reproduce it directly on OpenCv.

Steps to reproduce

Here is an example Python code to test.

import os
os.add_dll_directory("C:\\gstreamer\\1.0\\msvc_x86_64\\bin")
 
import cv2 as cv
 
print(cv.getBuildInformation())
 
img_srcFile = "C:\\Users\\usr\\Downloads\\demo.jpg"
 
srcMat = cv.imread(img_srcFile, cv.IMREAD_UNCHANGED)
srcUMat = cv.UMat(cv.imread(img_srcFile, cv.IMREAD_UNCHANGED))
 
cv.imshow("SrcMat", srcMat)
cv.imshow("SrcUMat", srcUMat)
 
height, width = srcMat.shape[:2]
 
point = ((width - 1 )/ 2, (height - 1 )/ 2)
matrixTransfrom = cv.getRotationMatrix2D(point, 0, 1.3)
 
cv.warpAffine(srcMat, matrixTransfrom, (width, height), srcMat)
cv.imshow("SrcMat -> Zoom", srcMat)
 
cv.warpAffine(srcUMat, matrixTransfrom, (width, height), srcUMat)
cv.imshow("SrcUMat -> Zoom", srcUMat)
 
cv.waitKey(0)

imagen

I have fixed temporally using different UMat for output.

dstImg = cv.warpAffine(srcUMat, matrixTransfrom, (width, height))
cv.imshow("SrcUMat -> Zoom", dstImg)

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions