private Thread mThread;
protected VideoCapture mCamera;
+ protected NativeCameraFrame mFrame;
public NativeCameraView(Context context, int cameraId) {
super(context, cameraId);
if (mCamera.isOpened() == false)
return false;
+ mFrame = new NativeCameraFrame(mCamera);
+
java.util.List<Size> sizes = mCamera.getSupportedPreviewSizes();
/* Select the size that fits surface considering maximum size allowed */
private void releaseCamera() {
synchronized (this) {
- if (mCamera != null) {
- mCamera.release();
- }
+ if (mFrame != null) mFrame.release();
+ if (mCamera != null) mCamera.release();
}
}
mRgba = new Mat();
}
+ public void release() {
+ if (mGray != null) mGray.release();
+ if (mRgba != null) mRgba.release();
+ }
+
private VideoCapture mCapture;
private Mat mRgba;
private Mat mGray;
break;
}
- deliverAndDrawFrame(new NativeCameraFrame(mCamera));
+ deliverAndDrawFrame(mFrame);
} while (!mStopThread);
}