camera2 手动对焦,android
Manual focus in camera2, android
我正在寻找 android 中 camera2 中手动对焦的示例。
我试图获得如下所示的最小焦距和可用焦距,但没有帮助。如何控制焦距?
float minimumLens = characteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
float[] lensDistances = characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS);
我需要用seekbar来控制它。
提前致谢。
switch (seekBar.getId()) {
case R.id.sb_focus:
float minimumLens = mCameraCharacteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
float num = (((float) i) * minimumLens / 100);
mPreviewBuilder.set(CaptureRequest.LENS_FOCUS_DISTANCE, num);
int showNum = (int) num;
mSeekBarTextView.setText("focus:" + showNum);
break;}
注意,CONTROL_AF_MODE应该关闭。
https://github.com/pinguo-yuyidong/Camera2/blob/master/app/src/main/java/us/yydcdut/androidltest/ui/DisplayFragment.java
第 1109 行中的代码
我正在寻找 android 中 camera2 中手动对焦的示例。 我试图获得如下所示的最小焦距和可用焦距,但没有帮助。如何控制焦距?
float minimumLens = characteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
float[] lensDistances = characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS);
我需要用seekbar来控制它。 提前致谢。
switch (seekBar.getId()) {
case R.id.sb_focus:
float minimumLens = mCameraCharacteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
float num = (((float) i) * minimumLens / 100);
mPreviewBuilder.set(CaptureRequest.LENS_FOCUS_DISTANCE, num);
int showNum = (int) num;
mSeekBarTextView.setText("focus:" + showNum);
break;}
注意,CONTROL_AF_MODE应该关闭。
https://github.com/pinguo-yuyidong/Camera2/blob/master/app/src/main/java/us/yydcdut/androidltest/ui/DisplayFragment.java
第 1109 行中的代码