www.gusucode.com > images 案例代码 matlab源码程序 > images/FilterIntegralImageExample.m

    %% Filter Integral Image
%  
%%
% Read image into the workspace.

% Copyright 2015 The MathWorks, Inc.

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')