Android OpenCV using MatOfKeyPoint and feature2d features

I am having problems using the OpenCV Java library, the following code crashes:

MatOfKeyPoint keypoints = new MatOfKeyPoint(); this.myFeatures.detect(inputImage, keypoints); 

I thought the key points were this mutable object, which I pass to the detect function and get back. For instance. later I would like to do:

 Features2d.drawKeypoints(inputImage, keypoints, outputImage); 

What am I doing wrong here? Thanks.

+6
source share
1 answer

The problem is resolved - you do not need to convert the color types, but the SURF algorithm is not available, at least in the library that I have. Here's the working code:

 myFeatures = FeatureDetector.create(FeatureDetector.FAST); rgb = new Mat(); outputImage = new Mat(); keypoints = new MatOfKeyPoint(); Imgproc.cvtColor(inputImage, rgb, Imgproc.COLOR_RGBA2RGB); myFeatures.detect(rgb, keypoints); Features2d.drawKeypoints(rgb, keypoints, rgb); Imgproc.cvtColor(rgb, outputImage, Imgproc.COLOR_RGB2RGBA); 

I would like them to return an error better than fatal signal 11 ...

+9
source

Source: https://habr.com/ru/post/943498/


All Articles