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

    %% Compute Integral Image with Rotated Orientation
% 
%%
% Create sample image. 

% Copyright 2015 The MathWorks, Inc.

I = magic(5)
% Define rotated rectangular region as [x, y, width, height] where x, y
% denote the indices of the top corner of the rectangle. Width and height
% are along 45 degree lines from the top corner.
[x, y, w, h] = deal(3, 1, 3, 2);
%%
% Create integral image.
J = integralImage(I, 'rotated');
%%
% Compute the sum over the region using the integral image.
regionSum = J(y+w+h,x+w-h+1) + J(y,x+1) - J(y+h,x-h+1) - J(y+w,x+w+1);