How to use the cv::cuda::minMaxLoc function in Python

The code works, but it doesn’t get the right results.

The version of OpenCV I am using is 4.5.

Who can help me?

import cv2
test_img = cv2.imread("./test_squre/toleft.bmp")

maxLoc = (25, 25)
template = cv2.cuda_GpuMat()
template.upload(test_img)
template = cv2.cuda.cvtColor(template, cv2.COLOR_BGR2GRAY)
matchResult = cv2.cuda.normalize(template, dst=None, alpha=0, beta=1, norm_type=cv2.NORM_MINMAX, dtype=-1)
e = cv2.cuda.minMaxLoc(src=matchResult, minVal=None, maxVal=None, minLoc=None, maxLoc=maxLoc )

it looks like you try to match a template, but never call the actual function

The python bindings haven’t been added correctly.

You can fix this by manually adding CV_OUT to the output arguments and re-compiling, see below

1 Like

Much appreciated it works

1 Like

This is now fixed on the master branch.