Device calibration
All devices (phone models) needs to be calibrated. This is required only once per model.
How to
The SDK provides your application with the calibration data like resolution, focus point, and some other calibration session related data. More about the data structure can be found in BcmDeviceCalibration.
There are additional callbacks, which are listed in IBcmCalibrationDelegate.
There is shown a calibration dialog after a successful or failed calibration, but no further action is taken from the SDK side. It is your application's responsibility to implement an appropriate action to the calibration response.
After a successfull calibration, the calibration data may be used to set the mandatory data for your next calibration session. To do so you should care about the following data from the BcmDeviceCalibration:
- cameraFrameFrameResolution
- focusLensPositionFactor
- dpi
These values can be used for configuration of the BcmCameraConfig. Please have a look to the BcmCalibrationController how to apply the BcmCameraConfig.
Example
You may follow along by building your own custom calibration delegate on this page, or inspect the ready-made Sample App project shipped with this documentation.
Calibration Delegate
Next, implement the IBcmCalibrationDelegate interface. The delegate enables communication from the calibration Fragment (BcmCalibrationFragment) to your application.
A typical place to implement the delegate would be the Activity, which is responsible for presenting
the Calibration Fragment. You can either inherit from the SDK Calibration Activity and set the flowDelegate or
set the flowDelegate on the Fragment level, if you use
the BcmCalibrationFragment. See below.
Set the flowDelegate at the Calibration Activity level (BcmCalibrationActivity)
In the following, we assume that the current Activity implements IBcmFlowDelegate:
Kotlin:
class BcmCalibrationActivityOverride : BcmCalibrationActivity(), IBcmCalibrationDelegate {
/**
* Set config take place here
*/
init {
calibrationDelegate = this
}
}
Java:
public class BcmCalibrationActivityOverride extends BcmCalibrationActivity implements IBcmCalibrationDelegate {
// Instance initialization block
/**
* Set config take place here
*/ {
setCalibrationDelegate(this);
}
}
Set the calibrationDelegate at the Calibration Fragment level (BcmCalibrationFragment)
In the following, we assume that the current Activity (this)
implements IBcmCalibrationDelegate:
Kotlin:
val calibrationFragment = BcmCalibrationFragment(
BcmCameraConfig(),
this)
supportFragmentManager.beginTransaction().replace(
R.id.content_frame,
calibrationFragment)
.addToBackStack("BcmCalibration")
.commitAllowingStateLoss()
Java:
BcmCalibrationFragment calibrationFragment=new BcmCalibrationFragment(
new BcmCameraConfig(),
this);
getSupportFragmentManager().beginTransaction().replace(
R.id.content_frame,
calibrationFragment)
.addToBackStack("BcmCalibration")
.commitAllowingStateLoss()