Set the position that you want to auto focus at. This setting will replace the default focus value and always focus on the set point.
Java:
mCameraEnhancer.setAutoFocusPosition(0.5,0.6);
Kotlin:
mCameraEnhancer!!.setAutoFocusPosition(0.5,0.6)
Set the manual focus position. This position only takes effect once when this API is called.
Java:
//The focus position will be 200 pixel from left and 300 pixel from top.
mCameraEnhancer.setManualFocusPosition(200,300);
Kotlin:
mCameraEnhancer!!.setManualFocusPosition(200,200)
Set the focal length (float). The range of focal length is from 0 to 10. The value is a precentage. If user sets setFocalLength(5);
it means the focal length will be 50% of the maxium focal length of the camera. Please note, If this API is called to set a focal length, the focal length will be fixed and all other auto focus mode will be disabled. To quit this fixed focal length mode, please set the focal length into -1.
To enter the fixed focal length mode:
Java:
mCameraEnhancer.setFocalLength(8.5);
Kotlin:
mCameraEnhancer!!.setFocalLength(8.5)
To quit:
Java:
mCameraEnhancer.setFocalLength(-1);
Kotlin:
mCameraEnhancer!!.setFocalLength(-1)
This API is designed to turn on DCE auto focus mode which is specially designed and is separate from the systems default auto focus mode. DCE auto focus and the default auto focus can work together at the same time without any conflict. The above focus settings are also available for controlling system default auto focus.
Java:
mCameraEnhancer.enableDCEAutoFocus(true);
Kotlin:
mCameraEnhancer!!.enableDCEAutoFocus(true)
To get status (on/off) of DCE autofocus mode:
Java:
boolean x = mCameraEnhancer.getEnabledDCEAutoFocusStatus();
Kotlin:
var x:Boolean? = mCameraEnhancer!!.enabledDCEAutoFocusStatus
This API is designed for controlling the system default autofocus. To turn off default autofocus mode:
Java:
mCameraEnhancer.enableDefaultAutoFocus(false);
Kotlin:
mCameraEnhancer!!.enableDefaultAutoFocus(false)
To get status (on/off) of Default autofocus mode:
Java:
boolean x = mCameraEnhancer.getEnabledDefaultAutoFocusStatus();
Kotlin:
var x:Boolean? = mCameraEnhancer!!.enabledDefaultAutoFocusStatus
Regular auto focus is an advanced setting that enables the camera to auto focus every 3 seconds. It is contained in DCE auto focus. When DCE auto focus is enabled, regular auto focus is enabled as well. To turn off regular auto focus mode:
Java:
mCameraEnhancer.enableRegularAutoFocus(false);
Kotlin:
mCameraEnhancer!!.enableRegularAutoFocus(false)
To get status (on/off) of regular autofocus mode:
Java:
boolean x = mCameraEnhancer.getEnabledRegularAutoFocusStatus();
Kotlin:
var x:Boolean? = mCameraEnhancer!!.enabledRegularAutoFocusStatus
There are focus interval times and focus terminate times for users to set in regular auto focus mode. Please use setregularautofocusparam
to make these settings.
Java:
// Set focus interval = 3000 and focus terminate time = 500.
mCameraEnhancer.setRegularAutoFocusParam(3000, 500);
Kotlin:
mCameraEnhancer!!.setRegularAutoFocusParam(3000,500)
This API is another advanced setting that enabled the camera to autofocus when sharpness change is detected between contiguous frames. The same with regular autofocus, this focus mode is also enabled by default when DCE autofocus is enabled. To turn off camera autofocus when sharpness changes:
Java:
mCameraEnhancer.enableAutoFocusOnSharpnessChange(false);
Kotlin:
mCameraEnhancer!!.enableAutoFocusOnSharpnessChange(false)
To get the status (on/off) of this autofocus mode:
Java:
boolean x = mCameraEnhancer.getEnabledAutoFocusOnSharpnessChangeStatus();
Kotlin:
var x:Boolean? = mCameraEnhancer!!.enabledAutoFocusOnSharpnessChangeStatus
DCE auto zoom mode can be enabled if the user is using DCE to enhance decode performance. The auto zoom mode is based on decode region predicted algorithm. In DCE auto zoom mode, If the lastest decoded frame is predicted to contain a barcode but fails on decoding, DCE will control the camera to zoom in to approach the barcode region. To enable auto zoom mode:
Java:
mCameraEnhancer.enableAutoZoom(true);
Kotlin:
mCameraEnhancer!!.enableAutoZoom(true)
To check the status (on/off) of autozoom mode:
Java:
boolean x = mCameraEnhancer.getEnabledAutoZoomStatus();
Kotlin:
var x:Boolean? = mCameraEnhancer!!.enabledAutoZoomStatus
Set the zoom factor (float).
Java:
mCameraEnhancer.setZoomFactor(1.5f);
Kotlin:
mCameraEnhancer!!.setZoomFactor(1.5f)
latest version