RAFilter

Rectangular Average Filter operation. Size of filter is user defined.

 

function call:

[out_img1]=vsg('RAFilter',in_img1,size);

 

Arguments:

in_img1 input image, 3 channel RGB, 1 channel greyscale or binary image or DICOM image.

size – an integer that specifies the size of the rectangle in which the average is calculated. This number actually represents the number of pixels from the centre which will be considered.

 

Description:

This function performs a rectangular average filter, of size (2*size+1)*(2*size+1). It is equivalent to a convolution of the specified array in which all the coefficients are ones. out_img1 – returns an image of the same dimensions as the input with the average of the pixels in every (2*size+1)*(2*size+1) region displayed in the output.

 

Example:

img = openimage('lake.jpg');

h=figure;image(img);set(h,'Name','Input');

[out_img1]=vsg('RAFilter',img,3);

h=figure; image(uint8(out_img1));set(h,'Name','RAFilter Image');
Home       Functions       Back