Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can create an empty Mat in Java part and then call create method from C++:

// Java
Mat m = new Mat();
jni_func(m.getNativeObjAddr());

// C++
void jni_func(jlong matPtr)
{
    Mat* mat = (Mat*) matPtr;
    mat->create(rows, cols, type);
}

You can create an empty Mat in Java part and then call create method from C++:

// Java
Mat m = new Mat();
jni_func(m.getNativeObjAddr());

// C++
void jni_func(jlong matPtr)
{
    Mat* mat = (Mat*) matPtr;
    mat->create(rows, cols, type);
    memcpy(mat->data, data, mat->step * mat->rows);
}