Chapter Contents

Previous

Next
Image Data Model:_filter

Image Data Model:_filter



Applies a filter to an image


Syntax
Details
Example

Syntax

CALL SEND (imgdat_id, '_filter', filter-type, matrix);

Argument Type Description
filter-type
C must be specified as
'CONVOLUTION'
Other filter types will be added in the future.
matrix C contains the matrix size, the filter matrix, the divisor, the bias, and 1 if you want to use the absolute value of the resulting value. If not specified, the defaults are 1 for divisor, 0 for bias, and 0 for not using the absolute value. Separate each number with a space.


Details

The FILTER command supports user-provided convolution filters. A filter matrix is moved along the pixels in an image, and a new pixel value is calculated and replaced at the pixel that is at the center point of the filter matrix. The new value is determined by weighting nearby pixels according to the values in the filter matrix.

A detailed explanation of the concept and theory behind filtering is beyond the scope of this help. However, it is explained in many text books. For example, see Digital Image Processing, by Rafael Gonzalez and Paul Wintz, and The Image Processing Handbook, by John C. Russ.

Calculating New Pixel Values

Use the following equation to calculate new pixel values:

[IMAGE]


Example

Consider the following 3x3 matrix:

-1 -2 -3
 4  5  6
-7  8 -9

Design the matrix with a divisor of 1 and a zero bias, and use the absolute value of the answer:

matrix='3 -1 -2 -3 4 5 6 -7 8 -9 1 0 1';
CALL SEND (imgdat_id, '_filter', 'CONVOLUTION', matrix);

Note:   Normally, calculated values that are larger than 255 and smaller than zero are normalized to 255 or zero. If 1 is set for 'absolute value', then negative numbers are first converted to positive numbers.

A filter selection and creation window is available. An example of using it is in the image sample catalog (imagedmo) named FILTEXAM.FRAME. It is essentially the same window that is used in the Image Editor. It accesses the filters that are shipped with the Image Editor.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

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