-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Open
Labels
Description
System information (version)
- OpenCV => 3.4
- Operating System / Platform => Ubuntu 17.10
- Compiler => gcc 7
Detailed description
I'm unable to detect edges using structured forest training's original BSDS model (https://github.com/pdollar/edges/blob/master/models/forest/modelBsds.mat). When I try loading the model and running edge detection, I get this:
for the input image:
modelBsds.mat works fine within Matlab, but after converting to .yaml, detection fails. I believe something might be wrong with the mat-to-yaml conversion script.
Steps to reproduce
(Based on https://docs.opencv.org/master/d2/d59/tutorial_ximgproc_training.html#gsc.tab=0)
- Download and load in Matlab (R2017b) https://github.com/pdollar/edges/blob/master/models/forest/modelBsds.mat
- Download https://github.com/opencv/opencv_contrib/blob/master/modules/ximgproc/tutorials/scripts/modelConvert.m
- Convert trained model from Matlab binary format to YAML by running
modelConvert(model, "model.yml")in Matlab - Run
import cv2
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)
gds101054108

