samsung nexus(4.4.4):致命信号6(SIGABRT)代码= -6

时间:2017-04-06 13:03:54

标签: android c++ android-ndk dlib

我正在使用dlib开发头部姿势估计Android应用程序。 当我尝试在 samsung nexus Android 4.4.4 )上运行我的应用时,问题会出现 。即使在三星gt-p3110(与Android 4.1.2),它的工作原理。

这是我的日志:

I/native: jni_head_pose_det.cpp:183 Initializing new HeadPoseEstimation, landmarkPath /storage/emulated/0/Selfear2/data/shape_predictor_68_face_landmarks.dat and mode 0and some params...

A/libc: Fatal signal 6 (SIGABRT) at 0x0000081b (code=-6), thread 2075

在研究错误代码时,我尝试了这个 -  https://stackoverflow.com/a/34218851/5582959 - (GetStringUTFChars的已知问题),但对landmarkPath的更改编码没有帮助。

感谢任何帮助。

修改: jniInit方法的代码:

jint JNIEXPORT JNICALL DLIB_JNI_METHOD(jniInit)(JNIEnv* env, jobject thiz,
        jstring landmarkPath,
        jint mode,
        jfloat fx,
        jfloat fy,
        jfloat cx,
        jfloat cy,
        jfloat k1,
        jfloat k2,
        jfloat p1,
        jfloat p2,
        jfloat k3) {
// Initialize a new estimator if it's not already there
if (!gHeadPoseEstimationPtr) {
const char* landmarkmodel_path = env->GetStringUTFChars(landmarkPath, 0);
LOG(INFO) << "Initializing new HeadPoseEstimation, landmarkPath " << landmarkmodel_path << " and mode "<< mode << "and some params...";
gHeadPoseEstimationPtr = std::make_shared<HeadPoseEstimation>(landmarkmodel_path, mode, fx, fy, cx, cy, k1, k2, p1, p2, k3);
env->ReleaseStringUTFChars(landmarkPath, landmarkmodel_path);
}
  • landmarkPath = /storage/emulated/0/Selfear2/data/shape_predictor_68_face_landmarks.dat
  • jint mode = 0
  • 作为jfloat参数我正在传递零

HeadPoseEstimation的构造函数

HeadPoseEstimation::HeadPoseEstimation(const string& face_detection_model, int mod, 
float fx, float fy, float cx, float cy, 
float k1, float k2, float p1, float p2, float k3) {
// Load face detection and pose estimation models.
detector = get_frontal_face_detector();
deserialize(face_detection_model) >> pose_model;
mode = mod; // Set correct mode

// Set cameraMatrix
cv::Mat m = cv::Mat::zeros(3,3,CV_32F);
cameraMatrix = m;
cameraMatrix(0,0) = fx; // focalLengthX
cameraMatrix(1,1) = fy; // focalLengthY
cameraMatrix(0,2) = cx; // opticalCenterX
cameraMatrix(1,2) = cy; // opticalCenterY
cameraMatrix(2,2) = 1;
LOG(INFO) << "Initialized Camera Matrix with:\n{fx} = " << fx << " {0}" << " {cx} = " << cx 
        << "\n{0}" << " {fy} = " << fy << " {cy} = " << cy <<
        "\n{0} {0} {1}";

distCoeffs = (Mat1d(1, 5) << k1, k2, p1, p2, k3);
LOG(INFO) << "Initialized Default Camera Distortion Matrix with:\n{k1} = " << k1 << " {k2} = " << k2 << " {p1} = " << p1  << " {p2} = " << p2<< " {k3} = " << k3;
 }

编辑2 在调试构造函数之后,我发现在反序列化时抛出了异常:

Error deserializing object of type short
                                                            while 
deserializing a floating point number.
                                                            while 
deserializing a dlib::matrix
                                                            while 
deserializing object of type std::vector
                                                            while 
deserializing object of type std::vector
                                                            while 
deserializing object of type std::vector

0 个答案:

没有答案