'm working on a feature extraction/matching app using opencv on android using android studio .. I followed these steps for using native code in order to use SIFT or SURF algorithms.. I have copied the folders (armeabi, armeabi-v7a, ...etc) to the jniLibs folder and here is my code for the main methods
public class MainActivity extends Activity implements CvCameraViewListener2{
private Mat mRgba;
private Mat mGrayMat;
private CameraBridgeViewBase mOpenCvCameraView;
Mat descriptors ;
List<Mat> descriptorsList;
FeatureDetector featureDetector;
MatOfKeyPoint keyPoints;
DescriptorExtractor descriptorExtractor;
DescriptorMatcher descriptorMatcher;
boolean mIsJavaCamera = true;
static {System.loadLibrary("opencv_java");}
////////////////////////////////////////////////////////////////
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
//Log.i(TAG, "OpenCV loaded successfully");
mOpenCvCameraView.enableView();
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
@Override
public void onCameraViewStarted(int width, int height) {
mRgba = new Mat();
mGrayMat = new Mat();
featureDetector=FeatureDetector.create(FeatureDetector.SIFT);
descriptorExtractor=DescriptorExtractor.create(DescriptorExtractor.SURF);
descriptorMatcher=DescriptorMatcher.create(6);
keyPoints = new MatOfKeyPoint();
descriptors = new Mat();
}
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
final Mat rgba = inputFrame.rgba();
Imgproc.cvtColor(rgba, rgba, Imgproc.COLOR_RGBA2GRAY);
featureDetector.detect(rgba, keyPoints);
Features2d.drawKeypoints(rgba, keyPoints, rgba);
return rgba;
}
when I compile and run the app it runs for less than one second then crashes. However, for the exact sam code above when I replace SIFT or SURF with ORB, STAR the app works perfectly. How can I make sure that the SIFT/SURF are compiled correctly? Where can I find the code of them? what are your recommendations ?? (I'm using Android studio 1.1 NOT Eclipse).
thanks in advance.