我的代码在这行代码中出现错误:
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
这是错误:
java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.features2d.DescriptorMatcher.create_1(int) (tried Java_org_opencv_features2d_DescriptorMatcher_create_11 and Java_org_opencv_features2d_DescriptorMatcher_create_11__I)
at org.opencv.features2d.DescriptorMatcher.create_1(Native Method)
如果有人需要在这里看到我的来源,那就是:
package com.example.qwill.opencvtests;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.audiofx.AudioEffect;
import android.os.Environment;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Core;
import org.opencv.core.KeyPoint;
import org.opencv.core.Mat;
import org.opencv.core.MatOfDMatch;
import org.opencv.core.MatOfKeyPoint;
import org.opencv.features2d.*;
import org.opencv.features2d.Feature2D;
import org.opencv.features2d.FeatureDetector;
import org.opencv.highgui.Highgui;
import org.opencv.photo.Photo;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.utils.Converters;
import org.opencv.android.Utils;
import org.opencv.features2d.FlannBasedMatcher;
import org.opencv.features2d.DescriptorExtractor;
import org.opencv.features2d.DescriptorMatcher;
import org.opencv.features2d.FeatureDetector;
import org.opencv.features2d.Features2d;
import java.io.File;
import java.util.Vector;
public class MainActivity extends AppCompatActivity {
BFMatcher descriptorMatcher;
FeatureDetector test;
FeatureDetector detector;
DescriptorExtractor descriptor;
DescriptorMatcher matcher;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
Log.d("TEST", "OpenCV loaded successfully");
test = FeatureDetector.create(FeatureDetector.FAST); //feature detector goes here!
MatOfKeyPoint one = new MatOfKeyPoint();
MatOfKeyPoint two = new MatOfKeyPoint();
MatOfKeyPoint done = new MatOfKeyPoint();
MatOfKeyPoint dtwo = new MatOfKeyPoint();
Mat image1, image2;
image1 = Highgui.imread(ResourcesCompat.getDrawable(getResources(), R.drawable.one, null).toString());
image2 = Highgui.imread(ResourcesCompat.getDrawable(getResources(), R.drawable.two, null).toString());
Mat imageOut = image1.clone();
test.detect(image1, one);
test.detect(image2, two);
DescriptorExtractor extractor = DescriptorExtractor.create(2);
Mat descriptors1;
extractor.compute(image1, one, done);
extractor.compute(image2, two, dtwo);
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
MatOfDMatch matches = new MatOfDMatch();
matcher.match(image1, image2, matches);
Features2d.drawMatches(image1, one, image2, two, matches, imageOut);
Bitmap bm = Bitmap.createBitmap(imageOut.cols(), imageOut.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(imageOut, bm);
Log.d("TEST", " worked !!!! " );
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d("TEST", "here");
}
@Override
public void onResume()
{
super.onResume();
if (!OpenCVLoader.initDebug()) {
Log.d("OpenCV", "Internal OpenCV library not found. Using OpenCV Manager for initialization");
OpenCVLoader.initAsync("3.2.0", this, mLoaderCallback);
} else {
Log.d("TEST", "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
}
我的帖子和其他帖子之间的区别在于我没有用其他帖子解决我的问题!