Notice: This documentation is archived. For the latest product features and documentation, please visit Dynamsoft Capture Vision Documentation.
Dynamsoft Camera Enhancer JavaScript API Reference
Class CameraEnhancer
Create and Destroy Instances
Name | Description |
---|---|
static createInstance() |
Creates a CameraEnhancer instance. |
dispose() | Releases all resources used by the CameraEnhancer instance. |
disposed | A readonly boolean value indicating whether the CameraEnhancer instance has been disposed. |
Basic Camera Control
Name | Description |
---|---|
static testCameraAccess() |
Tests whether there is an available camera. |
getAllCameras() | Returns information of all available cameras on the device. |
selectCamera() | Chooses a camera as the video source. |
getSelectedCamera() | Returns information about the selected / current camera. |
getCameraState() | Returns the state of the selected camera which could be “opening”, “open” or “closed” |
open() | Turn on the camera to start streaming live video. |
close() | Stops video streaming and releases the camera. |
isOpen() | Returns whether the selected camera is turned on / occupied. |
pause() | Pauses video streaming without releasing the camera. |
isPaused() | Returns whether the video streaming is paused. |
resume() | Resumes video streaming. |
getVideoSettings() | Returns the current video settings. |
updateVideoSettings() | Changes the video input. |
setResolution() | Sets the resolution of the selected camera. |
getResolution() | Returns the resolution of the selected camera. |
getAvailableResolutions() | Returns the resolutions supported by the selected camera. |
ifSaveLastUsedCamera | Returns or sets whether to save the last used camera and resolution. |
videoSrc | Sets or returns the source of the video. |
ifSkipCameraInspection | Whether to opt for an optimal rear camera at the first open() . |
Advanced Camera Control
Name | Description |
---|---|
setFrameRate() | Adjusts the frame rate. |
getFrameRate() | Returns the real-time frame rate. |
turnOnTorch() | Turns on the torch/flashlight if the current camera supports it. |
turnOffTorch() | Turns off the torch/flashlight. |
getZoomSettings() | Returns the zoom settings. |
setZoom() | Zooms the video stream. |
resetZoom() | Resets the zoom level of the video. |
getFocusSettings() | Returns the focus settings. |
setFocus() | Sets how the camera focuses. |
getCapabilities() | Inspects and returns the capabilities of the selected camera. |
getCameraSettings() | Returns the current values for each constrainable property of the selected camera. |
getColorTemperature() | Returns the color temperature of the selected camera. |
setColorTemperature() | Adjusts the color temperature of the selected camera. |
getExposureCompensation() | Returns the exposure compensation index of the selected camera. |
setExposureCompensation() | Sets the exposure compensation index of the selected camera. |
setAutoZoomRange() | Sets the range (minimum to maximum) for zoom when it is done automatically. |
getAutoZoomRange() | Returns the auto zoom range. |
enableEnhancedFeatures() | Enables the specified enhanced features. |
disableEnhancedFeatures() | Disables the specified enhanced features. |
Frame Acquisition
Name | Description |
---|---|
setScanRegion() | Specifies which part of the original video is considered when processing frames. |
getScanRegion() | Returns the scan region. |
fetchImage() | Returns a DCEFrame object which contains the image data of the latest frame from the video input. |
addImageToBuffer() | Adds an DSImageData object to the buffer. |
setImageFetchInterval() | Sets the interval at which fetchImage() is called when continued fetching has started. |
getImageFetchInterval() | Returns the fetch interval. |
startFetching() | Starts to continuously fetch images and put them into the buffer. |
stopFetching() | Stops fetching any more images. |
setMaxImageCount() | Sets the size of the buffer as in how many images can be buffered. |
getMaxImageCount() | Returns the size of the buffer. |
getImageCount() | Returns how many images are in buffer. |
hasImage() | Checks whether an image exists. The image is specified by its id. |
getImage() | Returns a DCEFrame object from the buffer. |
setNextImageToReturn() | Specifies an image by its id to be returned when getImage() is called the next time. |
setBufferOverflowProtectionMode() | Sets a protection mode that determines what happens when the buffer overflows. |
getBufferOverflowProtectionMode() | Returns the buffer protection mode. |
isBufferEmpty() | Returns whether the buffer is empty. |
hasNextImageToFetch() | Checks whether another image can be fetched. In other words, whether the video is still streaming. |
setPixelFormat() | Sets the pixel format of the images returned by getImage() . |
singleFrameMode | Returns or sets whether to enable the singe-frame mode. |
takePhoto() | Invokes the system camera to take a frame with better image quality. |
UI
Name | Description |
---|---|
getCameraView | Returns the CameraView instance used by the CameraEnhancer instance. |
setCameraView | Sets a CameraView instance to be used by the CameraEnhancer instance. |
getVideoEl | Returns the video element used by the CameraView instance. |
convertToPageCoordinates() | Converts coordinates of a point to the coordinates relative to the top left point of the entire document. |
convertToClientCoordinates() | Converts coordinates of a point to the coordinates within the application’s viewport at which the event occurred (as opposed to the coordinate within the page). |
Auxiliary
Name | Description |
---|---|
on() | Attaches an event handler function for a built-in event. |
off() | Removes an event handler. |
offAll() | Removes all event handlers from the specified event. If no event is specified, remove all event handlers. |
detectEnvironment() | Returns a report on the current running environments. |
Class CameraView
Create and Destroy Instances
Name | Description |
---|---|
static createInstance() |
Creates a CameraView instance. |
dispose() | Releases all resources used by the CameraView instance. |
disposed | A readonly boolean value indicating whether the CameraView instance has been disposed. |
getUIElement() | Returns the HTML element that is used by the CameraView instance. |
setUIElement() | Specifies an HTML element for the CameraView instance to use as its UI element. |
Drawing and UI
Name | Description |
---|---|
createDrawingLayer() | Creates a DrawingLayer object and put it in an array of DrawingLayers. |
getDrawingLayer() | Gets the DrawingLayer specified by its ID. |
getAllDrawingLayers() | Returns an array of all DrawingLayer objects. |
deleteUserDefinedDrawingLayer() | Deletes a DrawingLayer object specified by its ID. |
clearUserDefinedDrawingLayers() | Removes all user-defined DrawingLayers. |
clearAllInnerDrawingItems() | Removes all automatically added DrawingItems. |
setTipConfig() | Configures the tip feature. |
getTipConfig() | Returns the configuration of the tip. |
setTipVisible() | Sets whether to show the tip. |
isTipVisible() | Returns whether the tip is visible. |
setVideoFit() | Sets the object-fit CSS property of the video element. |
getVideoFit() | Returns the value of the object-fit CSS property of the video element. |
updateTipMessage() | Updates the message shown in the tip. |
getVisibleRegionOfVideo() | Returns a Region object which specifies which part of the original video is shown in the video element. |
getVideoElement() | Returns the video element used by the CameraView instance. |
setScanRegionMaskStyle() | Sets the drawing style for the scan-region mask. |
getScanRegionMaskStyle() | Returns the drawing style for the scan-region mask. |
setScanRegionMaskVisible() | Sets whether to show the scan-region mask. |
isScanRegionMaskVisible() | Returns whether the scan-region mask is visible. |
setScanLaserVisible() | Sets whether to show the laser that indicates the scanning is going on. |
isScanLaserVisible() | Returns whether the laser is visible. |
Class ImageEditorView
Create and Destroy Instances
Name | Description |
---|---|
static createInstance() |
Creates an ImageEditorView instance. |
dispose() | Releases all resources used by the ImageEditorView instance. |
disposed | A readonly boolean value indicating whether the ImageEditorView instance has been disposed. |
getUIElement() | Returns the HTML element that is used by the ImageEditorView instance. |
setUIElement() | Specifies an HTML element for the ImageEditorView instance to use as its UI element. |
Drawing and UI
Name | Description |
---|---|
createDrawingLayer() | Creates a DrawingLayer object and put it in an array of DrawingLayers. |
getDrawingLayer() | Gets the DrawingLayer specified by its ID. |
getAllDrawingLayers() | Returns an array of all DrawingLayer objects. |
deleteUserDefinedDrawingLayer() | Deletes a DrawingLayer object specified by its ID. |
clearUserDefinedDrawingLayers() | Removes all user-defined DrawingLayers. |
getSelectedDrawingItems() | Returns the selected DrawingItem object(s). |
setOriginalImage() | Sets the image to be drawn on the image editor view. |
getOriginalImage() | Returns the image drawn on the image editor. |
Class CameraEnhancerModule
Name | Description |
---|---|
getVersion() | Returns the version of the CameraEnhancer Module. |
Subordinate Classes
Feedback
Name | Description |
---|---|
beep() | Trigger a beep when the method is called. |
vibrate() | Trigger a vibrate when the method is called. |
DrawingLayer
Name | Description |
---|---|
getId() | Returns the ID of the DrawingLayer . |
addDrawingItems() | Adds DrawingItems to the DrawingLayer . |
getDrawingItems() | Returns all DrawingItems or just some of them based on a filter function. |
setDrawingItems() | Replaces all DrawingItems of the DrawingLayer with new ones. |
hasDrawingItem() | Checks out if a DrawingItem belongs to the layer. |
removeDrawingItems() | Removes DrawingItems from the DrawingLayer. |
clearDrawingItems() | Removes all DrawingItems from the DrawingLayer. |
renderAll() | Renders all DrawingItems , usually required when the style for one or more items is changed. |
setDefaultStyle() | Sets the style for DrawingItems on the layer. |
setVisible() | Shows or hides the DrawingLayer . |
isVisible() | Returns whether the DrawingLayer is visible. |
onSelectionChanged() | An event handler that is triggered when different DrawingItems gets selected/deselected on the DrawingLayer . |
DrawingStyleManager
Name | Description |
---|---|
static createDrawingStyle() |
Creates a new DrawingStyle object and returns its ID. |
static getDrawingStyle() |
Returns the DrawingStyle object specified by its Id. |
static getDrawingStyles() |
Returns all DrawingStyle objects. |
static updateDrawingStyle() |
Updates an existing DrawingStyle specified by its ID. |
DrawingItem
Name | Description |
---|---|
drawingLayerId | Returns the id of a DrawingLayer where the DrawingItem is drawn. |
mediaType | Returns the mediaType of the DrawingItem . |
coordinateBase | Sets or returns the coordinateBase which determines the meaning of the coordinates of the DrawingItem . |
drawingStyleId | Sets or returns the id of the DrawingStyle that applies to the DrawingItem . |
getState() | Returns the state of the DrawingItem . |
on | Adds an event listener to the DrawingItem for the event specified by eventName . |
off | Removes an event listener to the DrawingItem for the event specified by eventName . |
addNote() | Adds a Note to this DrawingItem . |
getNote() | Returns a Note specified by its name. |
hasNote() | Returns whether a Note with the specified name exists on this DrawingItem . |
updateNote() | Updates the content of a Note specified by its name. |
deleteNote() | Deletes a Note specified by its name. |
getAllNotes() | Returns all Notes on the DrawingItem . |
clearNotes() | Deletes all Notes on the DrawingItem . |
Child classes based on DrawingItem
LineDrawingItem
Name | Description |
---|---|
LineDrawingItem() | Constructor of a LineDrawingItem . |
getLine | Returns the LineSegment object the item is based on. |
setLine | Specifies a LineSegment object to be used for drawing the line. |
RectDrawingItem
Name | Description |
---|---|
RectDrawingItem() | Constructor of a RectDrawingItem . |
getRect | Returns the Rect object the item is based on. |
setRect | Specifies a Rect object to be used for drawing the item. |
QuadDrawingItem
Name | Description |
---|---|
QuadDrawingItem() | Constructor of a QuadDrawingItem . |
getQuad | Returns the Quadrilateral object the item is based on. |
setQuad | Specifies a Quadrilateral object to be used for drawing the item. |
TextDrawingItem
Name | Description |
---|---|
TextDrawingItem() | Constructor of a TextDrawingItem . |
getText | Returns the text drawn. |
setText | Specifies the text to draw. |
getTextRect | Returns the Rect object which determines where the text is drawn. |
setTextRect | Specifies a Rect object in which the text is drawn. |
ImageDrawingItem
Name | Description |
---|---|
ImageDrawingItem() | Constructor of an ImageDrawingItem . |
getImage | Returns the image drawn. |
setImage | Specifies the image to draw. |
getImageRect | Returns the Rect object which determines where the image is drawn. |
setImageRect | Specifies a Rect object in which the image is drawn. |
Interfaces
- DCEFrame
- DrawingItemEvent
- DrawingStyle
- Note
- PlayCallbackInfo
- Resolution
- Point
- Region
- TipConfig
- VideoDevice
- VideoFrameTag