BcmCamera
The SDK camera configuration struct (BcmCamera) is an optional interface.
It allows you to configure camera specific parameters.
The interface is for an object to be assigned to BcmScanConfig's camera property.
Interface
Swift:
public struct BcmCameraConfig {
/**
* this factor is used for the fixed focus distance.
* By default (0.0), the nearest point will used for the fixed focus distance.
* this can be changed to a value in the range [0.0, 1.0].
*/
let focusLensPositionFactor: Double
/**
* Set the preferred frame resolution of the Camera.
*/
public enum CameraResolution {
case FULL_HD
case WQ_HD
case _4K
func get() -> AVCaptureSession.Preset {
switch self {
case .FULL_HD:
return AVCaptureSession.Preset.hd1920x1080
case .WQ_HD:
return AVCaptureSession.Preset.hd4K3840x2160
case ._4K:
return AVCaptureSession.Preset.hd4K3840x2160
}
}
}
/**
* danger, W.R.! Attempting to use a too large frame resolution could exceed the camera
* bus' bandwidth limitation, result in gorgeous previews but the storage of garbage capture data.
*/
let frameResolution: CameraResolution
/**
* the camera dpi value is mandatory for the correct image scaling.
* the dpi value is different for each device and depends on the device camera.
* there are pre-calculated dpi values for the most used devices in the SDK.
* the device can be manually calibrated with the calibration API (BcmSdkScanController)
*/
let dpi: Double?
/**
* set input image rotation. This parameter effects the finger detection.
* 180.0, indicates the right side and 0 the left side of the phone.
* Default value is 180.0
*/
let imageInputRotation: Double
/**
* set to 1.0 to use the default software zoom. Valid range is in [1.0, 5.0].
*/
let softwareZoomFactor: CGFloat
/**
* whether to turn on the torch/flash automatically for making finger easily readable.
*/
let isTorchInitiallyOn: Bool
/**
* Internal
*/
/**
* set to false to use continuous auto focus
* the configuration cannot be overwritten
*/
let focusLensPositionOn: Bool = true
public init(
focusLensPositionFactor: Double = 0.0,
frameResolution: CameraResolution = CameraResolution._4K,
dpi: Double? = nil,
imageInputRotation: Double = 0,
softwareZoomFactor: CGFloat = 1.0,
isTorchInitiallyOn: Bool = true
) {
self.focusLensPositionFactor = focusLensPositionFactor
self.frameResolution = frameResolution
self.dpi = dpi
self.imageInputRotation = imageInputRotation
self.softwareZoomFactor = softwareZoomFactor
self.isTorchInitiallyOn = isTorchInitiallyOn
}
}
Example
Swift:
let bcmCamera = BcmCamera(
frameResolution: BcmCamera.CameraResolution._4K,
isTorchInitiallyOn: true)
Initialize the camera config in the BcmScanConfig struct
Swift:
let bcmScanConfig = BcmScanConfig(
camera: bcmCamera)