不能将 OpenCV GeneralizedHoughTransform class 与 Python 一起使用

Can't use OpenCV GeneralizedHoughTransform class with Python

我正在尝试使用 OpenCV 4.0.0 和 Python 3.6 编写一个使用 GeneralizedHoughBallard class 的基本示例。我在这里 https://github.com/opencv/opencv/blob/4.0.0/samples/gpu/generalized_hough.cpp 找到了 C++ 的示例,但 Python.

没有

当我尝试创建 GeneralizedHoughBallard 的新实例时 class:

import cv2
alg = cv2.createGeneralizedHoughBallard()

我收到错误:"AttributeError: module 'cv2.cv2' has no attribute 'createGeneralizedHoughBallard"。

我在 OpenCV 源代码 (https://github.com/opencv/opencv/blob/4.0.0/modules/imgproc/include/opencv2/imgproc.hpp) 中看到 createGeneralizedHoughBallard 是用 CV_EXPORTS 声明的,所以我想它应该可以与 Python 一起使用。我尝试使用在同一文件 (improc.hpp) 中声明的另一个类似函数,例如:cv2.createCLAHE() 并且工作正常。

可能是什么问题?

显然它只是 GeneralizedHoughBallard

import cv2
print([x for x in dir(cv2) if 'Hough' in x])
print([x for x in dir(cv2) if x.startswith('create')])
['GeneralizedHough',
 'GeneralizedHoughBallard',
 'GeneralizedHoughGuil',
 'HoughCircles',
 'HoughLines',
 'HoughLinesP',
 'HoughLinesPointSet']
['createAffineTransformer',
 'createAlignMTB',
 'createBackgroundSubtractorKNN',
 'createBackgroundSubtractorMOG2',
 'createButton',
 'createCLAHE',
 'createCalibrateDebevec',
 'createCalibrateRobertson',
 'createChiHistogramCostExtractor',
 'createEMDHistogramCostExtractor',
 'createEMDL1HistogramCostExtractor',
 'createHanningWindow',
 'createHausdorffDistanceExtractor',
 'createLineSegmentDetector',
 'createMergeDebevec',
 'createMergeMertens',
 'createMergeRobertson',
 'createNormHistogramCostExtractor',
 'createShapeContextDistanceExtractor',
 'createThinPlateSplineShapeTransformer',
 'createTonemap',
 'createTonemapDrago',
 'createTonemapDurand',
 'createTonemapMantiuk',
 'createTonemapReinhard',
 'createTrackbar']