Interface IDCVCameraEnhancer
The interface IDCVCameraEnhancer
provides camera and related hardware controlling APIs.
interface IDCVCameraEnhancer
Method | Description |
---|---|
ScanRegion |
The property for users to specify the region of interest. |
ScanRegionVisible |
Set or get the visibility of the scan region. |
Open |
Open the camera. |
Close |
Close the camera. |
TurnOnTorch |
Turn on the torch. |
TurnOffTorch |
Turn off the torch. |
SetFocus |
Trigger a focus at the targeting point and set the subsequent focus mode after focused. |
EnableFeatures |
Enable camera enhancer features by inputting EnumEnhancerFeatures value. |
DisableFeatures |
Disable camera enhancer features by inputting EnumEnhancerFeatures values. |
IsFeatureEnabled |
Returns a boolean value that means whether the feature(s) you input is (are) enabled. |
SetZoomFactor |
Set the zoom factor. The camera will zoom in/out immediately after this method is triggered. |
AutoZoomRange |
A Range value that indicates the maximum available zoom factor of the device. |
MaxZoomFactor |
A float property that indicates the maximum available zoom factor of the device. |
ScanRegion
Specify a region of interest. Once the scan region is set, the video frames will be cropped so that the library process the region only. The scan region you specified will be displayed on the view by default. You can hide the scan region by setting ScanRegionVisible
to false.
Region ScanRegion { get; set; }
Parameters
scanRegion
: An object of Region
class which indicates the location of the region.
Related APIs
- ScanRegionVisible: You can set whether to display the scan region.
- BarcodeLocationResult: Since the video frame is cropped based on the scan region, the
Location
you get fromBarcodeLocationResult
is based on the cropped video frame.
Code Snippet
Specify a scan region and display it on the view:
DCVXamarin.Region scanRegion = new DCVXamarin.Region();
scanRegion.RegionTop = 30;
scanRegion.RegionBottom = 70;
scanRegion.RegionLeft = 15;
scanRegion.RegionRight = 85;
scanRegion.RegionMeasuredByPercentage = 1;
protected override void OnAppearing()
{
base.OnAppearing();
App.dbr.StartScanning();
App.dce.Open();
// Set scan region on appearing
App.dce.ScanRegion = scanRegion;
}
Related APIs
ScanRegionVisible
Set or get the visibility of the scan region.
bool ScanRegionVisible { get; set; }
Code Snippet
The following code snippet shows how to set the scan region but hide it on the view.
DCVXamarin.Region scanRegion = new DCVXamarin.Region();
scanRegion.RegionTop = 30;
scanRegion.RegionBottom = 70;
scanRegion.RegionLeft = 15;
scanRegion.RegionRight = 85;
scanRegion.RegionMeasuredByPercentage = 1;
protected override void OnAppearing()
{
base.OnAppearing();
App.dbr.StartScanning();
App.dce.Open();
App.dce.ScanRegion = scanRegion;
// Hide the scan region with the following line.
App.dce.ScanRegionVisible = false;
}
Open
Open the camera.
void Open();
Close
Close the camera.
void Close();
TurnOnTorch
Turn on the torch.
void TurnOnTorch();
TurnOffTorch
Turn off the torch.
void TurnOffTorch();
SetFocus
Trigger a focus at the targeting point and set the subsequent focus mode after focused.
void SetFocus(Point focusPoint, EnumFocusMode subsequentFocusMode);
Parameters
[in] focusPosition
: An Point object indicates the interest area.
[in] subsequentFocusMode
: Specify a mode with EnumFocusMode
. If you set the focus mode to FM_LOCKED
, the focallength will be lock after the focus. Otherwise, the continuous auto focus that control by the hardware is still enabled.
EnableFeatures
Enable camera enhancer features by inputting EnumEnhancerFeatures
value.
void EnableFeatures(EnumEnhancerFeatures enhancerFeatures);
Parameters
enhancerFeatures
: The combined value of EnumEnhancerFeatures
.
DisableFeatures
Disable camera enhancer features by inputting EnumEnhancerFeatures
values.
void DisableFeatures(EnumEnhancerFeatures enhancerFeatures);
Parameters
enhancerFeatures
: The combined value of EnumEnhancerFeatures
.
isFeatureEnabled
Returns a boolean value that means whether the feature(s) you input is (are) enabled.
bool IsFeatureEnabled(EnumEnhancerFeatures enhancerFeatures);
Parameters
enhancerFeatures
: The combined value of EnumEnhancerFeatures
.
SetZoomFactor
Set the zoom factor. The camera will zoom in/out immediately after this method is triggered.
void SetZoomFactor(float factor);
Parameters
factor
: The target zoom factor.
AutoZoomRange
A Range
value that indicates the maximum available zoom factor of the device.
Range AutoZoomRange { get; set; }
MaxZoomFactor
A float property that indicates the maximum available zoom factor of the device.
float MaxZoomFactor { get; }