title: Opencv android, capture image
body: <p>I will try to simplify my problem. Lets say i just want to see grayscale images using camera, i do it this way:</p>
  
  <pre><code>public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
  
  return inputFrame.gray();
  
   }
  </code></pre>
  
  <p>And this works just fine, i can now dinamically see grey image on my screen. But problem is when i try to capture this image (frame). Instead of capturing it in grey, it captures it in color (it ignores all the effects i do in onCameraFrame). To capture image i use the same way done in Tutorial 3 - Camera Control (Here is relevant code):</p>
  
  <pre><code>public class MainActivity extends Activity implements CvCameraViewListener2, View.OnTouchListener {
  
  private CameraLab mOpenCvCameraView;
  
  protected void onCreate(Bundle savedInstanceState) {
  
       mOpenCvCameraView = (CameraLab) findViewById(R.id.openCVCamera);
          mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
          mOpenCvCameraView.setCvCameraViewListener(this);
  }
  
  @Override
      public boolean onTouch(View v, MotionEvent event) {
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
          String currentDateandTime = sdf.format(new Date());
          String fileName = "Image_"+currentDateandTime + ".jpg";
          mOpenCvCameraView.takePicture(fileName);
          return false;
      }
  }
  
  
  public class CameraLab extends JavaCameraView implements PictureCallback {
  
  private String mPictureFileName;
  
  public void takePicture(final String fileName) {
          Log.i(TAG, "Taking picture");
  
          this.mPictureFileName = fileName;
  
          mCamera.setPreviewCallback(null);
  
          // PictureCallback is implemented by the current class
          mCamera.takePicture(null, null, this);
      }
  
      @Override
      public void onPictureTaken(byte[] data, Camera camera) {
  
          Log.i(TAG, "Saving a bitmap to file");
          mCamera.startPreview();
          mCamera.setPreviewCallback(this);
  
          // Write the image in a file (in jpeg format)
         try {
              FileOutputStream fos = new FileOutputStream(mPictureFileName);
  
              fos.write(data);
              fos.close();
  
          } catch (java.io.IOException e) {
              Log.e("PictureDemo", "Exception in photoCallback", e);
          }
  
      }
  }
  </code></pre>
  
  <p>So, to recap, problem is whatever i do in onCameraFrame (make image grey, detect circles...) when i capture image i dont get any of those effects, i just get a normal image.</p>
  
  <p>How can i fix this ?</p>