set frame rate in JavaCameraView

前端 未结 1 1298
你的背包
你的背包 2021-01-28 23:56

i would like to set frame rate to 1 fps using JavaCameraView. When i turn on camera the frame rate is about 20 fps. My purpose is to change this value to 1 fps after click on

相关标签:
1条回答
  • 2021-01-29 00:43

    You can manipulate camera preview fps by creating class that extends JavaCameraView and change parameters of mCamera Object:

    public class CustomizableCameraView extends JavaCameraView {
    
        public CustomizableCameraView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public void setPreviewFPS(double min, double max){
            Camera.Parameters params = mCamera.getParameters();
            params.setPreviewFpsRange((int)(min*1000), (int)(max*1000));
            mCamera.setParameters(params);
        }
    }
    

    similar to OpenCV Tutorial 3 - Camera Control.

    But you have to check if fps range you will set is in mCamera.getSupportedPreviewFpsRange() - reference. In my case [min:10000, max:31000], so theoretically minimum is 10fps.

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