Click or drag to resize
Accord.NET (logo)

IntegralImage Class

Integral image.
Inheritance Hierarchy
SystemObject
  Accord.ImagingIntegralImage

Namespace:  Accord.Imaging
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public class IntegralImage : ICloneable
Request Example View Source

The IntegralImage type exposes the following members.

Constructors
  NameDescription
Protected methodIntegralImage
Initializes a new instance of the IntegralImage class.
Top
Properties
  NameDescription
Public propertyHeight
Height of the source image the integral image was constructed for.
Public propertyInternalData Obsolete.
Provides access to internal array keeping integral image data.
Public propertyMatrix
Provides access to internal array keeping integral image data.
Public propertyWidth
Width of the source image the integral image was constructed for.
Top
Methods
  NameDescription
Public methodClone
Creates a new object that is a copy of the current instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodStatic memberFromBitmap(Bitmap)
Construct integral image from source grayscale image.
Public methodStatic memberFromBitmap(BitmapData)
Construct integral image from source grayscale image.
Public methodStatic memberFromBitmap(UnmanagedImage)
Construct integral image from source grayscale image.
Public methodGetHaarXWavelet
Calculate horizontal (X) haar wavelet at the specified point.
Public methodGetHaarYWavelet
Calculate vertical (Y) haar wavelet at the specified point.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetRectangleMean(Int32, Int32, Int32)
Calculate mean value of pixels in the specified rectangle.
Public methodGetRectangleMean(Int32, Int32, Int32, Int32)
Calculate mean value of pixels in the specified rectangle.
Public methodGetRectangleMeanUnsafe(Int32, Int32, Int32)
Calculate mean value of pixels in the specified rectangle without checking it's coordinates.
Public methodGetRectangleMeanUnsafe(Int32, Int32, Int32, Int32)
Calculate mean value of pixels in the specified rectangle without checking it's coordinates.
Public methodGetRectangleSum(Int32, Int32, Int32)
Calculate sum of pixels in the specified rectangle.
Public methodGetRectangleSum(Int32, Int32, Int32, Int32)
Calculate sum of pixels in the specified rectangle.
Public methodGetRectangleSumUnsafe(Int32, Int32, Int32)
Calculate sum of pixels in the specified rectangle without checking it's coordinates.
Public methodGetRectangleSumUnsafe(Int32, Int32, Int32, Int32)
Calculate sum of pixels in the specified rectangle without checking it's coordinates.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Protected fieldintegralImage
Integral image's array.
Protected fieldmatrix
Integral image's array.
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(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.)
Public Extension MethodToTOverloaded.
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.)
Top
Remarks

This class implements integral image concept, which is described by Viola and Jones in: P. Viola and M. J. Jones, "Robust real-time face detection", Int. Journal of Computer Vision 57(2), pp. 137–154, 2004.

"An integral image I of an input image G is defined as the image in which the intensity at a pixel position is equal to the sum of the intensities of all the pixels above and to the left of that position in the original image."

The intensity at position (x, y) can be written as:

          x    y
I(x,y) = SUM( SUM( G(i,j) ) )
         i=0  j=0

Note Note
The class uses 32-bit integers to represent integral image.

Note Note
The class processes only grayscale (8 bpp indexed) images.

Note Note
This class contains two versions of each method: safe and unsafe. Safe methods do checks of provided coordinates and ensure that these coordinates belong to the image, what makes these methods slower. Unsafe methods do not do coordinates' checks and rely that these coordinates belong to the image, what makes these methods faster.

This class implements the simplest upright representation of an integral image. For an integral image that can represent squared integral images as well as tilted images at the same time, please refer to IntegralImage2.

Examples

Sample usage:

// create integral image
IntegralImage im = IntegralImage.FromBitmap(image);

// get pixels' mean value in the specified rectangle
float mean = im.GetRectangleMean(10, 10, 20, 30)
See Also