IPWRITE_FILTER Function (PV-WAVE Extreme Advantage)

Saves a 2D convolution kernel to an ASCII text file.

Usage

status = IPWRITE_FILTER(kernel, filename)

Input Parameters

kernel—A 2D array containing the convolution kernel to be saved.

filename—A scalar string containing the name of the kernel file.

Returned Value

status—A scalar value indicating the success of the write operation. Expected values are:

1—Indicates a successful write.

0—Indicates an error such as an invalid filename.

Keywords

Comment—A scalar string or an array of comment strings to be printed at the top of the kernel file.

Scale—The scale factor to apply to the filter kernel. (Default: 1.0)

Discussion

There are many filter files provided with the Image Processing Toolkit. The files are located in the following directories:

ip-1_0/data/kernel/*.ker
ip-1_0/data/filter/*.flt

ip-1_0\data\kernel\*.ker
ip-1_0\data\filter\*.flt

The file format for the spatial filter files provided and for user-written spatial filter files must conform to the following conventions:

Comments begin with a semicolon.

The first un-commented line in the file is data type of the filter weight. This line is one of the following valid strings: 'byte', 'int', 'long', 'float', or 'double'.

The next un-commented line contains the dimensions of the kernel, with the x-dimension listed first, followed by the y-dimension.

Next is the list of space and/or line feed-separated kernel values.

Finally, the scale factor, if present, appears. The scale factor is a floating point value.

The format for spectral filters is simply the associative array passed to the routine and saved in XDR format.

Example 1

; Create and save a spatial Gaussian filter.
gauss = GAUSS_KERNEL(5, 5)
status = IPWRITE_FILTER(gauss, 'gauss_5.ker')

Example 2

; Create and save an ideal lowpass filter.
lpf = FILT_FREQ(30, /Low, Xdim = 300, Ydim = 300)
status = IPWRITE_FILTER(lpf, 'lpf_300.flt')

See Also

IPCREATE_FILTER,  IPREAD_FILTER