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);
}
2 | No.2 Revision |
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);
}