结构化边缘检测 [英] Structured Edge Detection
本文介绍了结构化边缘检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从OpenCV到Android实施SED,但遇到了错误.因此,这是我正在使用的代码,它需要一个位于资源文件夹中的模型文件(经过训练的模型来检测边缘):
I'm trying to implement SED from OpenCV to android but I'm running into an error. So this is the code I'm using and it requires a model file (trained model to detect edges) which is located in the asset folder :
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
非常感谢您的帮助
推荐答案
我解决了此问题,方法是将模型从资产文件夹复制到手机存储中并从那里读取.
I solved this problem by making a copy of the model from the asset folder to the phone storage and reading it from there.
这篇关于结构化边缘检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文