使用原始BSDS模型无法检测边缘

问题描述 投票:0回答:1

我无法使用结构化森林训练的原始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。但是,当我使用转换后的模型运行边缘检测时,我得到:

enter image description here

当输入图像是:

enter image description 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
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.