Chapter Contents

Previous

Next
THRESHOLD

THRESHOLD



Converts a color image to black and white, using a threshold value


Syntax
Details

Syntax

rc=IMGOP(task-id, 'THRESHOLD', value);

value
is a threshold value for converting standard RGB values to monochrome. Value can be:
1...255 sets the threshold that determines whether a color maps to black or white
0 defaults to 128
-1 calculates the threshold value by averaging all pixels in the image.

Type: Numeric


Details

The THRESHOLD command acts on either the currently selected image or on the image specified by task-id. It enables documents that are scanned in color to be converted to monochrome for applying optical character recognition (OCR) and for other purposes. Dithering is not a good technique for converting images when OCR is used.

The threshold is a color value that acts as a cut-off point for converting colors to black and white. All colors greater than the threshold value map to white, and all colors less than or equal to the threshold value map to black.

The algorithm weights the RGB values, using standard intensity calculations for converting color to gray scale.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.