Closed mminervini closed 2 years ago
C++ DisparityBilateralFilter
is inherited from cv::Algorithm
and is created by factory method cv::cuda::createDisparityBilateralFilter
. For Python case you need to call the same factory to create properly initialized object with call cv.cuda.createDisparityBilateralFilter
.
The working code:
import numpy as np
import cv2
np_disparity = np.random.randint(0, 64, (128, 128), dtype=np.int16)
np_image = np.random.randint(0, 255, (128, 128, 3), dtype=np.uint8)
cu_disparity = cv2.cuda_GpuMat(np_disparity)
cu_image = cv2.cuda_GpuMat(np_image)
disparity_bilateral_filter = cv2.cuda.createDisparityBilateralFilter()
cu_filtered_disparity = disparity_bilateral_filter.apply(cu_disparity, cu_image)
Thank you for clarifying.
I found the cv2.cuda_DisparityBilateralFilter
class and didn't realize I had to create an instance through a factory function rather than using the class constructor itself.
System information
Tried on:
And also:
Detailed description
In Python, using member function
apply()
ofcv2.cuda_DisparityBilateralFilter
causes segmentation fault. On the same systems, using in C++cuda::createDisparityBilateralFilter()
andapply()
works as expected.Steps to reproduce
Issue submission checklist