【发布时间】:2019-02-28 14:47:46
【问题描述】:
当我在 Python 中调用 OpenCV Structured Forests Edge Detection 时,如下所示,我得到一个错误:
import numpy as np
import cv2
img = cv2.imread('2009_005193.jpg')
gray_img = np.asarray(img.mean(axis=2) / 255, np.float32)
out = cv2.ximgproc_StructuredEdgeDetection.detectEdges(gray_img)
我得到的错误是:
Traceback (most recent call last):
File "gop1.py", line 19, in <module>
out = cv2.ximgproc_StructuredEdgeDetection.detectEdges(gray_img)
TypeError: descriptor 'detectEdges' requires a 'cv2.ximgproc_StructuredEdgeDetection' object but received a 'numpy.ndarray'
在文档 (link to documentation) 中,它作为函数 detectEdges() 存在于 ximgproc_StructuredEdgeDetection 下。
【问题讨论】:
标签: python opencv edge-detection