From a30e8dfec41ebe5146fe8e60c54417388ba1a042 Mon Sep 17 00:00:00 2001 From: DMGithubPublisher Date: Mon, 15 Sep 2025 13:25:09 +0800 Subject: [PATCH] update to internal commit c17632be --- .../primary-api/camera-enhancer-v2.2.3000.md | 692 ----------- .../primary-api/camera-enhancer-v2.6.1003.md | 711 ----------- .../primary-api/camera-enhancer-v2.2.3000.md | 1056 ----------------- .../camera-enhancer-v2.2.3000.md | 235 ---- .../api-reference/camera-view-v2.2.3000.md | 76 -- .../enum/camera-position-2.2.3000.md | 30 - .../api-reference/enum/camera-position.md | 2 +- .../maui/api-reference/feedback-v2.2.3000.md | 46 - .../api-reference/torch-button-v2.2.3000.md | 82 -- 9 files changed, 1 insertion(+), 2929 deletions(-) delete mode 100644 programming/android/primary-api/camera-enhancer-v2.2.3000.md delete mode 100644 programming/android/primary-api/camera-enhancer-v2.6.1003.md delete mode 100644 programming/ios/primary-api/camera-enhancer-v2.2.3000.md delete mode 100644 programming/maui/api-reference/camera-enhancer-v2.2.3000.md delete mode 100644 programming/maui/api-reference/camera-view-v2.2.3000.md delete mode 100644 programming/maui/api-reference/enum/camera-position-2.2.3000.md delete mode 100644 programming/maui/api-reference/feedback-v2.2.3000.md delete mode 100644 programming/maui/api-reference/torch-button-v2.2.3000.md diff --git a/programming/android/primary-api/camera-enhancer-v2.2.3000.md b/programming/android/primary-api/camera-enhancer-v2.2.3000.md deleted file mode 100644 index 6565cc7..0000000 --- a/programming/android/primary-api/camera-enhancer-v2.2.3000.md +++ /dev/null @@ -1,692 +0,0 @@ ---- -layout: default-layout -title: CameraEnhancer - Dynamsoft Camera Enhancer API Reference -description: The class CameraEnhancer of Dynamsoft Camera Enhancer defines the camera controlling APIs. -keywords: camera enhancer, Java, Kotlin -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true -permalink: /programming/android/primary-api/camera-enhancer.html ---- - -# CameraEnhancer - -The `CameraEnhancer` class is the primary class of Dynamsoft Camera Enhancer that defines the camera controlling APIs. It is a subclass of `ImageSourceAdapter`. - -## Definition - -*Assembly:* package com.dynamsoft.dce - -```java -class CameraEnhancer extends ImageSourceAdapter -``` - -## Methods - -| Method | Description | -|------- |-------------| -| [`CameraEnhancer`](#cameraenhancer) | The constructor. | -| [`CameraEnhancer`](#cameraenhancer) | The constructor. | -| [`addListener`](#addlistener) | Add a VideoFrameListener to receive callback when video frames are output. | -| [`removeListener`](#removelistener) | Remove a VideoFrameListener. | -| [`takePhoto`](#takephoto) | Take a photo. | -| [`getCameraPosition`](#getcameraposition) | Get the camera position. | -| [`setZoomFactor`](#setzoomfactor) | Set the zoom factor of the camera. You can use getCapabilities to check the maximum available zoom factor. | -| [`getZoomFactor`](#getzoomfactor) | Get the zoom factor of the camera. | -| [`getFocusMode`](#getfocusmode) | Get the currently actived focus mode. | -| [`initSystemSettingsFromFile`](#initsystemsettingsfromfile) | Initialize system settings from a JSON file. The system settings contain more precise camera control parameters. | -| [`initSystemSettings`](#initsystemsettings) | Initialize system settings from a JSON string. The system settings contain more precise camera control parameters. | -| [`resetSystemSettings`](#resetsystemsettings) | Reset the system settings to default value. | -| [`initEnhancedSettingsFromFile`](#initenhancedsettingsfromfile) | Initialize enhanced settings from a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`initEnhancedSettings`](#initenhancedsettings) | Initialize enhanced settings from a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`outputEnhancedSettings`](#outputenhancedsettings) | Output the enhanced settings to a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`outputEnhancedSettingsToFile`](#outputenhancedsettingstofile) | Output the enhanced settings to a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`resetEnhancedSettings`](#resetenhancedsettings) | Reset the enhanced settings to default value. | -| [`getCapabilities`](#getcapabilities) | Get the device capabilities including zoom factor, ISO, exposure time, etc. | -| [`getCameraState`](#getcamerastate) | Get the device capabilities including zoom factor, ISO, exposure time, etc. | -| [`setCameraStateListener`](#setcamerastatelistener) | Set a CameraStateListener to receive callback when the camera state changed. | -| [`enableEnhancedFeatures`](#enableenhancedfeatures) | Enable the specified enhanced features. View EnumEnhancedFeatures for more details. | -| [`disableEnhancedFeatures`](#disableenhancedfeatures) | Disable the specified enhanced features. View EnumEnhancedFeatures for more details. | -| [`initWithView`](#cameraenhancerviewactivity) | Create an instance of CameraEnhancer. | -| [`init`](#cameraenhancer) | Create an instance of CameraEnhancer. | -| [`setScanRegion`](#setscanregion) | Set a scan region. The video frame is cropped based on the scan region. | -| [`getScanRegion`](#getscanregion) | Get a scan region. | -| [`open`](#open) | Open the camera. | -| [`close`](#close) | Close the camera. | -| [`setResolution`](#setresolution) | Set the resolution. If the targeting resolution is not available for your device, a closest available resolutionll be selected. | -| [`getResolution`](#getresolution) | Get the current resolution. | -| [`getAllCameras`](#getallcameras) | Get the IDs of all available cameras. | -| [`selectCamera`](#selectcamera) | Select a camera with a camera ID. | -| [`selectCamera(position)`](#selectcameraposition) | Select a camera with a camera position. | -| [`getSelectedCamera`](#getselectedcamera) | Get the currently actived camera. | -| [`getFrameRate`](#getframerate) | Get the frame rate. | -| [`turnOnTorch`](#turnontorch) | Turn on the torch. | -| [`turnOffTorch`](#turnofftorch) | Turn off the torch. | -| [`setFocus`](#setfocus) | Set the focus point of interest and trigger an one-off auto-focus. | -| [`setFocus(subsequentFocusMode)`](#setfocussubsequentfocusmode) | 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. | -| [`convertRectToViewCoordinates`](#convertrecttoviewcoordinates) | Convert the coordinates of a [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) under video coordinate system to a CGRect under camera view coordinate system. | -| [`convertPointToViewCoordinates`](#convertpointtoviewcoordinates) | Convert the coordinates of a CGPoint under video coordinate system to another CGPoint under camera view coordinate system. | -| [`setImageCaptureDistanceMode`](#setimagecapturedistancemode) | Set/get the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. | -| [`getImageCaptureDistanceMode`](#getimagecapturedistancemode) | Set/get the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. | -| [`setAutoZoomRange`](#setautozoomrange) | Set the range of auto zoom. | -| [`getAutoZoomRange`](#getautozoomrange) | Get the range of auto zoom. | -| [`cameraView`](#setcameraview) | Set/get the CameraView instance that bind with this CameraEnhancer instance. | - -## Inherited Methods - -The following methods are inherited from superclass [`ImageSourceAdapter`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html) - -| Method | Description | -| ------ | ----------- | -| [`hasNextImageToFetch`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#hasnextimagetofetch) | Determines whether there are more images left to fetch. | -| [`setMaxImageCount`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setmaximagecount) | Set the maximum capability of the Video Buffer. | -| [`getMaxImageCount`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getmaximagecount) | Get the property defines the maximum capability of the Video Buffer. | -| [`setBufferOverflowProtectionMode`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setbufferoverflowprotectionmode) | Sets a mode that determines the action to take when there is a new incoming image and the buffer is full. You can either block the Video Buffer or push out the oldest image and append a new one. | -| [`getBufferOverflowProtectionMode`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getbufferoverflowprotectionmode) | Get the buffer overflow protection mode. | -| [`getImageCount`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getimagecount) | Get the current image count in the Video Buffer. | -| [`isBufferEmpty`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#isbufferempty) | Check whether the Video Buffer is empty. | -| [`setColourChannelUsageType`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setcolourchannelusagetype) | Set the usage type of a color channel in an image. | -| [`getColourChannelUsageType`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getcolourchannelusagetype) | Get the usage type of a color channel in an image. | -| [`startFetching`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#startfetching) | Start fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`stopFetching`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#stopfetching) | Stop fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`getImage`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getimage) | Get an image from the Video Buffer. | -| [`setNextImageToReturn(imageId)`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setnextimagetoreturnimageid) | Specify the next image that is returned by method getImage. | -| [`setNextImageToReturn(imageId,keepInBuffer)`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setnextimagetoreturnimageidkeepinbuffer) | Specify the next image that is returned by method getImage. | -| [`hasImage`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#hasimage) | Check the availability of the specified image. | -| [`addImageToBuffer`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#addimagetobuffer) | Adds an image to the buffer of the adapter. | -| [`clearBuffer`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#clearbuffer) | Clears the image buffer. | -| [`setErrorListener`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#seterrorlistener) | Register an error listener to receive callback when error occurs in the [`ImageSourceAdapter`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html). | - -### CameraEnhancer(lifecycleOwner) - -The constructor. - -```java -CameraEnhancer(@NonNull final LifecycleOwner lifecycleOwner) -``` - -**Parameters** - -`lifecycleOwner`: An implementation of `LifecycleOwner` such as an `AppCompatActivity` object. - -### CameraEnhancer(cameraView, lifecycleOwner) - -The constructor. - -```java -CameraEnhancer(@NonNull CameraView cameraView, @NonNull final LifecycleOwner lifecycleOwner) -``` - -**Parameters** - -`cameraView`: An object of `CameraView`. - -`lifecycleOwner`: An implementation of `LifecycleOwner` such as an `AppCompatActivity` object. - -### addListener - -Add a VideoFrameListener to receive callback when video frames are output. - -```java -void addListener(VideoFrameListener listener){} -``` - -**Parameters** - -`listener`: A delegate object of VideoFrameListener to receive video frame as a ImageData. - -### removeListener - -Remove a VideoFrameListener. - -```java -void removeListener(VideoFrameListener listener){} -``` - -**Parameters** - -`listener`: A delegate object of VideoFrameListener. - -### takePhoto - -Take a photo. - -```java -void takePhoto(PhotoListener listener) throws CameraEnhancerException{} -``` - -**Parameters** - -`photolistener`: A delegate object of PhotoListener to receive the captured photo. - -### getCameraPosition - -Get the camera position. - -```java -EnumCameraPosition getCameraPosition(){} -``` - -**Return Value** - -The camera position. - -### setZoomFactor - -Set the zoom factor of the camera. You can use getCapabilities to check the maximum available zoom factor. - -```java -void setZoomFactor(float factor) throws CameraEnhancerException{} -``` - -**Parameters** - -`factor`: The zoom factor. - -### getZoomFactor - -Get the zoom factor of the camera. - -```java -float getZoomFactor() throws CameraEnhancerException{} -``` - -**Return Value** - -The zoom factor. - -### getFocusMode - -Get the currently actived focus mode. - -```java -EnumFocusMode getFocusMode(){} -``` - -**Return Value** - -The focus mode. - -### initSystemSettingsFromFile - -Initialize system settings from a JSON file. The system settings contain more precise camera control parameters. - -```java -void initSystemSettingsFromFile(String filePath) throws CameraEnhancerException{} -``` - -**Parameters** - -`filePath`: The path of the JSON file. -`error`: A NSError pointer. An error occurs when the file path is not available or the JSON datacludes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the system settings are initialized successfully. - -### initSystemSettings - -Initialize system settings from a JSON string. The system settings contain more precise camera control parameters. - -```java -void initSystemSettings(String jsonString) throws CameraEnhancerException{} -``` - -**Parameters** - -`JsonString`: The JSON string. -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the system settings are initialized successfully. - -### resetSystemSettings - -Reset the system settings to default value. - -```java -void resetSystemSettings(){} -``` - -### initEnhancedSettingsFromFile - -Initialize enhanced settings from a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -void initEnhancedSettingsFromFile(String filePath) throws CameraEnhancerException{} -``` - -**Parameters** - -`filePath`: The JSON string. -`error`: A NSError pointer. An error occurs when the file path is not available or the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the enhanced settings are initialized successfully. - -### initEnhancedSettings - -Initialize enhanced settings from a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -void initEnhancedSettings(String jsonString) throws CameraEnhancerException{} -``` - -**Parameters** - -`JsonString`: The JSON string. -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the enhanced settings are initialized successfully. - -### outputEnhancedSettings - -Output the enhanced settings to a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -String outputEnhancedSettings() throws CameraEnhancerException; -``` - -**Parameters** - -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -The enhanced settings in a JSON string. - -### outputEnhancedSettingsToFile - -Output the enhanced settings to a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -void outputEnhancedSettingsToFile(String filePath) throws CameraEnhancerException; -``` - -**Parameters** - -`file` The path that you want to output the JSON file. -`error` A NSError pointer. An error occurs when the file path is not available. - -**Return Value** - -A bool value that indicates whether the enhanced settings are output successfully. - -### resetEnhancedSettings - -Reset the enhanced settings to default value. - -```java -void resetEnhancedSettings(){} -``` - -### getCapabilities - -Get the device capabilities including zoom factor, ISO, exposure time, etc. - -```java -Capabilities getCapabilities(){} -``` - -**Return Value** - -A [Capabilities](../auxiliary-api/capabilities.md) object. - -### getCameraState - -Tells you whether the camera is open, opening, closing, or closed - each state being represented by a member of the [CameraState]({{ site.dce-enums }}camera-state.html) enumeration. - -```java -EnumCameraState getCameraState(){} -``` - -**Return Value** - -The camera state. - -### setCameraStateListener - -Set a [CameraStateListener](../auxiliary-api/interface-dcecamerastatelistener.md) to receive callback when the camera state changes. - -```java -void setCameraStateListener (CameraStateListener listener){} -``` - -**Parameters** - -`listener`: A delegate object of CameraStateListener to the camera state. - -### enableEnhancedFeatures - -Enable the specified enhanced features. View [EnumEnhancedFeatures]({{ site.dce-enums }}enhanced-features.html?lang=android) to learn about these enhanced features. By default, these enhanced features are all disabled. - -```java -void enableEnhancedFeatures(int enhancedFeatures) throws CameraEnhancerException{} -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `EnumEnhancedFeatures` which indicates a series of enhanced features. - -**Return Value** - -A bool value that indicates whether the enhanced features are enabled successfully. - -### disableEnhancedFeatures - -Disable any enhanced features that have been previously enabled. View [EnumEnhancedFeatures]({{ site.dce-enums }}enhanced-features.html?lang=android) to learn about these enhanced features. - -```java -void disableEnhancedFeatures(int enhancerFeatures){} -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `EnhancedFeatures` which indicates a series of enhanced features. - -### CameraEnhancer(view,activity) - -Create an instance of CameraEnhancer with a [CameraView](../auxiliary-api/dcecameraview.md) object. - -```java -CameraEnhancer(CameraView view, Activity activity){} -``` - -**Parameters** - -`view`: A CameraView instance. -`activity`: An activity object. - -**Return Value** - -An instance of CameraEnhancer. - -### CameraEnhancer - -Create an instance of CameraEnhancer. - -```java -CameraEnhancer(Activity activity){} -``` - -**Return Value** - -An instance of CameraEnhancer. - -### setScanRegion - -Set a scan region. The video frame is cropped based on the scan region. To learn the full code to setting a scan region, please refer to the [scan region](../guide/scan-region.md) article. - -```java -void setScanRegion(DSRect scanRegion) throws CameraEnhancerException{} -``` - -**Parameters** - -`scanRegion`: A [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) object. -`error`: A NSError pointer. An error occurs when the [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) data is invalid. - -**Return Value** - -A bool value that indicates whether the scan region has been successfully set or not. - -**Code Snippet** - -### getScanRegion - -Get the scan region if one has been set. - -```java -DSRect getScanRegion(){} -``` - -**Return Value** - -A [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) object that represent the scan region area. - -### open - -Open the camera. - -```java -void open() throws CameraEnhancerException{} -``` - -### close - -Close the camera. - -```java -void close() throws CameraEnhancerException{} -``` - -### setResolution - -Set the resolution. If the targeted resolution is not available for your device, the closest available resolution will be selected. - -```java -void setResolution(EnumResolution resolution) throws CameraEnhancerException{} -``` - -**Parameters** - -`resolution` One of the EnumResolution value. - -### getResolution - -Get the current resolution. - -```java -Size getResolution(){} -``` - -**Return Value** - -The current resolution. - -### getAvailableResolutions - -Get all available resolutions. - -```java -List getAvailableResolutions(){} -``` - -**Return Value** - -All available resolutions in a list. - -### getAllCameras - -Get the IDs of all available cameras. - -```java -String[] getAllCameras(){} -``` - -**Return Value** - -An array of camera IDs. - -### selectCamera - -Select a camera with a camera ID. - -```java -void selectCamera(String cameraID) throws CameraEnhancerException{} -``` - -**Parameters** - -`position`: One of the Camera IDs. -`error`: A NSError pointer. An error occurs when failed to switch the camera. - -**Return Value** - -A bool value that indicates whether the camera selection is successful. - -### selectCamera(position) - -Select a camera with a camera position. - -```java -selectCamera(EnumCameraPosition position){} -``` - -**Parameters** - -`position`: One of the `EnumCameraPosition` value. -`error`: A NSError pointer. An error occurs when failed to switch the camera. - -**Return Value** - -A bool value that indicates whether the camera selection is successful. - -### getSelectedCamera - -Get the currently actived camera. - -```java -String getSelectedCamera(){} -``` - -**Return Value** - -The ID of the currently actived camera. - -### getFrameRate - -Get the frame rate. - -```java -int getFrameRate(){} -``` - -**Return Value** - -The current frame rate. - -### turnOnTorch - -Turn on the torch. - -```java -void turnOnTorch() throws CameraEnhancerException{} -``` - -### turnOffTorch - -Turn off the torch. - -```java -void turnOffTorch() throws CameraEnhancerException{} -``` - -### setFocus - -Set the focus point of interest and trigger an one-off auto-focus. - -```java -void setFocus(android.graphics.PointF focusPoint) throws CameraEnhancerException{} -``` - -**Parameters** - -`focusPoint`: The focus point of interest. The coordinate base of the point is "image". - -### setFocus(subsequentFocusMode) - -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. - -```java -void setFocus(android.graphics.PointF focusPoint, EnumFocusMode subsequentFocusMode) throws CameraEnhancerException{} -``` - -**Parameters** - -`focusPoint`: The focus point of interest. The coordinate base of the point is "image". -`subsequentFocusMode`: The subsequent focus mode. - -### convertRectToViewCoordinates - -Convert the coordinates of a [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) under video coordinate system to a CGRect under camera view coordinate system. - -```java -android.graphics.Rect convertRectToViewCoordinates(com.dynamsoft.core.basic_structure.DSRect videoRect){} -``` - -**Parameters** - -`videoRect`: The [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) that you want to convert. - -**Return Value** - -A CGRect (coordinate measured in PT) converted from the [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html). - -### convertPointToViewCoordinates - -Convert the coordinates of a CGPoint under video coordinate system to another CGPoint under camera view coordinate system. - -```java -Point convertPointToViewCoordinates(Point point){} -``` - -**Parameters** - -`point`: The CGPoint that you want to convert. - -**Return Value** - -A CGPoint (coordinate measured in PT) converted from the video CGPoint measured in PT. - -### setImageCaptureDistanceMode - -Set the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. - -```java -void setImageCaptureDistanceMode(EnumImageCaptureDistanceMode mode){} -``` - -### getImageCaptureDistanceMode - -Get the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. - -```java -EnumImageCaptureDistanceMode getImageCaptureDistanceMode(){} -``` - -### setAutoZoomRange - -Set the range of auto zoom. - -```java -void setAutoZoomRange(android.util.Range ){} -``` - -**Parameters** - -`zoomRange`: The zoom range of the auto zoom feature. - -### getAutoZoomRange - -Get the range of auto zoom. - -```java -Range getAutoZoomRange(){} -``` - -**Return Value** - -The zoom range of the auto zoom feature. - -### setCameraView - -Bind a `CameraView` instance with this `CameraEnhancer` instance. - -```java -void setCameraView(CameraView view){} -``` diff --git a/programming/android/primary-api/camera-enhancer-v2.6.1003.md b/programming/android/primary-api/camera-enhancer-v2.6.1003.md deleted file mode 100644 index 7fc2ab5..0000000 --- a/programming/android/primary-api/camera-enhancer-v2.6.1003.md +++ /dev/null @@ -1,711 +0,0 @@ ---- -layout: default-layout -title: CameraEnhancer - Dynamsoft Camera Enhancer API Reference -description: The class CameraEnhancer of Dynamsoft Camera Enhancer defines the camera controlling APIs. -keywords: camera enhancer, Java, Kotlin -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true -permalink: /programming/android/primary-api/camera-enhancer.html ---- - -# CameraEnhancer - -The `CameraEnhancer` class is the primary class of Dynamsoft Camera Enhancer that defines the camera controlling APIs. It is a subclass of `ImageSourceAdapter`. - -## Definition - -*Assembly:* package com.dynamsoft.dce - -```java -class CameraEnhancer extends ImageSourceAdapter -``` - -## Methods - -| Method | Description | -|------- |-------------| -| [`CameraEnhancer`](#cameraenhancer) | The constructor. | -| [`CameraEnhancer`](#cameraenhancer) | The constructor. | -| [`addListener`](#addlistener) | Add a VideoFrameListener to receive callback when video frames are output. | -| [`removeListener`](#removelistener) | Remove a VideoFrameListener. | -| [`takePhoto`](#takephoto) | Take a photo. | -| [`getCameraPosition`](#getcameraposition) | Get the camera position. | -| [`setZoomFactor`](#setzoomfactor) | Set the zoom factor of the camera. You can use getCapabilities to check the maximum available zoom factor. | -| [`getZoomFactor`](#getzoomfactor) | Get the zoom factor of the camera. | -| [`getFocusMode`](#getfocusmode) | Get the currently actived focus mode. | -| [`initSystemSettingsFromFile`](#initsystemsettingsfromfile) | Initialize system settings from a JSON file. The system settings contain more precise camera control parameters. | -| [`initSystemSettings`](#initsystemsettings) | Initialize system settings from a JSON string. The system settings contain more precise camera control parameters. | -| [`resetSystemSettings`](#resetsystemsettings) | Reset the system settings to default value. | -| [`initEnhancedSettingsFromFile`](#initenhancedsettingsfromfile) | Initialize enhanced settings from a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`initEnhancedSettings`](#initenhancedsettings) | Initialize enhanced settings from a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`outputEnhancedSettings`](#outputenhancedsettings) | Output the enhanced settings to a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`outputEnhancedSettingsToFile`](#outputenhancedsettingstofile) | Output the enhanced settings to a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`resetEnhancedSettings`](#resetenhancedsettings) | Reset the enhanced settings to default value. | -| [`getCapabilities`](#getcapabilities) | Get the device capabilities including zoom factor, ISO, exposure time, etc. | -| [`getCameraState`](#getcamerastate) | Get the device capabilities including zoom factor, ISO, exposure time, etc. | -| [`setCameraStateListener`](#setcamerastatelistener) | Set a CameraStateListener to receive callback when the camera state changed. | -| [`enableEnhancedFeatures`](#enableenhancedfeatures) | Enable the specified enhanced features. View EnumEnhancedFeatures for more details. | -| [`disableEnhancedFeatures`](#disableenhancedfeatures) | Disable the specified enhanced features. View EnumEnhancedFeatures for more details. | -| [`initWithView`](#cameraenhancerviewactivity) | Create an instance of CameraEnhancer. | -| [`init`](#cameraenhancer) | Create an instance of CameraEnhancer. | -| [`setScanRegion`](#setscanregion) | Set a scan region. The video frame is cropped based on the scan region. | -| [`getScanRegion`](#getscanregion) | Get a scan region. | -| [`open`](#open) | Open the camera. | -| [`close`](#close) | Close the camera. | -| [`setResolution`](#setresolution) | Set the resolution. If the targeting resolution is not available for your device, a closest available resolutionll be selected. | -| [`getResolution`](#getresolution) | Get the current resolution. | -| [`selectCamera(position)`](#selectcameraposition) | Select a camera with a camera position. | -| [`getFrameRate`](#getframerate) | Get the frame rate. | -| [`turnOnTorch`](#turnontorch) | Turn on the torch. | -| [`turnOffTorch`](#turnofftorch) | Turn off the torch. | -| [`setFocus`](#setfocus) | Set the focus point of interest and trigger an one-off auto-focus. | -| [`setFocus(subsequentFocusMode)`](#setfocussubsequentfocusmode) | 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. | -| [`convertRectToViewCoordinates`](#convertrecttoviewcoordinates) | Convert the coordinates of a [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) under video coordinate system to a CGRect under camera view coordinate system. | -| [`convertPointToViewCoordinates`](#convertpointtoviewcoordinates) | Convert the coordinates of a CGPoint under video coordinate system to another CGPoint under camera view coordinate system. | -| [`setImageCaptureDistanceMode`](#setimagecapturedistancemode) | Set/get the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. | -| [`getImageCaptureDistanceMode`](#getimagecapturedistancemode) | Set/get the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. | -| [`setAutoZoomRange`](#setautozoomrange) | Set the range of auto zoom. | -| [`getAutoZoomRange`](#getautozoomrange) | Get the range of auto zoom. | -| [`cameraView`](#setcameraview) | Set/get the CameraView instance that bind with this CameraEnhancer instance. | -| [`getAllCameras`](#getallcameras) | Get the IDs of all available cameras. | -| [`selectCamera`](#selectcamera) | Select a camera with a camera ID. | -| [`getSelectedCamera`](#getselectedcamera) | Get the currently actived camera. | -| [`setZoomFactorChangeListener`](#setzoomfactorchangelistener) | Set a `ZoomFactorChangeListener` to receive callback when the zoom-factor changed. | - -## Inherited Methods - -The following methods are inherited from superclass [`ImageSourceAdapter`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html) - -| Method | Description | -| ------ | ----------- | -| [`hasNextImageToFetch`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#hasnextimagetofetch) | Determines whether there are more images left to fetch. | -| [`setMaxImageCount`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setmaximagecount) | Set the maximum capability of the Video Buffer. | -| [`getMaxImageCount`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getmaximagecount) | Get the property defines the maximum capability of the Video Buffer. | -| [`setBufferOverflowProtectionMode`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setbufferoverflowprotectionmode) | Sets a mode that determines the action to take when there is a new incoming image and the buffer is full. You can either block the Video Buffer or push out the oldest image and append a new one. | -| [`getBufferOverflowProtectionMode`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getbufferoverflowprotectionmode) | Get the buffer overflow protection mode. | -| [`getImageCount`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getimagecount) | Get the current image count in the Video Buffer. | -| [`isBufferEmpty`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#isbufferempty) | Check whether the Video Buffer is empty. | -| [`setColourChannelUsageType`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setcolourchannelusagetype) | Set the usage type of a color channel in an image. | -| [`getColourChannelUsageType`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getcolourchannelusagetype) | Get the usage type of a color channel in an image. | -| [`startFetching`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#startfetching) | Start fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`stopFetching`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#stopfetching) | Stop fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`getImage`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#getimage) | Get an image from the Video Buffer. | -| [`setNextImageToReturn(imageId)`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setnextimagetoreturnimageid) | Specify the next image that is returned by method getImage. | -| [`setNextImageToReturn(imageId,keepInBuffer)`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#setnextimagetoreturnimageidkeepinbuffer) | Specify the next image that is returned by method getImage. | -| [`hasImage`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#hasimage) | Check the availability of the specified image. | -| [`addImageToBuffer`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#addimagetobuffer) | Adds an image to the buffer of the adapter. | -| [`clearBuffer`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#clearbuffer) | Clears the image buffer. | -| [`setErrorListener`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html#seterrorlistener) | Register an error listener to receive callback when error occurs in the [`ImageSourceAdapter`]({{ site.dcv_android_api }}core/basic-structures/image-source-adapter.html). | - -### CameraEnhancer(lifecycleOwner) - -The constructor. - -```java -CameraEnhancer(@NonNull final LifecycleOwner lifecycleOwner) -``` - -**Parameters** - -`lifecycleOwner`: An implementation of `LifecycleOwner` such as an `AppCompatActivity` object. - -### CameraEnhancer(cameraView, lifecycleOwner) - -The constructor. - -```java -CameraEnhancer(@NonNull CameraView cameraView, @NonNull final LifecycleOwner lifecycleOwner) -``` - -**Parameters** - -`cameraView`: An object of `CameraView`. - -`lifecycleOwner`: An implementation of `LifecycleOwner` such as an `AppCompatActivity` object. - -### addListener - -Add a VideoFrameListener to receive callback when video frames are output. - -```java -void addListener(VideoFrameListener listener){} -``` - -**Parameters** - -`listener`: A delegate object of VideoFrameListener to receive video frame as a ImageData. - -### removeListener - -Remove a VideoFrameListener. - -```java -void removeListener(VideoFrameListener listener){} -``` - -**Parameters** - -`listener`: A delegate object of VideoFrameListener. - -### takePhoto - -Take a photo. - -```java -void takePhoto(PhotoListener listener) throws CameraEnhancerException{} -``` - -**Parameters** - -`photolistener`: A delegate object of PhotoListener to receive the captured photo. - -### getCameraPosition - -Get the camera position. - -```java -EnumCameraPosition getCameraPosition(){} -``` - -**Return Value** - -The camera position. - -### setZoomFactor - -Set the zoom factor of the camera. You can use getCapabilities to check the maximum available zoom factor. - -```java -void setZoomFactor(float factor) throws CameraEnhancerException{} -``` - -**Parameters** - -`factor`: The zoom factor. - -### getZoomFactor - -Get the zoom factor of the camera. - -```java -float getZoomFactor() throws CameraEnhancerException{} -``` - -**Return Value** - -The zoom factor. - -### getFocusMode - -Get the currently actived focus mode. - -```java -EnumFocusMode getFocusMode(){} -``` - -**Return Value** - -The focus mode. - -### initSystemSettingsFromFile - -Initialize system settings from a JSON file. The system settings contain more precise camera control parameters. - -```java -void initSystemSettingsFromFile(String filePath) throws CameraEnhancerException{} -``` - -**Parameters** - -`filePath`: The path of the JSON file. -`error`: A NSError pointer. An error occurs when the file path is not available or the JSON datacludes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the system settings are initialized successfully. - -### initSystemSettings - -Initialize system settings from a JSON string. The system settings contain more precise camera control parameters. - -```java -void initSystemSettings(String jsonString) throws CameraEnhancerException{} -``` - -**Parameters** - -`JsonString`: The JSON string. -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the system settings are initialized successfully. - -### resetSystemSettings - -Reset the system settings to default value. - -```java -void resetSystemSettings(){} -``` - -### initEnhancedSettingsFromFile - -Initialize enhanced settings from a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -void initEnhancedSettingsFromFile(String filePath) throws CameraEnhancerException{} -``` - -**Parameters** - -`filePath`: The JSON string. -`error`: A NSError pointer. An error occurs when the file path is not available or the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the enhanced settings are initialized successfully. - -### initEnhancedSettings - -Initialize enhanced settings from a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -void initEnhancedSettings(String jsonString) throws CameraEnhancerException{} -``` - -**Parameters** - -`JsonString`: The JSON string. -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the enhanced settings are initialized successfully. - -### outputEnhancedSettings - -Output the enhanced settings to a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -String outputEnhancedSettings() throws CameraEnhancerException; -``` - -**Parameters** - -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -The enhanced settings in a JSON string. - -### outputEnhancedSettingsToFile - -Output the enhanced settings to a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. - -```java -void outputEnhancedSettingsToFile(String filePath) throws CameraEnhancerException; -``` - -**Parameters** - -`file` The path that you want to output the JSON file. -`error` A NSError pointer. An error occurs when the file path is not available. - -**Return Value** - -A bool value that indicates whether the enhanced settings are output successfully. - -### resetEnhancedSettings - -Reset the enhanced settings to default value. - -```java -void resetEnhancedSettings(){} -``` - -### getCapabilities - -Get the device capabilities including zoom factor, ISO, exposure time, etc. - -```java -Capabilities getCapabilities(){} -``` - -**Return Value** - -A [Capabilities](../auxiliary-api/capabilities.md) object. - -### getCameraState - -Tells you whether the camera is open, opening, closing, or closed - each state being represented by a member of the [CameraState]({{ site.dce-enums }}camera-state.html) enumeration. - -```java -EnumCameraState getCameraState(){} -``` - -**Return Value** - -The camera state. - -### setCameraStateListener - -Set a [CameraStateListener](../auxiliary-api/interface-dcecamerastatelistener.md) to receive callback when the camera state changes. - -```java -void setCameraStateListener (CameraStateListener listener){} -``` - -**Parameters** - -`listener`: A delegate object of CameraStateListener to the camera state. - -### enableEnhancedFeatures - -Enable the specified enhanced features. View [EnumEnhancedFeatures]({{ site.dce-enums }}enhanced-features.html?lang=android) to learn about these enhanced features. By default, these enhanced features are all disabled. - -```java -void enableEnhancedFeatures(int enhancedFeatures) throws CameraEnhancerException{} -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `EnumEnhancedFeatures` which indicates a series of enhanced features. - -**Return Value** - -A bool value that indicates whether the enhanced features are enabled successfully. - -### disableEnhancedFeatures - -Disable any enhanced features that have been previously enabled. View [EnumEnhancedFeatures]({{ site.dce-enums }}enhanced-features.html?lang=android) to learn about these enhanced features. - -```java -void disableEnhancedFeatures(int enhancerFeatures){} -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `EnhancedFeatures` which indicates a series of enhanced features. - -### CameraEnhancer(view,activity) - -Create an instance of CameraEnhancer with a [CameraView](../auxiliary-api/dcecameraview.md) object. - -```java -CameraEnhancer(CameraView view, Activity activity){} -``` - -**Parameters** - -`view`: A CameraView instance. -`activity`: An activity object. - -**Return Value** - -An instance of CameraEnhancer. - -### CameraEnhancer - -Create an instance of CameraEnhancer. - -```java -CameraEnhancer(Activity activity){} -``` - -**Return Value** - -An instance of CameraEnhancer. - -### setScanRegion - -Set a scan region. The video frame is cropped based on the scan region. To learn the full code to setting a scan region, please refer to the [scan region](../guide/scan-region.md) article. - -```java -void setScanRegion(DSRect scanRegion) throws CameraEnhancerException{} -``` - -**Parameters** - -`scanRegion`: A [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) object. -`error`: A NSError pointer. An error occurs when the [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) data is invalid. - -**Return Value** - -A bool value that indicates whether the scan region has been successfully set or not. - -**Code Snippet** - -### getScanRegion - -Get the scan region if one has been set. - -```java -DSRect getScanRegion(){} -``` - -**Return Value** - -A [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) object that represent the scan region area. - -### open - -Open the camera. - -```java -void open() throws CameraEnhancerException{} -``` - -### close - -Close the camera. - -```java -void close() throws CameraEnhancerException{} -``` - -### setResolution - -Set the resolution. If the targeted resolution is not available for your device, the closest available resolution will be selected. - -```java -void setResolution(EnumResolution resolution) throws CameraEnhancerException{} -``` - -**Parameters** - -`resolution` One of the EnumResolution value. - -### getResolution - -Get the current resolution. - -```java -Size getResolution(){} -``` - -**Return Value** - -The current resolution. - -### getAvailableResolutions - -Get all available resolutions. - -```java -List getAvailableResolutions(){} -``` - -**Return Value** - -All available resolutions in a list. - -### selectCamera(position) - -Select a camera with a camera position. - -```java -selectCamera(EnumCameraPosition position){} -``` - -**Parameters** - -`position`: One of the `EnumCameraPosition` value. -`error`: A NSError pointer. An error occurs when failed to switch the camera. - -**Return Value** - -A bool value that indicates whether the camera selection is successful. - -### getFrameRate - -Get the frame rate. - -```java -int getFrameRate(){} -``` - -**Return Value** - -The current frame rate. - -### turnOnTorch - -Turn on the torch. - -```java -void turnOnTorch() throws CameraEnhancerException{} -``` - -### turnOffTorch - -Turn off the torch. - -```java -void turnOffTorch() throws CameraEnhancerException{} -``` - -### setFocus - -Set the focus point of interest and trigger an one-off auto-focus. - -```java -void setFocus(android.graphics.PointF focusPoint) throws CameraEnhancerException{} -``` - -**Parameters** - -`focusPoint`: The focus point of interest. The coordinate base of the point is "image". - -### setFocus(subsequentFocusMode) - -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. - -```java -void setFocus(android.graphics.PointF focusPoint, EnumFocusMode subsequentFocusMode) throws CameraEnhancerException{} -``` - -**Parameters** - -`focusPoint`: The focus point of interest. The coordinate base of the point is "image". -`subsequentFocusMode`: The subsequent focus mode. - -### convertRectToViewCoordinates - -Convert the coordinates of a [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) under video coordinate system to a CGRect under camera view coordinate system. - -```java -android.graphics.Rect convertRectToViewCoordinates(com.dynamsoft.core.basic_structure.DSRect videoRect){} -``` - -**Parameters** - -`videoRect`: The [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html) that you want to convert. - -**Return Value** - -A CGRect (coordinate measured in PT) converted from the [`DSRect`]({{ site.dcv_android_api }}core/basic-structures/rect.html). - -### convertPointToViewCoordinates - -Convert the coordinates of a CGPoint under video coordinate system to another CGPoint under camera view coordinate system. - -```java -Point convertPointToViewCoordinates(Point point){} -``` - -**Parameters** - -`point`: The CGPoint that you want to convert. - -**Return Value** - -A CGPoint (coordinate measured in PT) converted from the video CGPoint measured in PT. - -### setImageCaptureDistanceMode - -Set the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. - -```java -void setImageCaptureDistanceMode(EnumImageCaptureDistanceMode mode){} -``` - -### getImageCaptureDistanceMode - -Get the capture distance property of the video frame. The capture distance property will be recorded by VideoFrameTag. - -```java -EnumImageCaptureDistanceMode getImageCaptureDistanceMode(){} -``` - -### setAutoZoomRange - -Set the range of auto zoom. - -```java -void setAutoZoomRange(android.util.Range ){} -``` - -**Parameters** - -`zoomRange`: The zoom range of the auto zoom feature. - -### getAutoZoomRange - -Get the range of auto zoom. - -```java -Range getAutoZoomRange(){} -``` - -**Return Value** - -The zoom range of the auto zoom feature. - -### setCameraView - -Bind a `CameraView` instance with this `CameraEnhancer` instance. - -```java -void setCameraView(CameraView view){} -``` - -### getAllCameras - -> This method is deprecated. - -Get the IDs of all available cameras. - -```java -String[] getAllCameras(){} -``` - -**Return Value** - -An array of camera IDs. - -### selectCamera - -> This method is deprecated. - -Select a camera with a camera ID. - -```java -void selectCamera(String cameraID) throws CameraEnhancerException{} -``` - -**Parameters** - -`position`: One of the Camera IDs. -`error`: A NSError pointer. An error occurs when failed to switch the camera. - -**Return Value** - -A bool value that indicates whether the camera selection is successful. - -### getSelectedCamera - -> This method is deprecated. - -Get the currently actived camera. - -```java -String getSelectedCamera(){} -``` - -**Return Value** - -The ID of the currently actived camera. - -### setZoomFactorChangeListener - -Set a [`ZoomFactorChangeListener`](../auxiliary-api/interface-zoomfactorchangelistener.md) to receive callback when the zoom-factor changed. - -```java -void setZoomFactorChangeListener(ZoomFactorChangeListener listener); -``` - -**Parameters** - -`listener`: A [`ZoomFactorChangeListener`](../auxiliary-api/interface-zoomfactorchangelistener.md) to receive callback when the zoom-factor changed. diff --git a/programming/ios/primary-api/camera-enhancer-v2.2.3000.md b/programming/ios/primary-api/camera-enhancer-v2.2.3000.md deleted file mode 100644 index f55e25e..0000000 --- a/programming/ios/primary-api/camera-enhancer-v2.2.3000.md +++ /dev/null @@ -1,1056 +0,0 @@ ---- -layout: default-layout -title: DSCameraEnhancer - Dynamsoft Camera Enhancer API Reference -description: The class DSCameraEnhancer of Dynamsoft Camera Enhancer defines the camera controlling APIs. -keywords: camera enhancer, objective-c, swift -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true ---- - -# DSCameraEnhancer - -The `DSCameraEnhancer` class is the primary class of Dynamsoft Camera Enhancer that defines the camera controlling APIs. It is a subclass of `DSImageSourceAdapter`. - -## Definition - -*Assembly:* DynamsoftCameraEnhancer.xcframework - -
->- Objective-C ->- Swift -> ->1. -```objc -@interface DSCameraEnhancer: DSImageSourceAdapter -``` -2. -```swift -class CameraEnhancer : ImageSourceAdapter -``` - -## Methods - -| Method | Description | -|------- |-------------| -| [`addListener`](#addlistener) | Add a DSVideoFrameListener to receive callback when video frames are output. | -| [`removeListener`](#removelistener) | Remove a DSVideoFrameListener. | -| [`takePhoto`](#takephoto) | Take a photo. | -| [`getCameraPosition`](#getcameraposition) | Get the camera position. | -| [`setZoomFactor`](#setzoomfactor) | Set the zoom factor of the camera. You can use getCapabilities to check the maximum available zoom factor. | -| [`getZoomFactor`](#getzoomfactor) | Get the zoom factor of the camera. | -| [`getFocusMode`](#getfocusmode) | Get the currently actived focus mode. | -| [`initSystemSettingsFromFile`](#initsystemsettingsfromfile) | Initialize system settings from a JSON file. The system settings contain more precise camera control parameters. | -| [`initSystemSettings`](#initsystemsettings) | Initialize system settings from a JSON string. The system settings contain more precise camera control parameters. | -| [`resetSystemSettings`](#resetsystemsettings) | Reset the system settings to default value. | -| [`initEnhancedSettingsFromFile`](#initenhancedsettingsfromfile) | Initialize enhanced settings from a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`initEnhancedSettings`](#initenhancedsettings) | Initialize enhanced settings from a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`outputEnhancedSettings`](#outputenhancedsettings) | Output the enhanced settings to a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`outputEnhancedSettingsToFile`](#outputenhancedsettingstofile) | Output the enhanced settings to a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. | -| [`resetEnhancedSettings`](#resetenhancedsettings) | Reset the enhanced settings to default value. | -| [`getCapabilities`](#getcapabilities) | Get the device capabilities including zoom factor, ISO, exposure time, etc. | -| [`getCameraState`](#getcamerastate) | Tells you whether the camera is open, opening, closing, or closed - each state being represented by a member of the [CameraState]({{ site.dce-enums }}camera-state.html?lang=objc,swift) enumeration. | -| [`setCameraStateListener`](#setcamerastatelistener) | Set a DSCameraStateListener to receive callback when the camera state changed. | -| [`enableEnhancedFeatures`](#enableenhancedfeatures) | Enable the specified enhanced features. View DSEnhancedFeatures for more details. | -| [`disableEnhancedFeatures`](#disableenhancedfeatures) | Disable the specified enhanced features. View DSEnhancedFeatures for more details. | -| [`initWithView`](#initwithview) | Create an instance of DSCameraEnhancer. | -| [`init`](#init) | Create an instance of DSCameraEnhancer. | -| [`setScanRegion`](#setscanregion) | Set a scan region. The video frame is cropped based on the scan region. | -| [`getScanRegion`](#getscanregion) | Get a scan region. | -| [`open`](#open) | Open the camera. | -| [`close`](#close) | Close the camera. | -| [`setResolution`](#setresolution) | Set the resolution. If the targeting resolution is not available for your device, a closest available resolutionll be selected. | -| [`getResolution`](#getresolution) | Get the current resolution. | -| [`getAllCameras`](#getallcameras) | Get the IDs of all available cameras. | -| [`selectCamera`](#selectcamera) | Select a camera with a camera ID. | -| [`selectCameraWithPosition`](#selectcamerawithposition) | Select a camera with a camera position. | -| [`getSelectedCamera`](#getselectedcamera) | Get the currently actived camera. | -| [`getFrameRate`](#getframerate) | Get the frame rate. | -| [`turnOnTorch`](#turnontorch) | Turn on the torch. | -| [`turnOffTorch`](#turnofftorch) | Turn off the torch. | -| [`setFocus`](#setfocus) | Set the focus point of interest and trigger an one-off auto-focus. | -| [`setFocus(subsequentFocusMode)`](#setfocussubsequentfocusmode) | 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. | -| [`convertRectToViewCoordinates`](#convertrecttoviewcoordinates) | Convert the coordinates of a [`DSRect`]({{ site.dcv_ios_api }}core/basic-structures/rect.html) under video coordinate system to a CGRect under camera view coordinate system. | -| [`convertPointToViewCoordinates`](#convertpointtoviewcoordinates) | Convert the coordinates of a CGPoint under video coordinate system to another CGPoint under camera view coordinate system. | - -## Attributes - -| Attributes | Type | Description | -| ---------- | ---- | ----------- | -| [`imageCaptureDistanceMode`](#imagecapturedistancemode) | Set/get the capture distance property of the video frame. The capture distance property will be recorded by DSVideoFrameTag. | -| [`autoZoomRange`](#autozoomrange) | Set/get the range of auto zoom. | -| [`cameraView`](#cameraview) | Set/get the DSCameraView instance that bind with this DSCameraEnhancer instance. | - -## Inherited Methods - -The following methods are inherited from base class [`ImageSourceAdapter`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html) - -| Method | Description | -| ------ | ----------- | -| [`startFetching`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#startfetching) | Start fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`stopFetching`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#stopfetching) | Stop fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`getImage`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#getimage) | Get an image from the Video Buffer. | -| [`setNextImageToReturn`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#setnextimagetoreturn) | Specify the next image that is returned by method getImage. | -| [`hasImage`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#hasimage) | Check the availability of the specified image. | -| [`addImageToBuffer`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#addimagetobuffer) | Adds an image to the buffer of the adapter. | -| [`clearBuffer`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#clearbuffer) | Clears the image buffer. | -| [`setErrorListener`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#seterrorlistener) | Registers a [`ImageSourceErrorListener`]({{ site.dcv_ios_api }}core/basic-structures/image-source-error-listener.html) to be used as a callback when an error occurs in the [`ImageSourceAdapter`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html). | - -## Inherited Properties - -The following properties are inherited from base class [`ImageSourceAdapter`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html) - -| Attributes | Type | Description | -| ---------- | ---- | ----------- | -| [`hasNextImageToFetch`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#hasnextimagetofetch) | *BOOL* |Determines whether there are more images left to fetch. | -| [`maxImageCount`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#maximagecount) | *NSUInteger* | The property defines the maximum capability of the Video Buffer. | -| [`bufferOverflowProtectionMode`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#bufferoverflowprotectionmode) | *DSBufferOverflowProtectionMode* | Sets a mode that determines the action to take when there is a new incoming image and the buffer is full. You can either block the Video Buffer or push out the oldest image and append a new one. | -| [`imageCount`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#imagecount) | *NSUInteger* | The property defines current image count in the Video Buffer. | -| [`bufferEmpty`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#bufferempty) | *BOOL* | The read only property indicates whether the Video Buffer is empty. | -| [`colourChannelUsageType`]({{ site.dcv_ios_api }}core/basic-structures/image-source-adapter.html#colourchannelusagetype) | *colourChannelUsageType* | The usage type of a color channel in an image. | - -### addListener - -Add a DSVideoFrameListener to receive callback when video frames are output. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)addListener:(nonnull id)listener NS_SWIFT_NAME(addListener(_:)); -``` -2. -```swift -func addListener(_ listener: DSVideoFrameListener) -``` - -**Parameters** - -`listener`: A delegate object of DSVideoFrameListener to receive video frame as a DSImageData. - -### removeListener - -Remove a DSVideoFrameListener. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)removeListener:(nonnull id)listener NS_SWIFT_NAME(removeListener(_:)); -``` -2. -```swift -func removeListener(_ listener: DSVideoFrameListener) -``` - -**Parameters** - -`listener`: A delegate object of VideoFrameListener. - -### takePhoto - -Take a photo. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)takePhoto:(DSPhotoListener)photoListener; -``` -2. -```swift -func takePhoto(_ photoListener: PhotoListener) -``` - -**Parameters** - -`photolistener`: A delegate object of DSPhotoListener to receive the captured photo. - -### getCameraPosition - -Get the camera position. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (DSCameraPosition)getCameraPosition; -``` -2. -```swift -func getCameraPosition() -> CameraPosition -``` - -**Return Value** - -The camera position. - -### setZoomFactor - -Set the zoom factor of the camera. You can use getCapabilities to check the maximum available zoom factor. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)setZoomFactor:(CGFloat)factor; -``` -2. -```swift -func setZoomFactor(_ factor: CGFloat) -``` - -**Parameters** - -`factor`: The zoom factor. - -### getZoomFactor - -Get the zoom factor of the camera. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (CGFloat)getZoomFactor; -``` -2. -```swift -func getZoomFactor() -> CGFloat -``` - -**Return Value** - -The zoom factor. - -### getFocusMode - -Get the currently actived focus mode. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (DSFocusMode)getFocusMode; -``` -2. -```swift -func getFocusMode() -> FocusMode -``` - -**Return Value** - -The focus mode. - -### initSystemSettingsFromFile - -Initialize system settings from a JSON file. The system settings contain more precise camera control parameters. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)initSystemSettingsFromFile:(NSString*)filePath error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(initSettingsFromFile(_:)); -``` -2. -```swift -func initSystemSettingsFromFile(_ filePath: String) throws -> BOOL -``` - -**Parameters** - -`filePath`: The path of the JSON file. - -`error`: A NSError pointer. An error occurs when the file path is not available or the JSON datacludes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the system settings are initialized successfully. - -### initSystemSettings - -Initialize system settings from a JSON string. The system settings contain more precise camera control parameters. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)initSystemSettings:(NSString*)JsonString error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(initSettings(_:)); -``` -2. -```swift -func initSystemSettings(_ filePath: String) throws -> BOOL -``` - -**Parameters** - -`JsonString`: The JSON string. - -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the system settings are initialized successfully. - -### resetSystemSettings - -Reset the system settings to default value. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)resetSystemSettings; -``` -2. -```swift -func resetSystemSettings() -``` - -### initEnhancedSettingsFromFile - -Initialize enhanced settings from a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)initEnhancedSettingsFromFile:(NSString*)filePath error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(initSettingsFromFile(_:)); -``` -2. -```swift -func initEnhancedSettingsFromFile(_ filePath: String) throws -> BOOL -``` - -**Parameters** - -`filePath`: The JSON string. - -`error`: A NSError pointer. An error occurs when the file path is not available or the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the enhanced settings are initialized successfully. - -### initEnhancedSettings - -Initialize enhanced settings from a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)initEnhancedSettings:(NSString*)JsonString error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(initSettings(_:)); -``` -2. -```swift -func initEnhancedSettings(_ JsonString: String) throws -> BOOL -``` - -**Parameters** - -`JsonString`: The JSON string. - -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -A bool value that indicates whether the enhanced settings are initialized successfully. - -### outputEnhancedSettings - -Output the enhanced settings to a JSON string. The enhanced settings contain auxiliary parameters of enhanced features. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (nullable NSString *)outputEnhancedSettings:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(outputSettings()); -``` -2. -```swift -func outputEnhancedSettings() throws -> String -``` - -**Parameters** - -`error`: A NSError pointer. An error occurs when the JSON data includes invalid keys or values. - -**Return Value** - -The enhanced settings in a JSON string. - -### outputEnhancedSettingsToFile - -Output the enhanced settings to a JSON file. The enhanced settings contain auxiliary parameters of enhanced features. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)outputEnhancedSettingsToFile:(NSString *)file error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(outputSettingsToFile(_:templateName:)); -``` -2. -```swift -func outputEnhancedSettingsToFile(_ file: String) throws -> String -``` - -**Parameters** - -`file` The path that you want to output the JSON file. - -`error` A NSError pointer. An error occurs when the file path is not available. - -**Return Value** - -A bool value that indicates whether the enhanced settings are output successfully. - -### resetEnhancedSettings - -Reset the enhanced settings to default value. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)resetEnhancedSettings; -``` -2. -```swift -func resetEnhancedSettings() -``` - -### getCapabilities - -Get the device capabilities including zoom factor, ISO, exposure time, etc. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (DSCapabilities *)getCapabilities; -``` -2. -```swift -func getCapabilities() -> Capabilities -``` - -**Return Value** - -A [DSCapabilities](../auxiliary-api/capabilities.md) object. - -### getCameraState - -Tells you whether the camera is open, opening, closing, or closed - each state being represented by a member of the [CameraState]({{ site.dce-enums }}camera-state.html?lang=objc,swift) enumeration. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (DSCameraState)getCameraState; -``` -2. -```swift -func getCameraState() -> CameraState -``` - -**Return Value** - -The camera state. - -### setCameraStateListener - -Set a [DSCameraStateListener](../auxiliary-api/protocol-dcecamerastatelistener.md) to receive callback when the camera state changes. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)setCameraStateListener:(nullable id)listener; -``` -2. -```swift -func setCameraStateListener(_ listener: CameraStateListener) -``` - -**Parameters** - -`listener`: A delegate object of DSCameraStateListener to the camera state. - -### enableEnhancedFeatures - -Enable the specified enhanced features. View [DSEnhancedFeatures]({{ site.dce-enums }}enhanced-features.html?lang=objc,swift) to learn about these enhanced features. By default, these enhanced features are all disabled. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (bool)enableEnhancedFeatures:(NSInteger)enhancedFeatures; -``` -2. -```swift -func enableEnhancedFeatures(_ enhancedFeatures: Int) -> BOOL -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `DSEnhancedFeatures` which indicates a series of enhanced features. - -**Return Value** - -A bool value that indicates whether the enhanced features are enabled successfully. - -### disableEnhancedFeatures - -Disable any enhanced features that have been previously enabled. View [DSEnhancedFeatures]({{ site.dce-enums }}enhanced-features.html?lang=objc,swift) to learn about these enhanced features. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)disableEnhancedFeatures:(NSInteger)enhancedFeatures; -``` -2. -```swift -func disableEnhancedFeatures(_ enhancedFeatures: Int) -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `DSEnhancedFeatures` which indicates a series of enhanced features. - -### initWithView - -Create an instance of DSCameraEnhancer with a [DSCameraView](../auxiliary-api/dcecameraview.md) object. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (instancetype)initWithView:(DSCameraView *)view NS_SWIFT_NAME(init(view:)); -``` -2. -```swift -init(view: CameraView) -``` - -**Parameters** - -`view` A DSCameraView instance. - -**Return Value** - -An instance of DSCameraEnhancer. - -### init - -Create an instance of DSCameraEnhancer. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (instancetype)init; -``` -2. -```swift -init() -``` - -**Return Value** - -An instance of DSCameraEnhancer. - -### setScanRegion - -Set a scan region. The video frame is cropped based on the scan region. To learn the full code to setting a scan region, please refer to the [scan region](../guide/scan-region.md) article. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)setScanRegion:(DSRect* _Nullable)scanRegion error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(setScanRegion(_:)); -``` -2. -```swift -func setScanRegion(_ scanRegion: DSRect) -> BOOL -``` - -**Parameters** - -`scanRegion`: A [`DSRect`]({{ site.dcv_ios_api }}core/basic-structures/rect.html) object. - -`error`: A NSError pointer. An error occurs when the [`DSRect`]({{ site.dcv_ios_api }}core/basic-structures/rect.html) data is invalid. - -**Return Value** - -A bool value that indicates whether the scan region has been successfully set or not. - -### getScanRegion - -Get the scan region if one has been set. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (nullable DSRect*)getScanRegion; -``` -2. -```swift -func getScanRegion() -> DSRect -``` - -**Return Value** - -A [`DSRect`]({{ site.dcv_ios_api }}core/basic-structures/rect.html) object that represent the scan region area. - -### open - -Open the camera. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)open; -``` -2. -```swift -func open() -``` - -### close - -Close the camera. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)close; -``` -2. -```swift -func close() -``` - -### setResolution - -Set the resolution. If the targeted resolution is not available for your device, the closest available resolution will be selected. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)setResolution:(DSResolution)resolution; -``` -2. -```swift -func setResolution(_ resolution: Resolution) -``` - -**Parameters** - -`resolution` One of the DSResolution value. - -### getResolution - -Get the current resolution. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (NSString*)getResolution; -``` -2. -```swift -func getResolution() -> Resolution -``` - -**Return Value** - -The current resolution. - -### getAllCameras - -Get the IDs of all available cameras. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (NSArray*)getAllCameras; -``` -2. -```swift -func getAllCameras() -> [String] -``` - -**Return Value** - -An array of camera IDs. - -### selectCamera - -Select a camera with a camera ID. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)selectCamera:(NSString*)cameraId error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(selectCamera(_:)); -``` -2. -```swift -func selectCamera(_ cameraId: String) -> BOOL -``` - -**Parameters** - -`position`: One of the Camera IDs. - -`error`: A NSError pointer. An error occurs when failed to switch the camera. - -**Return Value** - -A bool value that indicates whether the camera selection is successful. - -### selectCameraWithPosition - -Select a camera with a camera position. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (BOOL)selectCameraWithPosition:(DSCameraPosition)position error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NAME(selectCameraWithPosition(_:)); -``` -2. -```swift -func selectCameraWithPosition(_ position: CameraPosition) -> BOOL -``` - -**Parameters** - -`position`: One of the DSCameraPosition value. - -`error`: A NSError pointer. An error occurs when failed to switch the camera. - -**Return Value** - -A bool value that indicates whether the camera selection is successful. - -### getSelectedCamera - -Get the currently actived camera. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (NSString*)getSelectedCamera; -``` -2. -```swift -func getSelectedCamera() -> String -``` - -**Return Value** - -The ID of the currently actived camera. - -### getFrameRate - -Get the frame rate. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (NSInteger)getFrameRate; -``` -2. -```swift -func getFrameRate() -> Int -``` - -**Return Value** - -The current frame rate. - -### turnOnTorch - -Turn on the torch. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)turnOnTorch; -``` -2. -```swift -func turnOnTorch() -``` - -### turnOffTorch - -Turn off the torch. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)turnOffTorch; -``` -2. -```swift -func turnOffTorch() -``` - -### setFocus - -Set the focus point of interest and trigger an one-off auto-focus. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)setFocus:(CGPoint)focusPoint; -``` -2. -```swift -func setFocus(_ focusPoint: CGPoint) -``` - -**Parameters** - -`focusPoint`: The focus point of interest. The coordinate base of the point is "image". - -### setFocus(subsequentFocusMode) - -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. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (void)setFocus:(CGPoint)focusPoint focusMode:(DSFocusMode)subsequentFocusMode; -``` -2. -```swift -func setFocus(_ focusPoint: CGPoint, subsequentFocusMode: FocusMode) -``` - -**Parameters** - -`focusPoint`: The focus point of interest. The coordinate base of the point is "image". - -`subsequentFocusMode`: The subsequent focus mode. - -### convertRectToViewCoordinates - -Convert the coordinates of a [`DSRect`]({{ site.dcv_ios_api }}core/basic-structures/rect.html) under video coordinate system to a CGRect under camera view coordinate system. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (CGRect)convertRectToViewCoordinates:(DSRect)videoRect; -``` -2. -```swift -func convertRectToViewCoordinates(_ videoRect: DSRect) -> CGRect -``` - -**Parameters** - -`videoRect`: The [`DSRect`]({{ site.dcv_ios_api }}core/basic-structures/rect.html) that you want to convert. - -**Return Value** - -A CGRect (coordinate measured in PT) converted from the [`DSRect`]({{ site.dcv_ios_api }}core/basic-structures/rect.html). - -**Code Snippet** - -
->- Objective-C ->- Swift -> ->1. -```objc -CGRect rect = [cameraView convertRectToViewCoordinates:videoRect]; -``` -2. -```swift -let rect = cameraView.convertRectToViewCoordinates(videoRect) -``` - -### convertPointToViewCoordinates - -Convert the coordinates of a CGPoint under video coordinate system to another CGPoint under camera view coordinate system. - -
->- Objective-C ->- Swift -> ->1. -```objc -- (CGPoint)convertPointToViewCoordinates:(CGPoint)point; -``` -2. -```swift -func convertPointToViewCoordinates(_ point: CGPoint) -> CGPoint -``` - -**Parameters** - -`point`: The CGPoint that you want to convert. - -**Return Value** - -A CGPoint (coordinate measured in PT) converted from the video CGPoint measured in PT. - -**Code Snippet** - -
->- Objective-C ->- Swift -> ->1. -```objc -CGPoint convertedPoint = [cameraView convertPointToViewCoordinates:videoPoint]; -``` -2. -```swift -let convertedPoint = cameraView.convertPointToViewCoordinates(point) -``` - -### imageCaptureDistanceMode - -Set/get the capture distance property of the video frame. The capture distance property will be recorded by DSVideoFrameTag. - -
->- Objective-C ->- Swift -> ->1. -```objc -@property (nonatomic, assign) DSImageCaptureDistanceMode imageCaptureDistanceMode; -``` -2. -```swift -var imageCaptureDistanceMode: CGPoint { get set } -``` - -### autoZoomRange - -Set/get the range of auto zoom. - -
->- Objective-C ->- Swift -> ->1. -```objc -@property (nonatomic, assign) UIFloatRange autoZoomRange; -``` -2. -```swift -var autoZoomRange: UIFloatRange { get set } -``` - -### cameraView - -Set/get the DSCameraView instance that bind with this DSCameraEnhancer instance. - -
->- Objective-C ->- Swift -> ->1. -```objc -@property (nonatomic, assign) DSCameraView * cameraView; -``` -2. -```swift -var cameraView: CameraView { get set } -``` diff --git a/programming/maui/api-reference/camera-enhancer-v2.2.3000.md b/programming/maui/api-reference/camera-enhancer-v2.2.3000.md deleted file mode 100644 index c538aac..0000000 --- a/programming/maui/api-reference/camera-enhancer-v2.2.3000.md +++ /dev/null @@ -1,235 +0,0 @@ ---- -layout: default-layout -title: CameraEnhancer Class - Dynamsoft Capture Vision MAUI Edition -description: CameraEnhancer Class of DCV MAUI edition is the class that defines camera controlling APIs. -keywords: Camera, scan region, focus mode, zoom factor -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true ---- - -# CameraEnhancer - -The `CameraEnhancer` class is the primary class of Dynamsoft Camera Enhancer that defines the camera controlling APIs. It is a subclass of `ImageSourceAdapter`. - -## Definition - -*Namespace:* Dynamsoft.CameraEnhancer.Maui - -*Assembly:* Dynamsoft.CaptureVisionRouter.Maui - -```java -class CameraEnhancer : ImageSourceAdapter -``` - -## Methods - -| Method | Description | -|------- |-------------| -| [`CameraEnhancer(CameraView cameraView)`](#cameraenhancercameraview-cameraview) | The constructor. Initialize the `CameraEnhancer` with a `CameraView` instance. | -| [`CameraEnhancer`](#cameraenhancer-1) | The constructor. | -| [`SetCameraView`](#setcameraview) | Set/get the `CameraView` instance that bind with this `CameraEnhancer` instance. | -| [`GetCameraView`](#getcameraview) | Set/get the `CameraView` instance that bind with this `CameraEnhancer` instance. | -| [`Open`](#open) | Open the camera. | -| [`Close`](#close) | Close the camera. | -| [`SetScanRegion`](#setscanregion) | Set a scan region. The video frame is cropped based on the scan region. | -| [`GetScanRegion`](#getscanregion) | Get a scan region. | -| [`EnableEnhancedFeatures`](#enableenhancedfeatures) | Enable the specified enhanced features. View EnumEnhancedFeatures for more details. | -| [`DisableEnhancedFeatures`](#disableenhancedfeatures) | Disable the specified enhanced features. View EnumEnhancedFeatures for more details. | -| [`SelectCamera`](#selectcamera) | Select a camera with a camera position. | -| [`GetCameraPosition`](#getcameraposition) | Select a camera with a camera position. | -| [`SetZoomFactor`](#setzoomfactor) | Set the zoom factor of the camera. | -| [`GetZoomFactor`](#getzoomfactor) | Get the zoom factor of the camera. | -| [`SetFocus`](#setfocus) | 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. | -| [`GetFocusMode`](#getfocusmode) | 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 following methods are inherited from superclass [`ImageSourceAdapter`]({{ site.dcv_maui_api }}core/image-source-adapter.html) - -| Method | Description | -| ------ | ----------- | -| [`StartFetching`]({{ site.dcv_maui_api }}core/image-source-adapter.html#startfetching) | Start fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`StopFetching`]({{ site.dcv_maui_api }}core/image-source-adapter.html#stopfetching) | Stop fetching images from the source to the Video Buffer of ImageSourceAdapter. | -| [`SetMaximumImageCount`]({{ site.dcv_maui_api }}core/image-source-adapter.html#setmaximumimagecount) | Sets the maximum number of images that can be buffered at any time. | -| [`GetMaximumImageCount`]({{ site.dcv_maui_api }}core/image-source-adapter.html#getmaximumimagecount) | Returns the maximum number of images that can be buffered. | -| [`GetImageCount`]({{ site.dcv_maui_api }}core/image-source-adapter.html#getimagecount) | Returns the current number of images in the buffer. | -| [`IsBufferEmpty`]({{ site.dcv_maui_api }}core/image-source-adapter.html#isbufferempty) | Determines whether the buffer is currently empty. | -| [`ClearBuffer`]({{ site.dcv_maui_api }}core/image-source-adapter.html#clearbuffer) | Clears all images from the buffer, resetting the state for new image fetching. | -| [`SetColourChannelUsageType`]({{ site.dcv_maui_api }}core/image-source-adapter.html#setcolourchannelusagetype) | Sets the usage type for color channels in images. | -| [`GetColourChannelUsageType`]({{ site.dcv_maui_api }}core/image-source-adapter.html#getcolourchannelusagetype) | Returns the current usage type for color channels in images. | - -### CameraEnhancer(CameraView cameraView) - -The constructor. Initialize the `CameraEnhancer` with a `CameraView` instance. - -```csharp -CameraEnhancer(CameraView cameraView); -``` - -**Parameters** - -`cameraView`: A [`CameraView`](camera-view.md) instance. - -### CameraEnhancer - -The constructor. - -```csharp -CameraEnhancer(); -``` - -### SetCameraView - -Bind a `CameraView` instance with this `CameraEnhancer` instance. - -```csharp -void SetCameraView(CameraView view); -``` - -### GetCameraView - -Get the `CameraView` object that bind to this `CameraEnhancer`. - -```csharp -CameraView GetCameraView(); -``` - -### Open - -Open the camera. - -```csharp -void Open(); -``` - -### Close - -Close the camera. - -```csharp -void Close(); -``` - -### SetScanRegion - -Set a scan region. The video frame is cropped based on the scan region. To learn the full code to setting a scan region, please refer to the [scan region](../guide/scan-region.md) article. - -```csharp -void SetScanRegion(DMRect scanRegion); -``` - -**Parameters** - -`scanRegion`: A [`DMRect`]({{ site.dcv_maui_api }}core/rect.html) object. - -### GetScanRegion - -Get the scan region if one has been set. - -```csharp -DMRect GetScanRegion(); -``` - -**Return Value** - -A [`DMRect`]({{ site.dcv_maui_api }}core/rect.html) object that represent the scan region area. - -### EnableEnhancedFeatures - -Enable the specified enhanced features. View [EnumEnhancedFeatures]({{ site.dce_maui_api }}enum/enhanced-features.html) to learn about these enhanced features. By default, these enhanced features are all disabled. - -```csharp -void EnableEnhancedFeatures(EnumEnhancedFeatures features); -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `EnumEnhancedFeatures` which indicates a series of enhanced features. - -**Return Value** - -A bool value that indicates whether the enhanced features are enabled successfully. - -### DisableEnhancedFeatures - -Disable any enhanced features that have been previously enabled. View [EnumEnhancedFeatures]({{ site.dce_maui_api }}enum/enhanced-features.html) to learn about these enhanced features. - -```csharp -void DisableEnhancedFeatures(EnumEnhancedFeatures features); -``` - -**Parameters** - -`enhancedFeatures`: A combined value of `EnhancedFeatures` which indicates a series of enhanced features. - -### SelectCamera - -Select a camera with a camera position. - -```csharp -void SelectCamera(EnumCameraPosition cameraPosition); -``` - -**Parameters** - -`cameraPosition`: One of the [`EnumCameraPosition`]({{ site.dce_maui_api }}enum/camera-position.html) value. - -### GetCameraPosition - -Get the current camera position. - -```csharp -EnumCameraPosition GetCameraPosition(); -``` - -**Return Value** - -A `EnumCameraPosition` value that represents the current camera position. - -### SetZoomFactor - -Set the zoom factor of the camera. - -```csharp -void SetZoomFactor(float zoomFactor); -``` - -**Parameters** - -`zoomFactor`: The zoom factor. - -### GetZoomFactor - -Get the zoom factor of the camera. - -```csharp -float GetZoomFactor(); -``` - -**Return Value** - -The zoom factor. - -### SetFocus - -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. - -```csharp -void SetFocus(Point focusPoint, EnumFocusMode subsequentFocusMode); -``` - -**Parameters** - -`focusPoint`: The focus point of interest. The coordinate base of the point is "image". -`subsequentFocusMode`: The subsequent focus mode of type [`EnumFocusMode`]({{ site.dce_maui_api }}enum/focus-mode.html). - -### GetFocusMode - -Get the current focus mode. - -```csharp -EnumFocusMode GetFocusMode(); -``` - -**Return Value** - -A [`EnumFocusMode`]({{ site.dce_maui_api }}enum/focus-mode.html) value that represents the current focus mode. diff --git a/programming/maui/api-reference/camera-view-v2.2.3000.md b/programming/maui/api-reference/camera-view-v2.2.3000.md deleted file mode 100644 index 3738024..0000000 --- a/programming/maui/api-reference/camera-view-v2.2.3000.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -layout: default-layout -title: CameraView Class - Dynamsoft Capture Vision MAUI Edition -description: The CameraView class of DCV MAUI edition is used to display the camera preview and provides UI controlling APIs -keywords: Torch button, scan region mask, scan laser, camera view, ui -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true ---- - -# CameraView - -The `CameraView` class is used to display the camera preview and provides UI controlling APIs. Users can add interactable UI elements on the view. - -## Definition - -*Namespace:* Dynamsoft.CameraEnhancer.Maui - -*Assembly:* Dynamsoft.CaptureVisionRouter.Maui - -```java -class CameraView : View -``` - -## Methods & Properties - -| Method | Description | -|------- |-------------| -| [`CameraView`](#cameraview-1) | The constructor. | - -| Property | Type | Description | -|--------- | ---- |-------------| -| [`TorchButton`](#torchbutton) | *TorchButton* | The property that defines a torch button. User can click the button to turn on/off the torch. | -| [`TorchButtonVisible`](#torchbuttonvisible) | *bool* | The property that defines whether the torch button is visible. | -| [`ScanRegionMaskVisible`](#scanregionmaskvisible) | *bool* | The property that defines whether the scan region mask is visible. | -| [`ScanLaserVisible`](#scanlaservisible) | *bool* | The property that defines whether the scan laser is visible. | - -### CameraView - -The constructor. Create an instance of `CameraView`. - -```csharp -CameraView(); -``` - -### TorchButton - -The property that defines a torch button. User can click the button to turn on/off the torch. View [`TorchButton`]({{ site.dce_maui_api }}torch-button.html) class for how more information about how to configure the torch button. - -```csharp -TorchButton TorchButton { get; set; } -``` - -### TorchButtonVisible - -The property that defines whether the torch button is visible. - -```csharp -bool TorchButtonVisible { get; set; } -``` - -### ScanRegionMaskVisible - -The property that defines whether the scan region mask is visible. - -```csharp -bool ScanRegionMaskVisible { get; set; } -``` - -### ScanLaserVisible - -The property that defines whether the scan laser is visible. - -```csharp -bool ScanLaserVisible { get; set; } -``` diff --git a/programming/maui/api-reference/enum/camera-position-2.2.3000.md b/programming/maui/api-reference/enum/camera-position-2.2.3000.md deleted file mode 100644 index f59c0ca..0000000 --- a/programming/maui/api-reference/enum/camera-position-2.2.3000.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: default-layout -title: EnumCameraPosition - Dynamsoft Capture Vision MAUI Edition -description: The enumeration CameraPosition of DCE MAUI describes the camera position. -keywords: Camera Position, front forward, back forward -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true -breadcrumbText: CameraPosition ---- - -# Enumeration CameraPosition - -`CameraPosition` describes the camera position. - -## Definition - -*Namespace:* Dynamsoft.CameraEnhancer.Maui - -*Assembly:* Dynamsoft.CaptureVisionRouter.Maui - -```csharp -public enum EnumCameraPosition : int -{ - // The back-facing camera. - CP_BACK = 0, - // The front-facing camera. - CP_FRONT = 1 -} -``` diff --git a/programming/maui/api-reference/enum/camera-position.md b/programming/maui/api-reference/enum/camera-position.md index d83144f..6d8dc33 100644 --- a/programming/maui/api-reference/enum/camera-position.md +++ b/programming/maui/api-reference/enum/camera-position.md @@ -32,7 +32,7 @@ public enum EnumCameraPosition : int CP_BACK_ULTRA_WIDE, /** * A back-facing virtual camera. It is a vitural camera that can switch between the wide-angle camera and the ultra-wide-angle camera automatically. - * Supported devices include: iPhone 13 Pro, iPhone 13 Pro Max, iPhone 14 Pro, iPhone 14 Pro Max, iPhone 15 Pro, iPhone 15 Pro Max. + * Supported devices include: iPhone 13 Pro, iPhone 13 Pro Max, and all subsequent Pro and Pro Max models. */ CP_BACK_DUAL_WIDE_AUTO } diff --git a/programming/maui/api-reference/feedback-v2.2.3000.md b/programming/maui/api-reference/feedback-v2.2.3000.md deleted file mode 100644 index e3cfeb5..0000000 --- a/programming/maui/api-reference/feedback-v2.2.3000.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: default-layout -title: Feedback Class - Dynamsoft Capture Vision MAUI Edition -description: Feedback class of DCV MAUI edition provides methods to trigger feedbacks from the hardware, such as vibrate and beep. -keywords: virbrate, beep -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true ---- - -# Feedback - -The `Feedback` class provides methods to trigger feedbacks from the hardware, such as vibrate and beep. - -## Definition - -*Namespace:* Dynamsoft.CameraEnhancer.Maui - -*Assembly:* Dynamsoft.CaptureVisionRouter.Maui - -```java -class Feedback -``` - -## Methods - -| Method | Description | -|------- |-------------| -| [`Vibrate`](#vibrate) | Trigger a vibrate. | -| [`Beep`](#beep) | Trigger a beep. | - -### Vibrate - -Trigger a vibrate. - -```java -static void Vibrate(); -``` - -### Beep - -Trigger a beep. - -```java -static void Beep(); -``` diff --git a/programming/maui/api-reference/torch-button-v2.2.3000.md b/programming/maui/api-reference/torch-button-v2.2.3000.md deleted file mode 100644 index 5d2dbb6..0000000 --- a/programming/maui/api-reference/torch-button-v2.2.3000.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -layout: default-layout -title: TorchButton Class - Dynamsoft Capture Vision MAUI Edition -description: TorchButton class of DCV MAUI edition defines a torch button with its location, size and image. -keywords: Torch button, torch image -needGenerateH3Content: true -needAutoGenerateSidebar: true -noTitleIndex: true ---- - -# TorchButton - -The TorchButton class defines a torch button with its location, size and image. - -## Definition - -*Namespace:* Dynamsoft.CameraEnhancer.Maui - -*Assembly:* Dynamsoft.CaptureVisionRouter.Maui - -```java -class TorchButton -``` - -## Properties - -| Property | Type | Description | -|--------- |------|-------------| -| [`X`](#x) | *double* | The x-coordinate of the torch button. | -| [`Y`](#y) | *double* | The y-coordinate of the torch button. | -| [`Width`](#width) | *double* | The width of the torch button. | -| [`Height`](#height) | *double* | The height of the torch button. | -| [`TorchOnImageSource`](#torchonimagesource) | *ImageSource* | The image source of the torch button when the torch is on. | -| [`TorchOffImageSource`](#torchoffimagesource) | *ImageSource* | The image source of the torch button when the torch is off. | - -### X - -The x-coordinate of the torch button. - -```csharp -double X { get; set; } -``` - -### Y - -The y-coordinate of the torch button. - -```csharp -double Y { get; set; } -``` - -### Width - -The width of the torch button. - -```csharp -double Width { get; set; } -``` - -### Height - -The height of the torch button. - -```csharp -double Height { get; set; } -``` - -### TorchOnImageSource - -The image source of the torch button when the torch is on. - -```csharp -ImageSource? TorchOnImageSource { get; set; } -``` - -### TorchOffImageSource - -The image source of the torch button when the torch is off. - -```csharp -ImageSource? TorchOffImageSource { get; set; } -```