Android: how to display camera preview with callback?

前端 未结 6 1232
暖寄归人
暖寄归人 2020-12-03 00:18

What I need to do is quite simple, I want to manually display preview from camera using camera callback and I want to get at least 15fps on a real device. I don\'t even need

6条回答
  •  伪装坚强ぢ
    2020-12-03 00:33

    Is this not what you want? Just use a SurfaceView in your layout, then somewhere in your init like onResume():

    SurfaceView surfaceView = ...
    SurfaceHolder holder = surfaceView.getHolder();
    ...
    Camera camera = ...;
    camera.setPreviewDisplay(holder);
    

    It just sends the frames straight to the view as fast as they arrive.

    If you want grayscale, modify the camera parameters with setColorEffect("mono").

提交回复
热议问题