Reputation: 3
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 the button.
Could someone help me ? I've searched a lot on the Internet, but i could not find nothing interesting ( in the documentation also http://docs.opencv.org/java/org/opencv/android/JavaCameraView.html). I'm using JavaCameraView because i am working with openCV.
Upvotes: 0
Views: 9323
Reputation: 336
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.
Upvotes: 3