Opencv android, capture image

后端 未结 2 1953
执笔经年
执笔经年 2021-02-06 18:49

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         


        
相关标签:
2条回答
  • 2021-02-06 19:32

    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

    0 讨论(0)
  • 2021-02-06 19:43

    This is super duper old but I saw it so many times while searching. I solved my issue by using

    Imgcodecs.imwrite(fileName,mRgba);
    

    instead of

    javaCameraView.takePicture(fileName);
    

    in my onTouch method.

    0 讨论(0)
提交回复
热议问题