I have implemented openCv in my android project, project runs on device with api 23 , correctly.
(我已经在我的android项目中实现了openCv ,项目在api 23的设备上正确运行。)
But just this project crashed on device with api 19 .
(但是只有这个项目在使用api 19的设备上崩溃了。)
caused by: (由:)
java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.core.Mat.n_Mat:()J
(java.lang.UnsatisfiedLinkError:找不到本机方法:org.opencv.core.Mat.n_Mat :()J)
so the question is, api 19 cant support openCV?
(所以问题是, api 19无法支持openCV?)
or api 19 have a different config for openCV? (或api 19对于openCV有不同的配置?)
this is main part of my project:
(这是我的项目的主要部分:)
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
OpenCVLoader.initDebug();
}
public void medianFilter(View view) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false; // Leaving it to true enlarges the decoded image size.
Bitmap original = BitmapFactory.decodeResource(getResources(), R.drawable.test, options);
Mat img1 = new Mat();
Utils.bitmapToMat(original, img1);
Mat medianFilter = new Mat();
Imgproc.cvtColor(img1, medianFilter, Imgproc.COLOR_RGB2RGBA);
Imgproc.median(medianFilter, medianFilter, 9);
Bitmap imgBitmap = Bitmap.createBitmap(medianFilter.cols(), medianFilter.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(medianFilter, imgBitmap);
ImageView imageView = findViewById(R.id.opencvImg);
imageView.setImageBitmap(imgBitmap);
}}
ask by SadeQ digitALLife translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…