【发布时间】:2018-03-05 13:18:14
【问题描述】:
我无法使用结构化森林训练的原始 BSDS 模型 (https://github.com/pdollar/edges/blob/master/models/forest/modelBsds.mat) 检测边缘。要将.mat 转换为.yml,我使用此脚本https://github.com/opencv/opencv_contrib/blob/master/modules/ximgproc/tutorials/scripts/modelConvert.m 和命令modelConvert(model, "model.yml"),建议here。但是,当我使用转换后的模型运行边缘检测时,我得到了这个:
当输入图像是:
也就是说,this model 可以工作。任何人都知道为什么原来的.mat 模型不起作用?这是我的代码:
img = cv2.imread('./kermit.jpg')
edgedetector = cv2.ximgproc.createStructuredEdgeDetection('./model.yml')
src = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
edges = edgedetector.detectEdges(np.float32(src) / 255.0)
cv2.imshow("edges", edges)
任何想法表示赞赏。
【问题讨论】:
标签: opencv