I have an OpenCV Android app. Most of its code is in Java but I have one function that is in C. The function gets a Mat object and returns a new one.
My question is
in C++
jlong funC(){ Mat *mat = new Mat(); //... return (jlong)mat; }
in java:
long = addr;// addr is return from c method funC() Mat mat = new Mat(addr);
Attention: You must new Mat() in C,if you code is : Mat mat();mat object memory will be collect when funC() end.