integralImage3
Calculate 3-D integral image
Syntax
Description
Examples
Compute Integral Image of 3-D Input Image
Create a 3-D input image.
I = reshape(1:125,5,5,5);
Define a 3-by-3-by-3 sub-volume as [startRow, startCol, startPlane, endRow, endCol, endPlane]
.
[sR, sC, sP, eR, eC, eP] = deal(2, 2, 2, 4, 4, 4);
Create an integral image from the input image and compute the sum over a 3-by-3-by-3 sub-volume of I.
J = integralImage3(I); regionSum = J(eR+1,eC+1,eP+1) - J(eR+1,eC+1,sP) - J(eR+1,sC,eP+1) ... - J(sR,eC+1,eP+1) + J(sR,sC,eP+1) + J(sR,eC+1,sP) ... + J(eR+1,sC,sP) -J(sR,sC,sP)
regionSum = 1701
Verify that the sum of pixels is accurate.
sum(sum(sum(I(sR:eR, sC:eC, sP:eP))))
ans = 1701
Input Arguments
I
— Grayscale volume
3-D numeric array
Grayscale volume, specified as a 3-D numeric array.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
Output Arguments
J
— Integral image
numeric array
Integral image, returned as a numeric array. The function zero-pads the top, left and along
the first plane, resulting in size(J) = size(I) + 1
. side
of the integral image. The class of the output is double
.
The resulting size of the output integral image equals: size(J) =
size(I) + 1
. Such sizing facilitates easy computation of pixel
sums along all image boundaries. The integral image, J
,
is essentially a padded version of the value
cumsum(cumsum(cumsum(I),2),3)
.
Data Types: double
More About
Integral Image
In an integral image, every pixel is the summation of the pixels above and to the left of it. Using an integral image, you can rapidly calculate summations over image subregions. Use of integral images was popularized by the Viola-Jones algorithm. Integral images facilitate summation of pixels and can be performed in constant time, regardless of the neighborhood size.
Extended Capabilities
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2015bR2022b: Support for thread-based environments
integralImage3
now supports thread-based
environments.
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)