You are here : matlabImage ProcessingintegralBoxFilter

integralBoxFilter() - Image Processing

B = integralBoxFilter(intA) filters
the integral image intA with a 3-by-3 box filter.
Returns the filtered image, B. exampleB = integralBoxFilter(intA,filterSize) filters
the integral image intA with a 2-D box filter
with size specified by filterSize.B = integralBoxFilter(___,Name,Value) filters
integral image intA with Name-Value pairs to
control various aspects of the filtering.Code Generation support:
Yes.MATLAB Function Block support:
Yes.


Syntax

B = integralBoxFilter(intA)B = integralBoxFilter(intA,filterSize) exampleB = integralBoxFilter(___,Name,Value)


Example

Filter Integral ImageOpen This Example
Read image into the workspace.A = imread('cameraman.tif');
Pad the image by the radius of the filter neighborhood. This example uses an 11-by-11 filter.filterSize = [11 11];
padSize = (filterSize-1)/2;
Apad = padarray(A, padSize, 'replicate','both');
Compute the integral image of the padded input image.intA = integralImage(Apad);
Filter the integral image.B = integralBoxFilter(intA, filterSize);
Display original image and filtered image.figure
imshow(A)
title('Original Image')
figure
imshow(B,[])
title('Filtered Image')


Filter Image with Horizontal and Vertical Motion BlurOpen This Example
Read image into the workspace. A = imread('cameraman.tif');
Pad the image by radius of the filter neighborhood, calculated (11-1)/2.padSize = [5 5];
Apad = padarray(A, padSize, 'replicate', 'both');
Calculate the integral image of the padded input.intA = integralImage(Apad);
Filter the integral image with a vertical [11 1] filter.Bvert = integralBoxFilter(intA, [11 1]);
Crop the output to retain input image size and display it.Bvert = Bvert(:,6:end-5);
Filter the integral image with a horizontal [1 11] filter.Bhorz = integralBoxFilter(intA, [1 11]);
Crop the output to retain input image size.Bhorz = Bhorz(6:end-5,:);
Display the original image and the filtered images.figure,
imshow(A)
title('Original Image')
figure,
imshow(Bvert,[])
title('Filtered with Vertical Filter')
figure,
imshow(Bhorz,[])
title('Filtered with Horizontal Filter')


Output / Return Value


Limitations


Alternatives / See Also


Reference