【发布时间】:2018-04-10 20:39:45
【问题描述】:
我正在尝试将 SED 从 OpenCV 实现到 android,但我遇到了错误。所以这是我正在使用的代码,它需要一个模型文件(经过训练的模型来检测边缘),它位于资产文件夹中:
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: 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
非常感谢任何帮助
【问题讨论】:
标签: android opencv edge-detection