public void takePicture(final String fileName) {
Log.i(TAG, "Taking picture");
this.mPictureFileName = fileName;
- // Call to garbage collector to avoid bug http://code.opencv.org/issues/2961
- System.gc();
+ // Clear up buffers to avoid bug http://code.opencv.org/issues/2961
+ mCamera.setPreviewCallback(null);
// PictureCallback is implemented by the current class
mCamera.takePicture(null, null, this);
Log.i(TAG, "Saving a bitmap to file");
// The camera preview was automatically stopped. Start it again.
mCamera.startPreview();
+ mCamera.setPreviewCallback(this);
// Write the image in a file (in jpeg format)
try {