Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your problem is linked to the line:

  this->nFrame = frame;

(as you mentioned it) and it is because cv::Mat m = otherMat is not doing a deep copy, it is just pointing to the same address as otherMat, so if you modify the otherMat you'll get a modification in this->nFrame.

For doing a deep copy you need to use copyTo or clone functions:

  this->nFrame = frame.clone();

What I do not understand is: Have you created a C++ class that is used by JNI to make it a Java class? Otherwise why talking about java and JNI while posting c++ code?