Table of contents

ImageProcessor

The ImageProcessor class is a utility class for applying advanced processing on images.

Definition

Package: com.dynamsoft.utility

public class ImageProcessor

Methods

Method Description
ImageProcessor Initializes a new instance of the ImageProcessor class.
adjustBrightness Adjusts the brightness of the image.
adjustContrast Adjusts the contrast of the image.
convertToBinaryGlobal Converts the grayscale image to binary image using a global threshold.
convertToBinaryLocal Converts the grayscale image to binary image using local (adaptive) binarization.
convertToGray Converts colour image to grayscale.
cropImage Crops an image.
cropAndDeskewImage Crops and deskews a region from the input image based on the specified quadrilateral.
filterImage Applies a specified image filter to an input image and returns the filtered result.

ImageProcessor

Initializes a new instance of the ImageProcessor class.

ImageProcessor()

adjustBrightness

Adjusts the brightness of the image.

ImageData adjustBrightness(ImageData imageData, int brightness)

Parameters

imageData The image data to be processed.

brightness Brightness adjustment value (positive values increase brightness, negative values decrease brightness). The value range is [-100, 100]

Return value

Returns an ImageData object representing the processed image.

See Also

ImageData

adjustContrast

Adjusts the contrast of the image.

ImageData adjustContrast(ImageData imageData, int contrast)

Parameters

imageData The image data to be processed.

contrast Contrast adjustment value (positive values enhance, negative values reduce contrast). The value range is [-100, 100]

Return value

Returns an ImageData object representing the processed image.

See Also

ImageData

convertToBinaryGlobal

Converts an input image to a binary image using a global threshold. Supports grayscale, color, and binary input images (color images are internally converted to grayscale before thresholding).

ImageData convertToBinaryGlobal(ImageData imageData)
ImageData convertToBinaryGlobal(ImageData imageData, int threshold, boolean invert)

Parameters

imageData Input image (grayscale, color, or binary).

threshold Global threshold for binarization. If set to -1 (default), the function will automatically compute an optimal threshold.

invert If true, invert the output binary image.

Return value

Returns an ImageData object representing the binarized image.

See Also

ImageData

convertToBinaryLocal

Converts an input image to a binary image using local (adaptive) thresholding. Supports grayscale, color, and binary input images (color images are internally converted to grayscale before thresholding).

ImageData convertToBinaryLocal(ImageData imageData)
ImageData convertToBinaryLocal(ImageData imageData, int blockSize, int compensation, boolean invert)

Parameters

imageData Input image (grayscale, color, or binary).

blockSize Size of the local block used for adaptive thresholding. If set to 0 (default), a suitable block size will be chosen automatically.

compensation Adjustment value applied to the computed local threshold (default 10).

invert If true, invert the output binary image (default false).

Return value

Returns an ImageData object representing the locally binarized image.

See Also

ImageData

Remarks

Changed default value of compensation parameter from 0 to 10 in Dynamsoft Barcode Reader SDK version 11.4.1000 and Dynamsoft Capture Vision version 3.4.1000.

convertToGray

Converts colour image to grayscale.

ImageData convertToGray(ImageData imageData)
ImageData convertToGray(ImageData imageData, float R, float G, float B)

Parameters

imageData The image data to be processed.

R Weight for red channel.

G Weight for green channel.

B Weight for blue channel.

Return value

Returns an ImageData object representing the processed image.

See Also

ImageData

cropImage

Crops an image.

ImageData cropImage(ImageData imageData, Rect rect) throws UtilityException
@Deprecated
ImageData cropImage(ImageData imageData, Quadrilateral quad) throws UtilityException

Parameters

imageData The image data to be cropped.

rect The rectangular region to crop.

quad The quadrilateral region to crop.

Return value

Returns an ImageData object representing the processed image.

Exception

UtilityException

See Also

ImageData

Rect

Quadrilateral

Remarks

cropImage with Quadrilateral is announced as deprecated since version 3.0.4000. Use cropAndDeskewImage instead.

cropAndDeskewImage

Crops and deskews a region from the input image based on the specified quadrilateral.

ImageData cropAndDeskewImage(ImageData imageData, Quadrilateral quad) throws UtilityException
ImageData cropAndDeskewImage(ImageData imageData, Quadrilateral quad, int dstWidth, int dstHeight, int padding) throws UtilityException

Parameters

imageData The image data to be processed.

quad The quadrilateral shape to crop and deskew.

dstWidth The desired width of the output image.

dstHeight The desired height of the output image.

padding The padding around the cropped area.

Return value

Returns an ImageData object representing the processed image.

Exception

UtilityException

Remarks

The function will automatically calculate the perspective transform matrix and use it to crop the image.
If the specified quadrilateral exceeds the image boundaries, white will be used to fill the exceeding area.

See Also

ImageData

Quadrilateral

filterImage

Applies a specified image filter to an input image and returns the filtered result.

ImageData filterImage(ImageData imageData, @EnumFilterType int filterType)

Parameters

imageData The image data to be processed.

filterType The type of filter to apply.

Return value

Returns an ImageData object representing the processed image.

See Also

ImageData

EnumFilterType

This page is compatible for: