Im trying to use these code
import cv2 as cv
import numpy
model = cv.cuda.CascadeClassifier('E:\\PROJECT\\haarcascades\haarcascade_frontalface_default.xml')
gpu_frame = cv.cuda_GpuMat()
screenshot = cv.imread('htw.jpg')
gpu_frame.upload(screenshot)
screenshot = cv.cuda.cvtColor(gpu_frame, cv.COLOR_RGB2BGR)
screenshot = cv.cuda.cvtColor(screenshot, cv.COLOR_BGR2GRAY)
objs = model.detectMultiScale(screenshot, 1.2, 5)
for (x, y, w, h) in objs:
cv.rectangle(screenshot, (x, y), (x+w, y+h), (225,0,0), 2)
img = screenshot.download()
cv.imshow('img', img)
cv.waitKey(0)
cv.destroyAllWindows()
And it gives out error
cv2.error: OpenCV(4.7.0-dev) :-1: error: (-5:Bad argument) in function 'detectMultiScale'
> Overload resolution failed:
> - image is not a numpy array, neither a scalar
> - Expected Ptr<cv::cuda::GpuMat> for argument 'objects'
> - Expected Ptr<cv::UMat> for argument 'image'
need your help, thanks a lot!