Documentation
Table of contents

GrayscaleEnhancementModes

Parameter GrayscaleEnhancementModes provides some image processing methods to enhance the quality of the grayscale image. By default, the library does no image preprocessing. Assume your image has distorted features that can be solved by common image processing methods, this parameter can help you get a higher quality grayscale image by shifting the order of the preprocessing algorithms used (if at all).

Example

{
    "GrayscaleEnhancementModes": [
        {
            "Mode": "GEM_GRAY_EQUALIZE", 
            "Sensitivity": 1
        },
        {
            "Mode": "GEM_GRAY_SMOOTH", 
            "SmoothBlockSizeX": 5,
            "SmoothBlockSizeY": 5
        },
        {
            "Mode": "GEM_SHARPEN_SMOOTH", 
            "SmoothBlockSizeX": 5,
            "SmoothBlockSizeY": 5,
            "SharpenBlockSizeX": 5,
            "SharpenBlockSizeY": 5
        }
    ]
}

Parameter Summary

Parameter GrayscaleEnhancementModes consist of a group of grayscale enhancement mode objects. Each grayscale enhancement mode object includes a candidate mode and a series of mode arguments. The mode arguments of the grayscale enhancement mode object is shown as follow:

Mode Arguments

Mode Argument Name Mode Argument Summary
Mode
(Required)
Description
Any one in Candidate Mode List as string
Type
String
Candidate Mode List
GEM_GENERAL
GEM_GRAY_EQUALIZE
GEM_GRAY_SMOOTH
GEM_SHARPEN_SMOOTH
GEM_SKIP
Default Value
GEM_GENERAL
Sensitivity
(Optional)
Description
Sets the sensitivity to perform the equalization process. A larger value means a higher possibility that gray equalization will be activated.
Type
int
Range
[1,9]
Default Value
5
Valid For
GEM_GRAY_EQUALIZE
SmoothBlockSizeX
(Optional)
Description
Sets the horizontal block size(neighborhood pixel counts) for the smoothing process.
Type
int
Range
[3,1000]
Default Value
3
Valid For
GEM_GRAY_SMOOTH
GEM_SHARPEN_SMOOTH
SmoothBlockSizeY
(Optional)
Description
Sets the vertical block size(neighborhood pixel counts) for the smoothing process.
Type
int
Range
[3,1000]
Default Value
3
Valid For
GEM_GRAY_SMOOTH
GEM_SHARPEN_SMOOTH
SharpenBlockSizeX
(Optional)
Description
Sets the horizontal block size(neighborhood pixel counts) for the sharpening process.
Type
int
Range
[3,1000]
Default Value
3
Valid For
GEM_SHARPEN_SMOOTH
SharpenBlockSizeY
(Optional)
Description
Sets the vertical block size(neighborhood pixel counts) for the sharpening process.
Type
int
Range
[3,1000]
Default Value
3
Valid For
GEM_SHARPEN_SMOOTH
LibraryFileName
(Optional)
Description
Sets the file name of the library to load dynamically.
Type
String
Range
A string value representing file name.
Default Value
""
Valid For
All modes.
LibraryParameters
(Optional)
Description
The library must be in the same place with Dynamsoft Barcode Reader Library.
Type
String
Range
A string value representing parameters.
Default Value
""
Valid For
All modes.

Default Setting

If the GrayscaleEnhancementModes is not configured in your template file, the following settings will be used as the default settings.

{
    "GrayscaleEnhancementModes" : 
    [
        {
            "Mode" : "GEM_GENERAL",
            "Sensitivity" : -1,
            "SharpenBlockSizeX" : -1,
            "SharpenBlockSizeY" : -1,
            "SmoothBlockSizeX" : -1,
            "SmoothBlockSizeY" : -1
        }
    ]
}

Candidate Modes Introduction

GEM_GENERAL

Takes the un-preprocessed grayscale image for the next stage of operations.

GEM_GRAY_EQUALIZE

Preprocesses the grayscale image using the gray equalization algorithm. This mode can be used for images with low contrast between content and background colour.

Available Mode Arguments:

  • Sensitivity

GEM_GRAY_SMOOTH

Preprocesses the grayscale image using the gray smoothing algorithm. This mode can be used for for images with noise or texture.

Available Mode Arguments:

  • SmoothBlockSizeX
  • SmoothBlockSizeY

GEM_SHARPEN_SMOOTH

Preprocesses the grayscale image using the sharpening and smoothing algorithm. This mode can be used for blurry images.

Available Mode Arguments:

  • SmoothBlockSizeX
  • SmoothBlockSizeY
  • SharpenBlockSizeX
  • SharpenBlockSizeY

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version (2.2.20)
    • Version 2.x
      • Version 2.2.10
      • Version 2.2.0
      • Version 2.0.30
      • Version 2.0.20
      • Version 2.0.10
      • Version 2.0.0
    Change +
    © 2003–2024 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support