Ask Your Question

Revision history [back]

Loading the SED model in xcode

Hi everybody,

I installed the package opencv2-contrib through cocoa pods in xcode, in order to use the structured edge detection algorithm rather than the canny edge detection.

A corresponding trained model is available at and I have been trying to use it inside my Xcode project, but I can't get rid of this error : "OpenCV Error: Assertion failed (modelFile.isOpened()) in StructuredEdgeDetectionImpl, file /Users/Benjamin/Desktop/opencv/opencv_contrib/modules/ximgproc/src/structured_edge_detection.cpp, line 354"...

Here is the code I try to load the model with :

const cv::String modelFile="./model.yml";
cv::resize(image, rimage, dim, CV_INTER_AREA);
cv::Mat rimageFloat;
rimage.convertTo(rimageFloat, cv::DataType<float>::type, 1 / 255.0);
cv::Mat edges(rimageFloat.size(),rimageFloat.type());
cv::Ptr<cv::ximgproc::StructuredEdgeDetection> pDollar = cv::ximgproc::createStructuredEdgeDetection(modelFile);
pDollar->detectEdges(rimageFloat, edges);

I also tried to use the compressed version .gz but this time I end up with another error : "libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/Benjamin/Desktop/opencv/opencv/modules/core/src/persistence.cpp:4208: error: (-213) There is no compressed file storage support in this configuration in function cvOpenFileStorage"

I'm still new and it could be something with the frameworks installation (actually I don't even know how to access the specified files that seem to be on Benjamin's desktop - who is this ?).

If anyone here already came to a solution concerning the loading of a model for the SED detector, could he please give me a sign ? Thanks !