Question

I'm developing an Android App and I have this problem in my native code.

These vectors are global.

vector<Mat> listaMatDes;
vector<Mat> listaMatKey;
vector<int> listaCols;
vector<int> listaRows;

I also have this function, in which descriptors and keyPoints contain the addresses of some Mats (using this function getNativeObjAddr()):

void rellenarObjetos(jlong* keyPoints, jlong* descriptors, jint* cols, jint* rows, int length){

    for(int i=0; i<length; i++){

        listaCols.push_back(cols[i]);
        listaRows.push_back(rows[i]);

        Mat* aux_des=(Mat*)descriptors[i];
        listaMatDes.push_back(aux_des->clone());

        Mat* aux_key=(Mat*)keyPoints[i];
        listaMatKey.push_back(aux_key->clone());
    }

}

I've checked the two auxiliary Mat and they are created well.

I've this error Fatal signal 11 (SIGSEGV) at 0x00000001 (code=1) and it's caused by the line

listaMatDes.push_back(aux_des->clone());

but i don't know why.

Was it helpful?

Solution 2

Programming the whole day makes you crazy (and silly, at least to me), I was passing from java code an array of LOCAL mat addresses (long[] created using the function getNativeObjAddr() which return the address in memory of the mat), so It wasn't going to work...

I solved it by creating a long array as a class field and passing this array.

OTHER TIPS

Try to separate listaMatDes.push_back(aux_des->clone()); in:

Mat m = aux_des->clone();
listaMatDes.push_back(m);

This way, you can see if the error really is in the push_back, I would say it's probably in the clone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top