I will try to simplify my problem. Lets say i just want to see grayscale images using camera, i do it this way:
public Mat onCameraFrame(CvCameraViewFrame inputF
It is because you are modifying Mat in onCameraFrame() and writing the image data to file in onPictureTaken().
The Mat in onCameraFrame is never written to the file.
The byte[] in onPictureTaken() contains the picture taken by the camera when you push a button or touch on the screen whatever is triggering takePicture().
If you want to the write picture with some effects then you will have to convert byte[] to Mat and then make effects in this Mat and then write it to file using imwrite() or convert the modified Mat back to byte[] and then write it to file using FileOutputStream as shown in your code.
imwrite() will be slower than the FileOutputStream approach