我是Android中OpenCV实现的新手。我使用以下代码来查找轮廓。
private void detectEdges(Bitmap bitmap) {
rgba = new Mat();
gray = new Mat();
hierarchy = new Mat();
Utils.bitmapToMat(bitmap, rgba);
Imgproc.cvtColor(rgba, gray, Imgproc.COLOR_RGBA2GRAY);
Imgproc.Canny(gray, gray, 50, 200);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
// find contours:
Imgproc.findContours(rgba, contours, hierarchy, Imgproc.RETR_TREE,Imgproc.CHAIN_APPROX_SIMPLE);
for (int contourIdx = 0; contourIdx < contours.size(); contourIdx++) {
Imgproc.drawContours(rgba, contours, contourIdx, new Scalar(0, 0, 255), -1);
}
Bitmap tempBmp1 = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),
bitmap.getConfig());
Utils.matToBitmap(gray, tempBmp1);
ivw.setImageBitmap(tempBmp1);
}
但是应用程序因错误而崩溃&#34; java.lang.UnsatisfiedLinkError:找不到长期org.opencv.core.Mat.n_Mat()的实现(尝试过Java_org_opencv_core_Mat_n_1Mat和Java_org_opencv_core_Mat_n_1Mat __)&#34;
即使我尝试将opencv添加为异步任务:
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
Log.i("OpenCV", "OpenCV loaded successfully");
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
但它说我必须安装OpenCV管理器,我该怎么办? 任何帮助将不胜感激!