IntegralImage2 Class |
Namespace: Accord.Imaging
The IntegralImage2 type exposes the following members.
Name | Description | |
---|---|---|
IntegralImage2 |
Constructs a new Integral image of the given size.
|
Name | Description | |
---|---|---|
Height |
Gets the image's height.
| |
Image |
Gets the Integral Image for values' sum.
| |
Rotated |
Gets the Integral Image for tilted values' sum.
| |
Squared |
Gets the Integral Image for values' squared sum.
| |
Width |
Gets the image's width.
|
Name | Description | |
---|---|---|
Dispose |
Performs application-defined tasks associated with freeing,
releasing, or resetting unmanaged resources.
| |
Dispose(Boolean) |
Releases unmanaged and - optionally - managed resources
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize |
Releases unmanaged resources and performs other cleanup operations
before the IntegralImage2 is reclaimed by garbage collection.
(Overrides ObjectFinalize.) | |
FromBitmap(Bitmap) |
Constructs a new Integral image from a Bitmap image.
| |
FromBitmap(BitmapData) |
Constructs a new Integral image from a BitmapData image.
| |
FromBitmap(UnmanagedImage) |
Constructs a new Integral image from an unmanaged image.
| |
FromBitmap(Bitmap, Boolean) |
Constructs a new Integral image from a Bitmap image.
| |
FromBitmap(Bitmap, Int32) |
Constructs a new Integral image from a Bitmap image.
| |
FromBitmap(BitmapData, Boolean) |
Constructs a new Integral image from a BitmapData image.
| |
FromBitmap(BitmapData, Int32) |
Constructs a new Integral image from a BitmapData image.
| |
FromBitmap(UnmanagedImage, Boolean) |
Constructs a new Integral image from an unmanaged image.
| |
FromBitmap(UnmanagedImage, Int32) |
Constructs a new Integral image from an unmanaged image.
| |
FromBitmap(Bitmap, Int32, Boolean) |
Constructs a new Integral image from a Bitmap image.
| |
FromBitmap(BitmapData, Int32, Boolean) |
Constructs a new Integral image from a BitmapData image.
| |
FromBitmap(UnmanagedImage, Int32, Boolean) |
Constructs a new Integral image from an unmanaged image.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetSum |
Gets the sum of the pixels in a rectangle of the Integral image.
| |
GetSum2 |
Gets the sum of the squared pixels in a rectangle of the Integral image.
| |
GetSumT |
Gets the sum of the pixels in a tilted rectangle of the Integral image.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Update |
Computes the integral image representation from the given image.
|
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
This class provides a unified representation for both integral images, squared integral images and tilted integral images under the same class. This class can be used to provide more efficient transformations whenever all those representations are required at the same time, such as when using the Viola-Jones (Haar Cascade) object detector.
Using this representation, both structures can be created in a single pass over the data. This is interesting for real time applications. This class also accepts a channel parameter indicating the Integral Image should be computed using a specified color channel. This avoids costly conversions.
// Let's say we have the following image representation: byte[,] img = { { 5, 2, 3, 4, 1 }, { 1, 5, 4, 2, 3 }, { 2, 2, 1, 3, 4 }, { 3, 5, 6, 4, 5 }, { 4, 1, 3, 2, 6 }, }; // Let's convert it to bitmap and // pretend it is our input image: Bitmap bmp = img.ToBitmap(); // Now, create an integral image from this bitmap: IntegralImage2 ii = IntegralImage2.FromBitmap(bmp); // The sum-table would be: long[,] actual = ii.Image; // Which would be the same as: long[,] expected = { { 0, 0, 0, 0, 0, 0 }, { 0, 5, 7, 10, 14, 15 }, { 0, 6, 13, 20, 26, 30 }, { 0, 8, 17, 25, 34, 42 }, { 0, 11, 25, 39, 52, 65 }, { 0, 15, 30, 47, 62, 81 } };
// In this example, we will compute an integral image // representation of Lena Söderberg's famous picture: TestImages testImages = new TestImages(path: localPath); Bitmap lena = testImages["lena.bmp"]; // get the image // Create a new Integral Image (squared and tilted) from Lena's picture: IntegralImage2 ii = IntegralImage2.FromBitmap(lena, computeTilted: true); // Let's say we would like to get the summed area in the rectangular region // delimited by pixel (34, 50) until pixels (60, 105). This is equivalent to // the region under the rectangle (34, 50, 34+60, 50+105) = (34, 50, 94, 155): long sum = ii.GetSum(34, 50, 94, 155); // this is the sum of values (1760032) // Now let's say we would like to get the squared sum and tilted sum as well: long ssum = ii.GetSum2(34, 50, 94, 155); // this is the sum of squared values (229508896) long tsum = ii.GetSumT(34, 50, 94, 155); // this is the sum of tilted values (-593600)