ImageProcessor
The ImageProcessor class is a utility class for applying advanced processing on images.
Definition
Namespace: Dynamsoft.Utility
class ImageProcessor : IDisposable
Methods
| Method | Description |
|---|---|
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. |
AdjustBrightness
Adjusts the brightness of the image.
ImageData AdjustBrightness(ImageData imageData, int brightness)
Parameters
[in] imageData The image data to be processed.
[in] 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
AdjustContrast
Adjusts the contrast of the image.
ImageData AdjustContrast(ImageData imageData, int contrast)
Parameters
[in] imageData The image data to be processed.
[in] 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
ConvertToBinaryGlobal
Converts the grayscale image to binary image using a global threshold.
ImageData ConvertToBinaryGlobal(ImageData imageData, int threshold = -1, bool invert = false)
Parameters
[in] imageData The image data to be processed.
[in] threshold Global threshold for binarization(default is -1, automatic calculate the threshold).
[in] invert If true, invert the binary image (black becomes white and white becomes black).
Return value
Returns an ImageData object representing the processed image.
See Also
ConvertToBinaryLocal
Converts the grayscale image to binary image using local (adaptive) binarization.
ImageData ConvertToBinaryLocal(ImageData imageData, int blockSize = 0, int compensation = 0, bool invert = false)
Parameters
[in] imageData The image data to be processed.
[in] blockSize Size of the block for local binarization(default is 0).
[in] compensation Adjustment value to modify the threshold (default is 0).
[in] invert If true, invert the binary image (black becomes white and white becomes black).
Return value
Returns an ImageData object representing the processed image.
See Also
ConvertToGray
Converts colour image to grayscale.
ImageData ConvertToGray(ImageData imageData, float R = 0.3f, float G = 0.59f, float B = 0.11f)
Parameters
[in] imageData The image data to be processed.
[in] R Weight for red channel.
[in] G Weight for green channel.
[in] B Weight for blue channel.
Return value
Returns an ImageData object representing the processed image.
See Also
CropImage
Crops an image.
ImageData CropImage(ImageData imageData, Rect rect, out int errorCode);
//Announced as deprecated. Use CropAndDeskewImage instead.
ImageData CropImage(ImageData imageData, Quadrilateral quad, out int errorCode);
Parameters
[in] imageData The image data to be cropped.
[in] rect The rectangle to be cropped.
[in] quad The quadrilateral to be cropped.
[out] errorCode The error code.
Return value
Returns an ImageData object representing the cropped image.
See Also
CropAndDeskewImage
Crops and deskews a region from the input image based on the specified quadrilateral.
ImageData CropAndDeskewImage(ImageData imageData, Quadrilateral quad, int dstWidth = 0, int dstHeight = 0, int padding = 0)
ImageData CropAndDeskewImage(ImageData imageData, Quadrilateral quad, int dstWidth, int dstHeight, int padding, out int errorCode)
Parameters
[in] imageData The source image to be cropped and deskewed.
[in] quad A quadrilateral defining the region of interest to extract.
[in] dstWidth (Optional) The width of the output image. If set to 0, the width and height will be automatically calculated.
[in] dstHeight (Optional) The height of the output image. If set to 0, the width and height will be automatically calculated.
[in] padding (Optional) Extra padding (in pixels) applied to expand the boundaries of the extracted region. Default is 0.
[out] errorCode The error code.
Return value
Returns an ImageData object representing the cropped image.
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
FilterImage
Applies a specified image filter to an input image and returns the filtered result.
ImageData FilterImage(ImageData imageData, EnumFilterType filterType)
Parameters
[in] imageData The image data to be processed.
[in] filterType Specifies the type of filter to apply to the input image.
Return value
Returns an ImageData object representing the processed image.
See Also