Click or drag to resize
Accord.NET (logo)

HaarCascade Class

Cascade of Haar-like features' weak classification stages.
Inheritance Hierarchy
SystemObject
  Accord.Vision.DetectionHaarCascade
    Accord.Vision.Detection.CascadesFaceHaarCascade
    Accord.Vision.Detection.CascadesNoseHaarCascade

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

The HaarCascade type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyHasTiltedFeatures
Gets a value indicating whether this cascade has tilted features.
Public propertyHeight
Gets the stages' base height.
Public propertyStages
Gets the classification stages.
Public propertyWidth
Gets the stages' base width.
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 memberFromXml(Stream)
Loads a HaarCascade from a OpenCV-compatible XML file.
Public methodStatic memberFromXml(TextReader)
Loads a HaarCascade from a OpenCV-compatible XML file.
Public methodStatic memberFromXml(String)
Loads a HaarCascade from a OpenCV-compatible XML file.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
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 methodToCode(TextWriter, String)
Saves a HaarCascade to C# code.
Public methodToCode(String, String)
Saves a HaarCascade to C# code.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
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

The Viola-Jones object detection framework is the first object detection framework to provide competitive object detection rates in real-time proposed in 2001 by Paul Viola and Michael Jones. Although it can be trained to detect a variety of object classes, it was motivated primarily by the problem of face detection.

The implementation of this code has used Viola and Jones' original publication, the OpenCV Library and the Marilena Project as reference. OpenCV is released under a BSD license, it is free for both academic and commercial use. Please be aware that some particular versions of the Haar object detection framework are patented by Viola and Jones and may be subject to restrictions for use in commercial applications.

References:

Examples

To load an OpenCV-compatible XML definition for a Haar cascade, you can use HaarCascade's FromXml static method. An example would be:

String path = @"C:\Users\haarcascade-frontalface_alt2.xml";
HaarCascade cascade1 = HaarCascade.FromXml(path);

After the cascade has been loaded, it is possible to create a new HaarObjectDetector using the cascade. Please see HaarObjectDetector for more details. It is also possible to generate embeddable C# definitions from a cascade, avoiding the need to load XML files on program startup. Please see ToCode(String, String) method or HaarCascadeWriter class for details.

See Also