3

I am trying to implement SURF features in my project which is about face recognition. I am new at opencv on android. So it is a little bit hard to find logical errors. Also i tried to search from google but nothing i could fix. I imported the libray org.opencv.features2d for handling feature issues.

At the beginning this is my SURF implementation code(a part of).

    public void SURFExtraction()
{
    FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
    DescriptorExtractor SurfExtractor = DescriptorExtractor.create(DescriptorExtractor.SURF);

     Mat img1 = Highgui.imread("/mnt/sdcard/FaceDB/1.jpg");//one of my face
     Mat img2 = Highgui.imread("/mnt/sdcard/FaceDB/2.jpg");//one of my different face

    //extract keypoints
    MatOfKeyPoint keypoints = new MatOfKeyPoint();
    MatOfKeyPoint logoKeypoints = new MatOfKeyPoint();

     detector.detect(img1, keypoints);//this is the problem "fatal signal"
     Log.d("LOG!", "number of query Keypoints= " + keypoints.size());
     detector.detect(img2, logoKeypoints);
     Log.d("LOG!", "number of logo Keypoints= " + logoKeypoints.size());


}

When i execute the program it gives a single error. Just this.

  A/libc(30444): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

I searched for this error. They said that this error occurs when native classes try to reach or write 0x00000000 memory address. But i couldn't figure out how to fix this issue. Can you tell me what can i do?

Thanks in advance

COvayurt
  • 827
  • 2
  • 11
  • 36

3 Answers3

4

Ok! SURF features now patented according to this thread. So i think the error about this issue. Who ever trying to extract SURF feature, you can continue with ORB features which at this thread works fine unless matching features. I hope this will help searching for android SURF features extraction.

Community
  • 1
  • 1
COvayurt
  • 827
  • 2
  • 11
  • 36
  • I am open to any useful criticism about this topic. If i am wrong please correct me. – COvayurt Apr 19 '13 at 13:20
  • I have followed tutorial of ORB features given in link you have provided, but problem with me is it is always giving no. of good matches same(equal to 500), i have tried it with different images, then min and max values changes but no of good matches are remained same. also i want to get coordinates of scene in object image, if you know how to do this please help me out – Mehul Thakkar Jan 01 '14 at 07:26
3

SURF is not include in the distribution package of OpenCV Android. To use it, you need to compile the nonfree module and use it in your project. So, what you need to do is to create a NDK project, compile the nonfree module as a standalone library. Then use this library to compile your program. Then you should be able to build your application. You can refer to this tutorial.

Robert Wang
  • 1,161
  • 9
  • 15
  • 1
    I have referred that tutorial, i have created 2 .so files as they have described. Now i want to use surf detection, but how should i write the code(c++ or java) and then how to call that method from my android code. Please guide me in doing that, thanks for support – Mehul Thakkar Jan 07 '14 at 04:18
  • The 2nd part of the tutorial shows how to use the OpenCV functions through NDK and JNI: https://sites.google.com/site/wghsite/technical-notes/opencv_nonfree_android_jni_demo – Robert Wang Apr 14 '15 at 21:46
0

Download older version, i.e. 4.2.1 or 4.2.0 of opencv and use it into your project

Mehul Thakkar
  • 12,440
  • 10
  • 52
  • 81