Hello,
I have installed and tested successfully with a simple clahe the CUDA opencv python package. I am not able to make the cuda_FarnebackOpticalFlow.calc work.
This is my code:
gpu_previous = cv2.cuda_GpuMat()
gpu_previous.upload(im_ref_scale)
gpu_current= cv2.cuda_GpuMat()
gpu_current.upload(im_to_reg_scale)
gpu_flow = cv2.cuda_FarnebackOpticalFlow.create(pyramid_depth, pyr_scale, False,
window_size, iterations, poly_n, poly_sigma, 0)
# calculate optical flow
gpu_flow = cv2.cuda_FarnebackOpticalFlow.calc( gpu_previous, gpu_current, gpu_flow, None )
flow = gpu_flow.download()
I have the following error at execution:
TypeError: descriptor ‘calc’ for ‘cv2.cuda.DenseOpticalFlow’ objects doesn’t apply to a ‘cv2.cuda.GpuMat’ object
From the documentation the first argument is a
virtual void calc (InputArray I0, InputArray I1, InputOutputArray flow, Stream &stream=Stream::Null())=0
Calculates a dense optical flow. More…
InputArray. How can I adapt the cv2.cuda.GpuMat to the expected formal input argument of the calc method?