执行时OpenCV SURF错误

时间:2016-01-31 06:35:50

标签: android opencv

我的Android应用程序中存在SURF检测器问题。我使用非免费库没有问题,但在执行时,它给了我这个错误:

OpenCV Error: Bad argument (Specified descriptor extractor type is not supported.) in static cv::javaDescriptorExtractor* cv::javaDescriptorExtractor::create(int), file /builds/master_pack-android/opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp, line 374

E/org.opencv.features2d: features2d::create_10() caught cv::Exception: /builds/master_pack-android/opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp:374: error: (-5) Specified descriptor extractor type is not supported. in function static cv::javaDescriptorExtractor* cv::javaDescriptorExtractor::create(int)

我的代码是:

public class FindKeypoint extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_find_keypoint);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        Intent data = getIntent();
        ImageView image = (ImageView) findViewById(R.id.image_keypoint);
        final Button keypoint = (Button) findViewById(R.id.keypoint);
        Uri img = data.getData();
        InputStream image_stream = null;
        try {
            image_stream = getContentResolver().openInputStream(img);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        final Bitmap image_receveire = BitmapFactory.decodeStream(image_stream);
        image.setImageBitmap(image_receveire);

        keypoint.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(FindKeypoint.this,"Cerco i keypoint",Toast.LENGTH_SHORT).show();
                Bitmap image_keypoint = keypointSURF(image_receveire);
            }
        });
    }

    private Bitmap keypointSURF(Bitmap input_image) {
        Bitmap output_image = null;
        Mat inputMat_image = new Mat();
        Mat outputMat_image = new Mat();
        DescriptorExtractor SURF_descriptor = DescriptorExtractor.create(DescriptorExtractor.SURF);
        FeatureDetector SURF_detector = FeatureDetector.create(FeatureDetector.SURF);
        Utils.bitmapToMat(input_image,inputMat_image);

        return output_image;
    }
}

这是我的第二个活动,我从第一个活动发送图像,它可以工作,但是当我点击按钮时,它给了我错误。

我该如何解决?

0 个答案:

没有答案