[英]Turn off auto focus in android
It is any way to turn off auto focus in camera in code my application. 这是在我的应用程序的代码中关闭相机自动对焦的任何方法。 I want to check how my scanner work if phone has no auto focus, but in my phone I have that function. 如果手机没有自动对焦,我想查看我的扫描仪是如何工作的,但是在我的手机中我有这个功能。
Use FOCUS_MODE_INFINITY
or FOCUS_MODE_FIXED
. 使用FOCUS_MODE_INFINITY
或FOCUS_MODE_FIXED
。 You can also use FOCUS_MODE_MACRO
, but that will require holding your phone quite close to the object you're scanning. 您也可以使用FOCUS_MODE_MACRO
,但这需要将手机放在离您正在扫描的物体非常近的位置。
On a second thought, the word 'scanner' evokes thoughts of barcodes and QR codes, so unless you print them as full-size page, you actually might be better off with FOCUS_MODE_MACRO
. 再想一想,“扫描仪”一词唤起人们对条形码和二维码的想法,所以除非你把它们打印成全尺寸页面,否则你实际上可能会更好用FOCUS_MODE_MACRO
。
You can set the desired focus mode with Camera.Parameters.setFocusMode()
when opening your camera. 打开相机时,可以使用Camera.Parameters.setFocusMode()
设置所需的对焦模式。
You Can use mCamera.cancelAutoFocus();
你可以使用mCamera.cancelAutoFocus();
Also if you want to set Macro or another Focus Mode, you shall write: 此外,如果您想设置微距或其他聚焦模式,您应该写:
Camera.Parameters mParam = mCamera.getParameters();
mParam.setFocusMode(Camera.Parameters.FOCUS_MODE_MACRO);
mCamera.setParameters(mParam);
All the focus mode and Camera parameters are availble here : 所有焦点模式和相机参数均可在此处获得 :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.