class cuda_SURF_CUDA(builtins.object)
| Methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| __repr__(self, /)
| Return repr(self).
|
| defaultNorm(...)
| defaultNorm() -> retval
| .
|
| descriptorSize(...)
| descriptorSize() -> retval
| .
|
| detect(...)
| detect(img, mask[, keypoints]) -> keypoints
| . @brief Finds the keypoints using fast hessian detector used in SURF
| .
| . @param img Source image, currently supports only CV_8UC1 images.
| . @param mask A mask image same size as src and of type CV_8UC1.
| . @param keypoints Detected keypoints.
|
| detectWithDescriptors(...)
| detectWithDescriptors(img, mask[, keypoints[, descriptors[, useProvidedKeypoints]]]) -> keypoints, descriptors
| . @brief Finds the keypoints and computes their descriptors using fast hessian detector used in SURF
| .
| . @param img Source image, currently supports only CV_8UC1 images.
| . @param mask A mask image same size as src and of type CV_8UC1.
| . @param keypoints Detected keypoints.
| . @param descriptors Keypoint descriptors.
| . @param useProvidedKeypoints Compute descriptors for the user-provided keypoints and recompute keypoints direction.
|
| downloadKeypoints(...)
| downloadKeypoints(keypointsGPU) -> keypoints
| .
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| create(...)
| create(_hessianThreshold[, _nOctaves[, _nOctaveLayers[, _extended[, _keypointsRatio[, _upright]]]]]) -> retval
| . @param _hessianThreshold Threshold for hessian keypoint detector used in SURF.
| . @param _nOctaves Number of pyramid octaves the keypoint detector will use.
| . @param _nOctaveLayers Number of octave layers within each octave.
| . @param _extended Extended descriptor flag (true - use extended 128-element descriptors; false - use
| . 64-element descriptors).
| . @param _keypointsRatio
| . @param _upright Up-right or rotated features flag (true - do not compute orientation of features;
| . false - compute orientation).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| extended
| extended
|
| hessianThreshold
| hessianThreshold
|
| keypointsRatio
| keypointsRatio
|
| nOctaveLayers
| nOctaveLayers
|
| nOctaves
| nOctaves
|
| upright
| upright
Maybe I don’t create my GpuMat correctly. Because I followed the first link and I get this error :
kpGPU, des = surf.detectWithDescriptors(gpu_frame, gpu_mask)
cv2.error: OpenCV(4.4.0) C:\opencv-4.4.0\opencv_contrib-4.4.0\modules\xfeatures2d\src\surf.cuda.cpp:146: error: (-215:Assertion failed) !img.empty() && img.type() == CV_8UC1 in function '`anonymous-namespace'::SURF_CUDA_Invoker::SURF_CUDA_Invoker'
I declare my mask like so :
mask = np.zeros(frame.shape[:2], dtype=np.uint8)
# (these 4 lines create ROIs mask on a image taken as reference)
save = np.zeros(frame.shape[:2], dtype=np.uint8)
points = np.array([list(r.topleft), list(r.topright), list(r.bottomright), list(r.bottomleft)], np.int32)
cv.fillPoly(mask, [points], (255, 255, 255))
cv.bitwise_and(frame, frame, masked, mask)
gpu_mask = cv.cuda_GpuMat(mask)
gpu_frame = cv.cuda_GpuMat(frame)
kpGPU, des = surf.detectWithDescriptors(gpu_frame, gpu_mask)
[EDIT] For those who have the same error with detectWithDescriptors, the image needs to be converted into grayscale