我尝试使用python3中OpenCV4库中的FastLineDetector来检测图像中的直线和线段,但似乎没有办法使其工作。我已经阅读了这里的文档:https://docs.opencv.org/3.4/df/d4c/classcv_1_1ximgproc_1_1FastLineDetector.html对我来说仍然没有什么是清楚的。 我已经安装了opencv4.1.0,并在ubuntu18.0.4中运行python3.6。在
以下是我分别尝试过的代码:
img = cv2.imread('/tmp/output0.png', cv2.CV_8UC1)
fld = cv2.ximgproc_FastLineDetector.detect(img)
^{pr2}$
以下是输出错误:
fld = cv2.ximgproc_FastLineDetector.detect(img)
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: descriptor 'detect' requires a 'cv2.ximgproc_FastLineDetector' object but received a 'numpy.ndarray'
fld = cv2.ximgproc_FastLineDetector.detect(cv2.ximgproc_FastLineDetector(img))
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: Incorrect type of self (must be 'ximgproc_FastLineDetector' or its derivative)
有人知道如何使用FastLineDetector或有一个例子吗?在
顺便问一下,和cv.ximgproc.createFastLineDetector() ? 在
给你
相关问题 更多 >
编程相关推荐