Ask Your Question

Vlad's profile - activity

2014-08-23 12:04:26 -0500 received badge  Editor (source)
2014-08-18 04:48:14 -0500 received badge  Teacher (source)
2014-08-18 04:47:08 -0500 received badge  Self-Learner (source)
2014-08-18 04:44:16 -0500 answered a question SIGSEGV while finalizing MatOfRect (while GC)

Solved.

The problem was in a different matrix, that i've passed from c++ code. When returning a matrix address from jni, i had to use:

Mat ret = getSomeMatrix();
return (jlong) new Mat(ret);

because the java constructor Mat(long addr) doesn't add a reference to the counter of the matrix, but the finalizer does remove one reference.

2014-08-04 12:18:37 -0500 commented question SIGSEGV while finalizing MatOfRect (while GC)

I want to avoid garbage collection while the app is running. to do so i avoid object allocation as much as possible. BUT, I've already tried putting mFaceList as a local var and the same problem occurred as well.

2014-08-03 12:17:56 -0500 asked a question SIGSEGV while finalizing MatOfRect (while GC)

Hey guys, I'm using OpenCV4Android v.2.4.9 on Nexus 5 with android 4.4.4 stock rom.

I use this piece of code for running haar cascade face detection:

public Rect getFaceFromCascade(){
    // cascade! woohoo
    if (mFrontCascade != null) {
        int height = mWorkingFrame.rows();
        int faceSize = Math.round(height * mMinFaceSize);

        mFrontCascade.detectMultiScale(mWorkingFrame, mFaceList, 
                        1.1, 2, 2 , new Size(faceSize, faceSize), new Size());
    }

    Rect[] facesArray = mFaceList.toArray();

    if (facesArray.length == 0){
        //cascade couldn't find any face
        return null;
    }

    return facesArray[0];
}

mFaceList is a MatOfRect i'm creating once when the class is initialized.

When the class dies, I don't do anything with mFaceList (although i've also tried releasing it and that didn't help), and leave it to the garbage collector, but when the GC comes along later on, i get a SIGSEGV. After deep investigation i found the the problem is when release is called in the MatOfRect (Mat) finalizer.

When my class dies the mFaceList has the following header:

Mat [ 1*1*CV_32SC4, isCont=true, isSubmat=false, nativeObj=0x713cdad8, dataAddr=0x751badf0 ]

and in the finalize method of mFaceList it has the following header:

Mat [ 1964813884*1*CV_32SC(455), isCont=false, isSubmat=true, nativeObj=0x751ad8bc, dataAddr=0x751cae60 ]

That's when the SIGSEGV is occurring. any idea what can mess with the header like that? or why is this happening? I don't have any other references of this MatOfRect anywhere in the code.

Any help would be appreciated. Vlad

2014-08-03 11:15:51 -0500 commented question Unable to use KalmanFilter in Java on Android

I ended up writing a little wrapper for native Kalman filter.. so i'll have to whole functionality. it took about 10 minutes so i guess for now, that's the way to go.

2014-02-26 07:04:49 -0500 answered a question How can I measure performance of OpenCV4Android samples on several devices?

you can use the DDMS tool that comes with the sdk http://developer.android.com/tools/debugging/debugging-tracing.html

2014-02-17 18:39:42 -0500 commented question Unable to use KalmanFilter in Java on Android

Did you find a solution for this? the wrapper makes no sense. I've tried running it without the transition matrix, and the filter does nothing to my values..

2012-07-18 11:47:00 -0500 asked a question NoClassDefFoundError trying to run my own code

Hey guys, i've migrated my project to a new computer, and it stopped working. I get NoClassDefFoundError: org.opencv.objdetect.CascadeClassifier when trying to run it.

I'm using eclipse indigo, on win7, trying to run on andorid 2.3.3. everything worked well before!

i have the opencv2.4.2.jar referenced in my project, (no _src dirs) and i can see the CascadeClassifier.class there.. i don't know what's wrong..

any ideas?