NAME
Butterworth_Band_Reject - performs Butterworth band reject
filtering
SYNOPSIS
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "CVIPdef.h"
#include "CVIPimage.h"
Image *Butterworth_Band_Reject(Image *in_Image, int
block_size, int dc, int inner, int outer, int order)
<in_Image> - pointer to an Image structure
<block_size> - desired block size
<dc> - drop(0) or retain(1) dc component
<inner> - inner cutoff frequency
<outer> - outer cutoff frequency
<order> - filter order
PATH
$CVIPHOME/XFORMFILTER/filter.c
DESCRIPTION
Butterworth_Band_Reject() performs two-dimensional butter-
worth bandreject filtering in transform domain on input
image. The filter transfer function of order <order> is:
H(u,v) = 1 / (1+ pow(k, 2*order))
where k = D(u,v)W / [pow(D(u,v), 2) - pow(D0, 2)]
D(u, v) is the distance from the origin, W the width of the
band, and D0 is the center of the band. W is calculated
using the inner and outer cut-off frequencies specified. The
frequency components within the band enclosed by inner and
outer cut-off frequencies are attenuated according to the
transfer function. All frequencies outside the band are not
attenuated. The band is a 1/4 of a circular band if the dc
component is on the upper left-hand corner of its transform
plane. If dc equals 1, the dc component will be retained, if
dc equals, the dc component will be dropped.
TYPES AND CONSTANTS
None
RETURN VALUES
A filtered image
HISTORY
History information recorded: None The
Butterworth_Band_Reject filter will work for both real-
valued and imaginary-valued transform. If the origin of the
transform is on the center of its frequency plane (shifted),
the cutoff frequencies can range from 1 to blocksize/2 and
the Butterworth_Band_Reject function can be called directly
with correct parameters. If the origin of the transform is
on the upper left-hand corner of its frequency plane,
nonfft_xformfilter() must be used to call
Butterworth_Band_Reject() with filtertype = 8. The cutoff
frequencies in this case can range from 1 to blocksize since
a block is treated as a quarter of a regular block with its
origin on the center. If brf_setup() is to be used to call
Butterworth_Band_Reject(), the transform must be setup and
recognized by brf_setup(), otherwise the setup program
automatically assumes the transform's dc component is on the
center (dcpos=1).
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPdef.h>
#include <CVIPconvert.h>
#include <CVIPview.h>
#define VIEWER "picture"
#define VIDEO_APP "SunVideo &"
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile,*outputfile;
(void) setDisplay_Image(VIEWER, "Default");
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile,1);
view_Image(cvipImage, inputfile);
free(inputfile);
/* the following call performs the fft_transform on the
input image with the block size equal to 256 */
cvipImage=(Image *)fft_transform(cvipImage,256);
/* the following call performs the butterworth band reject
filtering of order 2 on the transformed image with the
lower cut off equal to 0 and the higher cut off equal to 64
*/
cvipImage = (Image *)Butterworth_Band_Reject(cvipImage,
256,1,0,64,2);
/* the following call performs the inverse fft_transform in
the filtered image with the block size equal to 256 */
cvipImage = (Image *)ifft_transform(cvipImage,256);
print_CVIP("\n\t\tEnter the Output File Name: ");
outputfile = getString_CVIP();
view_Image(cvipImage,outputfile);
write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,format,1);
free(outputfile);
}
SEE ALSO
libxformfilter
AUTHOR
Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Simon Low.