Clear the image buffer.
Closes the currently active camera and stops the video stream.
Destroy native instance. This object is no longer available after destroy().
Disables one or more previously enabled enhanced features.
Code Snippet:
cameraEnhancer.disableEnhancedFeatures(EnumEnhancedFeatures.EF_AUTO_ZOOM | EnumEnhancedFeatures.EF_FRAME_FILTER)
An enum value or a bitwise combination of EnumEnhancedFeatures indicating the features to be disabled.
Enable the specified enhanced features. View EnumEnhancedFeatures to learn about these enhanced features. By default, these enhanced features are all disabled.
Code Snippet:
cameraEnhancer.enableEnhancedFeatures(EnumEnhancedFeatures.EF_AUTO_ZOOM | EnumEnhancedFeatures.EF_FRAME_FILTER)
An enum value or a bitwise combination of EnumEnhancedFeatures which indicates a series of enhanced features.
Get the camera position.
Get the current usage type for color channels in images.
Get the currently actived focus mode.
Get the current number of images in the buffer.
Get the maximum number of images that can be buffered.
Get the zoom factor of the camera.
Protected
initDetermines whether the buffer is empty.
Opens the currently selected camera and starts the video stream.
Select a camera with a camera position.
One of the EnumCameraPosition
Bind a CameraView instance with this CameraEnhancer instance.
Code Snippet:
function App(): React.JSX.Element {
const cameraView = useRef<CameraView>(null);
const camera = CameraEnhancer.getInstance();
useEffect(() => {
camera.setCameraView(cameraView.current!!);
camera.open();
}, [camera, cameraView])
return (<CameraView style={{flex:1}} ref={cameraView}/>);
}
the CameraView element
Set the usage type of a color channel in images.
The usage type(EnumColourChannelUsageType) to be set for the color channel.
Set the focus point of interest and trigger an one-off auto-focus. After the focus, you can either lock the focalngth or keep the continuous auto focus enabled by configuring the subsequent focus mode.
The x of focus point of interest. The coordinate base of the point is "image".
The y of focus point of interest. The coordinate base of the point is "image".
The subsequent focus mode.
Set the maximum number of images that can be buffered at any time.
The maximum capability of the Buffer.
Sets the scan region within the camera's view which limits the frame acquisition to a specific area of the video feed.
Code Snippet:
let scanRegion = {
top: 25,
bottom: 75,
left: 25,
right: 75,
measuredInPercentage: true,
}
cameraEnhancer.setScanRegion(scanRegion);
//...
cameraEnhancer.setScanRegion(null); //Cancel the scan region
specifies the scan region. If null or undefined, cancel the scan region.
Set the zoom factor of the camera.
The zoom factor.
Start fetching images from the source to the Buffer of ImageSourceAdapter.
Stop fetching images from the source to the Buffer of ImageSourceAdapter.
Turn off the torch.
Turn on the torch.
Static
getGet the singleton instance of CameraEnhancer.
This method ensures that only one instance of CameraEnhancer is created and reused throughout the application. If an instance already exists, it will return the existing one. Otherwise, it will create a new instance and return it.
The singleton instance of CameraEnhancer.
Static
requestTrigger to request the camera permission.
The CameraEnhancer class is the primary class of Dynamsoft Camera Enhancer that defines the camera controlling APIs. It is a subclass of ImageSourceAdapter.
In js end of react-native, CameraEnhancer uses singleton mode. You can only get CaptureVisionRouter instance by CameraEnhancer.getInstance.