PICTools Programmer's Reference
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
(0)

Detect image skew

1, 8, 24-bit per pixel

SF_SUBCODE_DESPECKLE
(1)

Remove black specks

1-bit per pixel

SF_SUBCODE_REMOVE_LINES
(2)

Remove horizontal and vertical lines

1-bit per pixel

SF_SUBCODE_ROTATE
(3)

Rotate

1, 8, 24-bit per pixel

SF_SUBCODE_MIRROR
(4)

Mirror

1, 8, 24-bit per pixel

SF_SUBCODE_FLIP
(5)

Flip

1, 8, 24-bit per pixel

SF_SUBCODE_NEGATE
(6)

Negate

1, 8, 24-bit per pixel

SF_SUBCODE_DILATE
(7)

Dilate

1, 8, 24-bit per pixel

SF_SUBCODE_ERODE
(8)

Erode

1, 8, 24-bit per pixel

SF_SUBCODE_DIAGONAL_DILATE
(9)

Diagonal dilate

1, 8, 24-bit per pixel

SF_SUBCODE_DIAGONAL_ERODE
(10)

Diagonal erode

1, 8, 24-bit per pixel

SF_SUBCODE_GET_RECTANGLE
(11)

Get a rectangle of pixels from an image

1, 8, 24-bit per pixel

SF_SUBCODE_SMOOTH_ZOOM
(12)

Smoothly double the width and height of an image

1-bit per pixel

SF_SUBCODE_DETECT_BLANK_PAGE
(13)

Blank page detection

1, 8, 24-bit per pixel

SF_SUBCODE_DETECT_BLANK_RECTANGLE
(14)

Blank rectangle detection

1, 8, 24-bit per pixel

SF_SUBCODE_REMOVE_BLOBS
(15)

Blob or hole punch removal

1-bit per pixel

SF_SUBCODE_SCALE
(16)

Scale

1, 8, 24-bit per pixel

SF_SUBCODE_REMOVE_DOT_SHADING
(17)

Remove dot shading

1-bit per pixel

SF_SUBCODE_CORRECT_INVERSE_TEXT
(18)

Correct inverse text

1-bit per pixel

SF_SUBCODE_SMOOTH_OBJECTS
(19)

Smooth objects

1-bit per pixel

SF_SUBCODE_DETECT_NEGATIVE_PAGE
(20)

Detect negative page

1, 8, 24-bit per pixel

SF_SUBCODE_REMOVE_BORDER
(21)

Auto border crop

1, 8, 24-bit per pixel

SF_SUBCODE_REMOVE_COMBS
(23)

Remove combs

1-bit per pixel

SF_SUBCODE_REGISTER
(24)

Register image (adjust margins)

1, 8, 24-bit per pixel

SF_SUBCODE_CORRECT_CONTRAST
(26)

Analyze and correct the brightness and contrast of an image

8, 24-bit per pixel

SF_SUBCODE_COLORDROP
(29)

Drop out or change specified colors

24-bit per pixel

SF_SUBCODE_FILTER
(30)

Apply various types of filtering algorithms

8, 24-bit per pixel

SF_SUBCODE_IMAGEDETERGENT
(31)

Clean up noisy colors

24-bit per pixel

SF_SUBCODE_VIRTUALBULB
(32)

Dropout scanner emulation

24-bit per pixel

SF_SUBCODE_DETECT_COLOR
(33)

Analyze an image to determine if it needs to be saved as color

24-bit per pixel

SF_SUBCODE_AUTO_DESPECKLE
(51)

Analyze and Remove black specks

1-bit per pixel

 

SF_SUBCODE_AUTO_CORRECT_CONTRAST
(52)

Automatically adjust brightness and contrast

8, 24-bit per pixel

SF_SUBCODE_AUTO_REMOVE_HOLEPUNCHES
(53)

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
(58)

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:

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback