Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Loading the SED model in android

Hi everyone ,

I used this code to implement an Structured Edge Detection model in android but I ran to an error.

Code Snippet :

private Bitmap StructuredDetectEdges (Bitmap bitmap){
    Mat rgba = new Mat();
    Utils.bitmapToMat(bitmap,rgba);
    Mat edges = new Mat(rgba.size(), CvType.CV_8UC1);
    Imgproc.cvtColor(rgba,edges,Imgproc.COLOR_RGB2GRAY,4);
    StructuredEdgeDetection pDollar = createStructuredEdgeDetection("file:///android_asset/SEDmodel.yml");
    pDollar.detectEdges(edges,edges);
    Bitmap resultBitmap = Bitmap.createBitmap(edges.cols(), edges.rows(), Bitmap.Config.ARGB_8888);
    Utils.matToBitmap(edges, resultBitmap);
    return resultBitmap; }

Error that I got :

E/cv::error(): OpenCV(3.4.0-dev) Error: Assertion failed (modelFile.isOpened()) in cv::ximgproc::StructuredEdgeDetectionImpl::StructuredEdgeDetectionImpl(const cv::String&, cv::Ptr<const cv::ximgproc::rffeaturegetter="">), file /Users/Chao/opencv_contrib/modules/ximgproc/src/structured_edge_detection.cpp, line 432

Any help on how can I solve this problem is much appreciated.