Resource Base
Table of contents

CameraEnhancer

The CameraEnhancer class provides camera-specific functionality including camera selection, focus control, zoom, and other enhanced features. The CameraEnhancer is also responsible for the basic UI of the camera view.

Definition

Assembly: dynamsoft_capture_vision_flutter

class CameraEnhancer extends ImageSourceAdapter

Static Properties

Property Description
instance Returns the singleton instance of CameraEnhancer.

instance

static CameraEnhancer get instance;

Methods

Method Description
close Closes the camera and releases the related resources.
destroy Destroys the camera enhancer instance and releases the related resources on the host side.
disableEnhancedFeatures Disables the selected and activated enhanced features of the Camera Enhancer.
enableEnhancedFeatures Activates the selected enhanced features provided by the Camera Enhancer library, including the auto-zoom and smart torch features.
getCameraPosition Returns the current camera being used.
getFocusMode Returns the current focus mode of the camera.
getScanRegion Returns the current scan region.
getZoomFactor Returns the current zoom factor of the camera.
open Opens the selected camera to begin the capture process.
selectCamera Selects the camera based on the specified camera position.
setFocus Sets the focus point as well as the mode for the camera.
setResolution Sets the resolution of the camera.
setScanRegion Sets the scan region of the camera and displays a bordered area on the UI.
setZoomFactor Sets the zoom factor of the camera.
turnOffTorch Turns off the camera’s flashlight (if available).
turnOnTorch Turns on the camera’s flashlight (if available).

The following methods are inherited from superclass ImageSourceAdapter

Method Description
addImageToBuffer Adds an image to the internal buffer.
clearBuffer Clears all images from the buffer, resetting the state for new image fetching.
getBufferOverflowProtectionMode Get the current mode for handling buffer overflow.
getColourChannelUsageType Get the current usage type for color channels in images.
getImage Get a buffered image. Implementing classes should return a Promise that resolves with an instance of ImageData.
getMaximumImageCount Get the maximum number of images that can be buffered.
hasImage Checks if an image with the specified ID is present in the buffer.
setBufferOverflowProtectionMode Sets the behavior for handling new incoming images when the buffer is full.
setColourChannelUsageType Sets the usage type for color channels in images.
setMaximumImageCount Sets the maximum number of images that can be buffered at any time.
setNextImageToReturn Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.
startFetching Start fetching images from the source to the Video Buffer of ImageSourceAdapter.
stopFetching Stop fetching images from the source to the Video Buffer of ImageSourceAdapter.

close

Closes the camera and releases the related resources. When the CaptureVisionRouter instance calls stopCapturing, please make sure to call this method as well to ensure that the resources are released properly.

Future<void> close();

destroy

Destroys the camera enhancer instance and releases the related resources on the host side.

Future<void> destroy();

disableEnhancedFeatures

Disables the selected and activated enhanced features (represented by EnumEnhancedFeatures) of the Camera Enhancer.

Future<void> disableEnhancedFeatures(int features);

enableEnhancedFeatures

Activates the selected enhanced features (represented by EnumEnhancedFeatures) provided by the Camera Enhancer library, including the auto-zoom and smart torch features.

Future<void> enableEnhancedFeatures(int features);

Remarks

If you would like to activate multiple enhanced features, then they must be combined using the OR (|) operator.

await _cvr.setInput(_camera);
_camera.enableEnhancedFeatures(EnumEnhancedFeatures.autoZoom | EnumEnhancedFeatures.smartTorch);
_camera.open();

getCameraPosition

Returns the current camera being used, represented as a EnumCameraPosition.

Future<EnumCameraPosition> getCameraPosition() async;

getFocusMode

Returns the current focus mode of the camera, represented as a EnumFocusMode.

Future<EnumFocusMode> getFocusMode() async;

getScanRegion

Returns the current scan region as a DSRect object.

Future<DSRect?> getScanRegion() async;

getZoomFactor

Returns the current zoom factor of the camera.

Future<double> getZoomFactor();

open

Opens the selected camera to begin the capture process.

Future<void> open();

selectCamera

Selects the camera based on the specified EnumCameraPosition.

Future<void> selectCamera(EnumCameraPosition position);

Remarks

  • backUltraWide & backDualWideAuto: iPhone only.

setFocus

Sets the focus point as well as the mode (as a EnumFocusMode) for the camera.

Future<void> setFocus(Point<double> point, EnumFocusMode focusMode);

setResolution

Sets the resolution of the camera.

Future<void> setResolution(EnumResolution resolution);

setScanRegion

Sets the scan region of the camera and displays a bordered area on the UI to represent the scan region.

Future<void> setScanRegion(DSRect region) async;

See also

setZoomFactor

Sets the zoom factor of the camera.

Future<void> setZoomFactor(double zoom);

turnOffTorch

Turns off the camera’s flashlight (if available).

Future<void> turnOffTorch();

turnOnTorch

Turns on the camera’s flashlight (if available).

Future<void> turnOnTorch();

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: