Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
179 views
in Technique[技术] by (71.8m points)

android - 什么是API 19中的Opencv找不到本机方法错误?(What is Native method not found bug with Opencv in api 19?)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...