Operations > OP_SCANFIX |
OP_SCANFIX: Document Image Enhancement
The purpose of OP_SCANFIX is to assemble a common set of image enhancement and cleanup routines into a simple low level interface scheme for general availability. These image enhancement routines will be focused on the document imaging industry (textual documents, forms of various types, etc.), but will also be applicable to images outside this domain. This opcode will be a dynamic vehicle for improving images digitally. As requirements dictate, newer features will be added here to fix deficiencies typically encountered with document images.
The SCANFIX:OP_SCANFIX section of PIC_PARM contains one parameter, subcode, that delineates which OP_SCANFIX operation to be employed. Depending on the operation, other parameters will be noted appropriately for additional control features. The following table outlines the current feature set of OP_SCANFIX. Additional details can be found in the structure parameters section of this document.
Subcode |
Operation |
Image Types |
SF_SUBCODE_DETECT_SKEW |
Detect image skew |
1, 8, 24-bit per pixel |
SF_SUBCODE_DESPECKLE |
Remove black specks |
1-bit per pixel |
SF_SUBCODE_REMOVE_LINES |
Remove horizontal and vertical lines |
1-bit per pixel |
SF_SUBCODE_ROTATE |
Rotate |
1, 8, 24-bit per pixel |
SF_SUBCODE_MIRROR |
Mirror |
1, 8, 24-bit per pixel |
SF_SUBCODE_FLIP |
Flip |
1, 8, 24-bit per pixel |
SF_SUBCODE_NEGATE |
Negate |
1, 8, 24-bit per pixel |
SF_SUBCODE_DILATE |
Dilate |
1, 8, 24-bit per pixel |
SF_SUBCODE_ERODE |
Erode |
1, 8, 24-bit per pixel |
SF_SUBCODE_DIAGONAL_DILATE |
Diagonal dilate |
1, 8, 24-bit per pixel |
SF_SUBCODE_DIAGONAL_ERODE |
Diagonal erode |
1, 8, 24-bit per pixel |
SF_SUBCODE_GET_RECTANGLE |
Get a rectangle of pixels from an image |
1, 8, 24-bit per pixel |
SF_SUBCODE_SMOOTH_ZOOM |
Smoothly double the width and height of an image |
1-bit per pixel |
SF_SUBCODE_DETECT_BLANK_PAGE |
Blank page detection |
1, 8, 24-bit per pixel |
SF_SUBCODE_DETECT_BLANK_RECTANGLE |
Blank rectangle detection |
1, 8, 24-bit per pixel |
SF_SUBCODE_REMOVE_BLOBS |
Blob or hole punch removal |
1-bit per pixel |
SF_SUBCODE_SCALE |
Scale |
1, 8, 24-bit per pixel |
SF_SUBCODE_REMOVE_DOT_SHADING |
Remove dot shading |
1-bit per pixel |
SF_SUBCODE_CORRECT_INVERSE_TEXT |
Correct inverse text |
1-bit per pixel |
SF_SUBCODE_SMOOTH_OBJECTS |
Smooth objects |
1-bit per pixel |
SF_SUBCODE_DETECT_NEGATIVE_PAGE |
Detect negative page |
1, 8, 24-bit per pixel |
SF_SUBCODE_REMOVE_BORDER |
Auto border crop |
1, 8, 24-bit per pixel |
SF_SUBCODE_REMOVE_COMBS |
Remove combs |
1-bit per pixel |
SF_SUBCODE_REGISTER |
Register image (adjust margins) |
1, 8, 24-bit per pixel |
SF_SUBCODE_CORRECT_CONTRAST |
Analyze and correct the brightness and contrast of an image |
8, 24-bit per pixel |
SF_SUBCODE_COLORDROP |
Drop out or change specified colors |
24-bit per pixel |
SF_SUBCODE_FILTER |
Apply various types of filtering algorithms |
8, 24-bit per pixel |
SF_SUBCODE_IMAGEDETERGENT |
Clean up noisy colors |
24-bit per pixel |
SF_SUBCODE_VIRTUALBULB |
Dropout scanner emulation |
24-bit per pixel |
SF_SUBCODE_DETECT_COLOR |
Analyze an image to determine if it needs to be saved as color |
24-bit per pixel |
SF_SUBCODE_AUTO_DESPECKLE |
Analyze and Remove black specks |
1-bit per pixel
|
SF_SUBCODE_AUTO_CORRECT_CONTRAST |
Automatically adjust brightness and contrast |
8, 24-bit per pixel |
SF_SUBCODE_AUTO_REMOVE_HOLEPUNCHES |
Automatically remove hole punches |
1-bit per pixel |
SF_SUBCODE_AUTO_CORRECT_INVERSE_TEXT(54) |
Automatically correct inverse text |
1-bit per pixel |
SF_SUBCODE_AUTO_COLOR_DESPECKLE (55) |
Analyze and Remove specks and texture from color and grayscale document images | 8, 24-bit per pixel |
SF_SUBCODE_AUTO_ORIENT_DETECT |
Automatically find page orientation |
1-bit per pixel |
SF_SUBCODE_AUTO_REMOVE_DOT_SHADING (59) |
Remove dot shading (automatic algorithm) | 1-bit per pixel |
Unlike most other opcodes, this opcode allows the Get and Put queues to reference the same locations in RAM for some operations (most 1-bit operations, some 8 and 24 bit). Many of the subcodes are specially optimized for this case to reduce RAM consumption.
The following criteria must be met to benefit from this RAM optimization:
For all subcodes accepting 1-bit per pixel images, the palette of the image should contain two entries. One must be white, and the other must be black or REQ_INIT will fail. All subcodes will operate correctly regardless of the order of the palette entries.
The following sections provide information about each of the OP_SCANFIX subcodes: