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

asked 2013-12-19 01:32:06 -0500

whateverwhat gravatar image

updated 2013-12-19 11:45:26 -0500

In Opencv2.4.7, to use SIFT detector in my android application, I build nonfree.so by myself. But this Fatal signal 11 happens. Help me please. Thanks!

SourceFile:

#include <jni.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <vector>

using namespace std;
using namespace cv;


extern "C" {

JNIEXPORT void JNICALL Java_src_seeingnet_SeeingActivity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba);

JNIEXPORT void JNICALL Java_src_seeingnet_SeeingActivity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
{
  //    initModule_nonfree();
    Mat& mGr  = *(Mat*)addrGray;
    Mat& mRgb = *(Mat*)addrRgba;
    vector<KeyPoint> v, keypoints;

//    FastFeatureDetector detector(50);
//    detector.detect(mRgb, v);
    /*
     * sift detector
     */
    Ptr<FeatureDetector> detectorSift = FeatureDetector::create("SIFT");
    detectorSift->detect(mRgb, v);
//    SIFT deteSift;
//    deteSift.detect(mRgb, v);
    for( unsigned int i = 0; i < v.size(); i++ )
    {
        const KeyPoint& kp = v[i];
        circle(mRgb, Point(kp.pt.x, kp.pt.y), 10, Scalar(0,255,0,255));
    }


}
}

Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := sift_prebuilt

LOCAL_SRC_FILES := libnonfree.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE    := opencv_java_prebuilt

LOCAL_SRC_FILES := libopencv_java.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

include D:/opencv/OpenCV-2.4.7.1-android-sdk/OpenCV-2.4.7.1-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_C_INCLUDES:= D:/opencv/OpenCV-2.4.7.1-android-sdk/OpenCV-2.4.7.1-android-sdk/sdk/native/jni/include

LOCAL_MODULE    := opencv_seeing

LOCAL_JNI_SHARED_LIBRARIES := sift_prebuilt opencv_java_prebuilt

LOCAL_CFLAGS    := -Werror -O3 -ffast-math
LOCAL_SRC_FILES := OpenCVSeeing.cpp
LOCAL_LDLIBS +=  -llog -ldl
include $(BUILD_SHARED_LIBRARY)

log:

12-19 17:20:10.270: D/CameraBridge(30743): mStretch value: 1.0
12-19 17:20:10.310: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:10.330: D/CameraBridge(30743): mStretch value: 1.0
12-19 17:20:10.380: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:10.420: D/CameraBridge(30743): mStretch value: 1.0
12-19 17:20:10.420: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:10.580: I/OCVSeeing::Activity(30743): called onOptionsItemSelected; selected item: Find features
12-19 17:20:10.630: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800

12-19 17:20:10.720: A/libc(30743): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
12-19 17:20:10.760: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:10.870: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:11.050: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:11.100: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:11.140: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:11.190: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:11.270: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:11.370: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
12-19 17:20:11.420: D/JavaCameraView(30743): Preview Frame received. Frame size: 1036800
edit retag flag offensive close merge delete

Comments

Please, add the full crash report with stack trace and registers. It looks like you forgot to call init function from nonfree module.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-12-19 02:39:34 -0500 )edit
1

Thank you! I didn't call cv::initModule_nonfree(). This example didn't call initModule_nonfree() http://web.guohuiwang.com/technical-notes/sift_surf_opencv_android

whateverwhat gravatar imagewhateverwhat ( 2013-12-19 03:12:48 -0500 )edit