Accord.Vision
Bag of Visual Words
The bag-of-words (BoW) model can be used to transform data with
multiple possible lengths (i.e. words in a text, pixels in an
image) into finite-dimensional vectors of fixed length. Those
vectors are usually referred as representations as they can be
used in place of the original data as if they were the data itself.
For example, using Bag-of-Words it becomes possible to transform
a set of N images with varying sizes and dimensions into a
N x C matrix where C is the number of "visual words"
being used to represent each of the N images in the set.
Those rows can then be used in classification, clustering, and any
other machine learning tasks where a finite vector representation
would be required.
The framework can compute BoW representations for images using any
choice of feature extractor and clustering algorithm. By default,
the framework uses the
SURF features detector and the clustering
algorithm.
The first example shows how to create and use a BoW with default parameters.
After the representations have been extracted, it is possible to use them
in arbitrary machine learning tasks, such as classification:
By default, the BoW uses K-Means to cluster feature vectors. The next
example demonstrates how to use a different clustering algorithm when
computing the BoW, including the
Binary Split algorithm.
By default, the BoW uses the
SURF feature detector to extract sparse features from the images.
However, it is also possible to use other detectors, including dense
detectors such as .
Or this also simple case using the FREAK
detector and the clustering algorithm:
More advanced use cases are also supported. For example, some image patches
can be represented using different data representations, such as byte vectors.
In this case, it is still possible to use the BoW using an appropriate clustering
algorithm that doesn't depend on Euclidean distances.
Other more specialized feature extractors can also be used, such as
texture feature extractors for performing texture classification.
In some applications, learning a BoW with the default settings might need a large amount of memory to be
available. In those cases, it is possible to reduce the memory and CPU requirements for the learning phase
using the and
properties. It is also possible
to avoid loading all images at once by feeding the algorithm with the image filenames instead of their Bitmap
representations:
Constructs a new using a
surf
feature detector to identify features.
The number of codewords.
Constructs a new using a
surf
feature detector to identify features.
The clustering algorithm to use.
Loads a bag of words from a stream.
The stream from which the bow is to be deserialized.
The deserialized bag of words.
Loads a bag of words from a file.
The path to the file from which the bow is to be deserialized.
The deserialized bag of words.
Loads a bag of words from a stream.
The stream from which the bow is to be deserialized.
The deserialized bag of words.
Loads a bag of words from a file.
The path to the file from which the bow is to be deserialized.
The deserialized bag of words.
Loads a bag of words from a stream.
The stream from which the bow is to be deserialized.
The deserialized bag of words.
Loads a bag of words from a file.
The path to the file from which the bow is to be deserialized.
The deserialized bag of words.
Creates a Bag-of-Words model using and
Creates a Bag-of-Words model using the given feature detector and clustering algorithm.
Creates a Bag-of-Words model using the SURF feature detector and the given clustering algorithm.
Creates a Bag-of-Words model using the given feature detector and clustering algorithm.
Creates a Bag-of-Words model using the given feature detector and .
Creates a Bag-of-Words model using the given feature detector and clustering algorithm.
Creates a Bag-of-Words model using the given feature detector and clustering algorithm.
Bag of Visual Words
The type to be used with this class,
such as .
The bag-of-words (BoW) model can be used to extract finite
length features from otherwise varying length representations.
This class can uses any feature
detector to determine a coded representation for a given image.
For a simpler, non-generic version of the Bag-of-Words model which
defaults to the SURF
features detector, please see .
Please see .
Constructs a new .
The feature extractor to use.
The number of codewords.
Constructs a new .
The feature extractor to use.
The clustering algorithm to use.
Base class for Bag of Visual Words implementations.
Constructs a new .
Computes the Bag of Words model.
The set of images to initialize the model.
The list of feature points detected in all images.
Computes the Bag of Words model.
The extracted image features to initialize the model.
The list of feature points detected in all images.
Computes the Bag of Words model.
The set of images to initialize the model.
Convergence rate for the k-means algorithm. Default is 1e-5.
The list of feature points detected in all images.
Gets the codeword representation of a given image.
The image to be processed.
A double vector with the same length as words
in the code book.
Gets the codeword representation of a given image.
The image to be processed.
A double vector with the same length as words
in the code book.
Gets the codeword representation of a given image.
The image to be processed.
A double vector with the same length as words
in the code book.
Gets the codeword representation of a given image.
The interest points of the image.
A double vector with the same length as words
in the code book.
Saves the bag of words to a stream.
The stream to which the bow is to be serialized.
Saves the bag of words to a file.
The path to the file to which the bow is to be serialized.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Applies the transformation to an input, producing an associated output.
The input data to which the transformation should be applied.
The output generated by applying this transformation to the given input.
Applies the transformation to an input, producing an associated output.
The input data to which the transformation should be applied.
The output generated by applying this transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
The input data to which
the transformation should be applied.
The location to where to store the
result of this transformation.
The output generated by applying this
transformation to the given input.
Learns a model that can map the given inputs to the desired outputs.
The model inputs.
The weight of importance for each input sample.
A model that has learned how to produce suitable outputs
given the input data .
Learns a model that can map the given inputs to the desired outputs.
The model inputs.
The weight of importance for each input sample.
A model that has learned how to produce suitable outputs
given the input data .
Bag of Visual Words
The type to be used with this class,
such as .
The feature type of the , such
as .
The type of the clustering algorithm to be used to cluster the visual features
and form visual codewords.
The type of the feature detector used to extract features from the images.
The bag-of-words (BoW) model can be used to extract finite
length features from otherwise varying length representations.
This class can uses any feature
detector to determine a coded representation for a given image.
For a simpler, non-generic version of the Bag-of-Words model which
defaults to the SURF
features detector, please see .
Please see .
Constructs a new .
The feature extractor to use.
The clustering algorithm to use.
Bag of Visual Words
The type to be used with this class,
such as .
The feature type of the , such
as .
The bag-of-words (BoW) model can be used to extract finite
length features from otherwise varying length representations.
This class can uses any feature
detector to determine a coded representation for a given image.
For a simpler, non-generic version of the Bag-of-Words model which
defaults to the SURF
features detector, please see .
Please see .
Constructs a new .
The feature extractor to use.
The clustering algorithm to use.
Constructs a new .
Nearest neighbor feature point matching algorithm.
This class matches feature points using a
k-Nearest Neighbors algorithm.
Constructs a new
K-Nearest Neighbors matching algorithm.
The number of neighbors to use when matching points.
Constructs a new
K-Nearest Neighbors matching algorithm.
The number of neighbors to use when matching points.
The distance function to consider between points.
Creates a nearest neighbor algorithm with the feature points as
inputs and their respective indices a the corresponding output.
Nearest neighbor feature point matching algorithm.
This class matches feature points using a
k-Nearest Neighbors algorithm.
Gets or sets the number k of nearest neighbors.
Gets or sets the distance function used
as a distance metric between data points.
Gets or sets a minimum relevance threshold
used to find matching pairs. Default is 0.
Constructs a new
K-Nearest Neighbors matching algorithm.
The number of neighbors to use when matching points.
The distance function to consider between points.
Constructs a new
K-Nearest Neighbors matching algorithm.
The number of neighbors to use when matching points.
The distance function to consider between points.
Matches two sets of feature points.
Matches two sets of feature points.
Matches two sets of feature points.
Creates a nearest neighbor algorithm with the feature points as
inputs and their respective indices a the corresponding output.
RANSAC Robust Fundamental Matrix Estimator.
Fitting a fundamental using RANSAC is pretty straightforward. Being a iterative method,
in a single iteration a random sample of four correspondences is selected from the
given correspondence points and a transformation F is then computed from those points.
After a given number of iterations, the iteration which produced the largest number
of inliers is then selected as the best estimation for H.
References:
-
P. D. Kovesi. MATLAB and Octave Functions for Computer Vision and Image Processing.
School of Computer Science and Software Engineering, The University of Western Australia.
Available in:
http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/Projective/fundmatrix.m
-
E. Dubrofsky. Homography Estimation. Master thesis. Available on:
http://www.cs.ubc.ca/~dubroe/courses/MastersEssay.pdf
Gets the RANSAC estimator used.
Gets the final set of inliers detected by RANSAC.
Creates a new RANSAC homography estimator.
Inlier threshold.
Inlier probability.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Matches two sets of points using RANSAC.
The fundamental matrix relating x1 and x2.
Estimates a fundamental matrix with the given points.
Compute inliers using the Symmetric Transfer Error,
RANSAC Robust Homography Matrix Estimator.
Fitting a homography using RANSAC is pretty straightforward. Being a iterative method,
in a single iteration a random sample of four correspondences is selected from the
given correspondence points and a homography H is then computed from those points.
The original points are then transformed using this homography and their distances to
where those transforms should be is then computed and matching points can classified
as inliers and non-matching points as outliers.
After a given number of iterations, the iteration which produced the largest number
of inliers is then selected as the best estimation for H.
References:
-
E. Dubrofsky. Homography Estimation. Master thesis. Available on:
http://www.cs.ubc.ca/~dubroe/courses/MastersEssay.pdf
// Let's start with two pictures that have been
// taken from slightly different points of view:
//
Bitmap img1 = Resources.dc_left;
Bitmap img2 = Resources.dc_right;
// Those pictures are shown below:
ImageBox.Show(img1, PictureBoxSizeMode.Zoom, 640, 480);
ImageBox.Show(img2, PictureBoxSizeMode.Zoom, 640, 480);
// Step 1: Detect feature points using Surf Corners Detector
var surf = new SpeededUpRobustFeaturesDetector();
var points1 = surf.ProcessImage(img1);
var points2 = surf.ProcessImage(img2);
// Step 2: Match feature points using a k-NN
var matcher = new KNearestNeighborMatching(5);
var matches = matcher.Match(points1, points2);
// Step 3: Create the matrix using a robust estimator
var ransac = new RansacHomographyEstimator(0.001, 0.99);
MatrixH homographyMatrix = ransac.Estimate(matches);
// Step 4: Project and blend using the homography
Blend blend = new Blend(homographyMatrix, img1);
// Compute the blending algorithm
Bitmap result = blend.Apply(img2);
// Show on screen
ImageBox.Show(result, PictureBoxSizeMode.Zoom, 640, 480);
The resulting image is shown below.
Gets the RANSAC estimator used.
Gets the final set of inliers detected by RANSAC.
Creates a new RANSAC homography estimator.
Inlier threshold.
Inlier probability.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Matches two sets of points using RANSAC.
The homography matrix matching x1 and x2.
Estimates a homography with the given points.
Compute inliers using the Symmetric Transfer Error,
Checks if the selected points will result in a degenerate homography.
Group matching algorithm for detection region averaging.
This class can be seen as a post-processing filter. Its goal is to
group near or contained regions together in order to produce more
robust and smooth estimates of the detected regions.
Creates a new object.
The minimum number of neighbors needed to keep a detection. If a rectangle
has less than this minimum number, it will be discarded as a false positive.
The minimum distance threshold to consider two rectangles as neighbors.
Default is 0.2.
Gets the minimum distance threshold to consider
two rectangles as neighbors. Default is 0.2.
Checks if two rectangles are near.
Averages rectangles which belongs to the
same class (have the same class label)
Default Face Haar Cascade for using with Haar Classifiers.
The definition was originally based on a hard coded partial transcription of
OpenCV's haarcascade_frontalface_alt.xml by Mario Klingemann. This
class, however, has been re-created using .
Hard-coded partial transcription of haarcascade_frontalface_alt.xml
based on code by Mario Klingemann.
Automatic transcription of Haar cascade definitions
for facial features by Modesto Castrillon-Santana.
This code has been automatically generated by the Accord.NET Framework
based on original research by Modesto Castrillon-Santana. The original
code has been shared under a BSD license in the OpenCV library and has
been incorporated in the Accord.NET Framework under permission of the
original author.
// Copyright (c) 2008, Modesto Castrillon-Santana (IUSIANI, University of
// Las Palmas de Gran Canaria, Spain).
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * The name of Contributor may not used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Creates a new cascade for nose detection.
Cascade of Haar-like features' weak classification stages.
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:
-
Viola, P. and Jones, M. (2001). Rapid Object Detection using a Boosted Cascade
of Simple Features.
-
Wikipedia, The Free Encyclopedia. Viola-Jones object detection framework
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
using the cascade. Please see 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 method or
class for details.
Gets the stages' base width.
Gets the stages' base height.
Gets the classification stages.
Gets a value indicating whether this cascade has tilted features.
true if this cascade has tilted features; otherwise, false.
Constructs a new Haar Cascade.
Base feature width.
Base feature height.
Haar-like features classification stages.
Constructs a new Haar Cascade.
Base feature width.
Base feature height.
Checks if the classifier contains tilted (rotated) features
Creates a new object that is a copy of the current instance.
A new object that is a copy of this instance.
Loads a HaarCascade from a OpenCV-compatible XML file.
A containing the file stream
for the xml definition of the classifier to be loaded.
The HaarCascadeClassifier loaded from the file.
Loads a HaarCascade from a OpenCV-compatible XML file.
The file path for the xml definition of the classifier to be loaded.
The HaarCascadeClassifier loaded from the file.
Loads a HaarCascade from a OpenCV-compatible XML file.
A containing the file stream
for the xml definition of the classifier to be loaded.
The HaarCascadeClassifier loaded from the file.
Saves a HaarCascade to C# code.
Saves a HaarCascade to C# code.
Automatic transcriber for Haar cascades.
This class can be used to generate code-only definitions for Haar cascades,
avoiding the need for loading and parsing XML files during application startup.
This class generates C# code for a class inheriting from
which may be used to create a .
Constructs a new class.
The path of the file that should be written.
Constructs a new class.
The stream to write to.
Writes the specified cascade.
The cascade to write.
The name for the generated class.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Strong classifier based on a weaker cascade of
classifiers using Haar-like rectangular features.
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. The code
has been implemented with full support for tilted Haar features.
References:
-
Viola, P. and Jones, M. (2001). Rapid Object Detection using a Boosted Cascade
of Simple Features.
-
http://en.wikipedia.org/wiki/Viola-Jones_object_detection_framework
Constructs a new classifier.
Constructs a new classifier.
Gets the cascade of weak-classifiers
used by this strong classifier.
Gets or sets the scale of the search window
being currently used by the classifier.
Detects the presence of an object in a given window.
Haar Cascade Classifier Stage.
A Haar Cascade Classifier is composed of several stages. Each stage
contains a set of classifier trees used in the decision process.
Gets or sets the feature trees and its respective
feature tree nodes which compose this stage.
Gets or sets the threshold associated with this stage,
i.e. the minimum value the classifiers should output
to decide if the image contains the object or not.
Gets the index of the parent stage from this stage.
Gets the index of the next stage from this stage.
Constructs a new Haar Cascade Stage.
Constructs a new Haar Cascade Stage.
Constructs a new Haar Cascade Stage.
Classifies an image as having the searched object or not.
Creates a new object that is a copy of the current instance.
A new object that is a copy of this instance.
Haar Cascade Serialization Root. This class is used
only for XML serialization/deserialization.
The stages retrieved after deserialization.
Haar Cascade Feature Tree Node.
The Feature Node is a node belonging to a feature tree,
containing information about child nodes and an associated
.
Gets the threshold for this feature.
Gets the left value for this feature.
Gets the right value for this feature.
Gets the left node index for this feature.
Gets the right node index for this feature.
Gets the feature associated with this node.
Constructs a new feature tree node.
Constructs a new feature tree node.
Constructs a new feature tree node.
Creates a new object that is a copy of the current instance.
A new object that is a copy of this instance.
Rectangular Haar-like feature container.
References:
- http://en.wikipedia.org/wiki/Haar-like_features#Rectangular_Haar-like_features
Gets or sets whether this feature is tilted.
Gets or sets the Haar rectangles for this feature.
Constructs a new Haar-like feature.
Constructs a new Haar-like feature.
Constructs a new Haar-like feature.
Constructs a new Haar-like feature.
Gets the sum of the areas of the rectangular features in an integral image.
Sets the scale and weight of a Haar-like rectangular feature container.
Creates a new object that is a copy of the current instance.
A new object that is a copy of this instance.
Scalable rectangular area.
A rectangle which can be at any position and scale within the original image.
Gets or sets the x-coordinate of this Haar feature rectangle.
Gets or sets the y-coordinate of this Haar feature rectangle.
Gets or sets the width of this Haar feature rectangle.
Gets or sets the height of this Haar feature rectangle.
Gets or sets the weight of this Haar feature rectangle.
Gets or sets the scaled x-coordinate of this Haar feature rectangle.
Gets or sets the scaled y-coordinate of this Haar feature rectangle.
Gets or sets the scaled width of this Haar feature rectangle.
Gets or sets the scaled height of this Haar feature rectangle.
Gets or sets the scaled weight of this Haar feature rectangle.
Constructs a new Haar-like feature rectangle.
Values for this rectangle.
Constructs a new Haar-like feature rectangle.
Gets the area of this rectangle.
Scales the values of this rectangle.
Scales the weight of this rectangle.
Converts from a string representation.
Creates a new object that is a copy of the current instance.
A new object that is a copy of this instance.
Object detector interface.
Gets the location of the detected objects.
Process a new image scene looking for objects.
Object detector options for the search procedure.
Entire image will be scanned.
Only a single object will be retrieved.
If a object has already been detected inside an area,
it will not be scanned twice for inner or overlapping
objects, saving computation time.
If several objects are located within one another,
they will be averaged. Additionally, objects which
have not been detected sufficient times may be dropped
by setting .
Object detector options for window scaling.
Will start with a big search window and
gradually scale into smaller ones.
Will start with small search windows and
gradually scale into greater ones.
Viola-Jones Object Detector based on Haar-like features.
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. The code
has been implemented with full support for tilted Haar features from the ground up.
References:
-
Viola, P. and Jones, M. (2001). Rapid Object Detection using a Boosted Cascade
of Simple Features.
-
http://en.wikipedia.org/wiki/Viola-Jones_object_detection_framework
The first example shows how to detect faces from a single image using the detector.
The second example shows how to process an entire video using FileVideoReader class,
detecting faces from each frame, and saving those detections back to disk in the form
of individual frames and as a .mp4 file (using FileVideoWriter).
The generated video file can be found here.
Constructs a new Haar object detector.
The to use in the detector's classifier.
For the default face cascade, please take a look on
.
Constructs a new Haar object detector.
The to use in the detector's classifier.
For the default face cascade, please take a look on
.
Minimum window size to consider when searching for
objects. Default value is 15.
Constructs a new Haar object detector.
The to use in the detector's classifier.
For the default face cascade, please take a look on
.
Minimum window size to consider when searching for
objects. Default value is 15.
The to use
during search. Please see documentation of
for details. Default value is
Constructs a new Haar object detector.
The to use in the detector's classifier.
For the default face cascade, please take a look on
.
Minimum window size to consider when searching for
objects. Default value is 15.
The to use
during search. Please see documentation of
for details. Default value is
The re-scaling factor to use when re-scaling the window during search.
Constructs a new Haar object detector.
The to use in the detector's classifier.
For the default face cascade, please take a look on
.
Minimum window size to consider when searching for
objects. Default value is 15.
The to use
during search. Please see documentation of
for details. Default is .
The scaling factor to rescale the window
during search. Default value is 1.2f.
The to use
when re-scaling the search window during search. Default is
.
Gets or sets a value indicating whether this
should scan the image using multiple threads. This setting can only be changed
to true on .NET version which support the Parallel Tasks framework (4.0+).
true to use multiple threads; otherwise, false.
Minimum window size to consider when searching objects.
Maximum window size to consider when searching objects.
Gets or sets the color channel to use when processing color images.
Gets or sets the scaling factor to rescale the window during search.
Gets or sets the desired searching method.
Gets or sets the desired scaling method.
Gets or sets the minimum threshold used to suppress rectangles which
have not been detected sufficient number of times. This property only
has effect when is set to .
The value of this property represents the minimum amount of detections
made inside a region to report this region as an actual detection. For
example, setting this property to two will discard all regions which
had not achieved at least two detected rectangles within it.
Setting this property to a value higher than zero may decrease the
number of false positives.
Gets the detected objects bounding boxes.
Gets the internal Cascade Classifier used by this detector.
Gets how many frames the object has
been detected in a steady position.
The number of frames the detected object
has been in a steady position.
Performs object detection on the given frame.
Performs object detection on the given frame.
Group matching algorithm for detection region averaging.
This class can be seen as a post-processing filter. Its goal is to
group near or contained regions together in order to produce more
robust and smooth estimates of the detected regions.
Creates a new object.
The minimum number of neighbors needed to keep a detection. If a rectangle
has less than this minimum number, it will be discarded as a false positive.
Gets or sets the minimum number of neighbors necessary to keep a detection.
If a rectangle has less neighbors than this number, it will be discarded as
a false positive.
Gets how many classes were found in the
last call to .
Groups possibly near rectangles into a smaller
set of distinct and averaged rectangles.
The rectangles to group.
Detects rectangles which are near and
assigns similar class labels accordingly.
Merges two labels.
When overridden in a child class, should compute
whether two given shapes are near. Definition of
near is up to the implementation.
True if the two shapes are near; false otherwise.
When overridden in a child class, should compute
an average of the shapes given as parameters.
The label of each shape.
The shapes themselves.
Should return how many neighbors each shape had.
The averaged shapes found in the given parameters.
Motion processing algorithm, which counts separate moving objects and highlights them.
The aim of this motion processing algorithm is to count separate objects
in the motion frame, which is provided by motion detection algorithm.
In the case if property is set to ,
found objects are also highlighted on the original video frame. The algorithm
counts and highlights only those objects, which size satisfies
and properties.
The motion processing algorithm is supposed to be used only with motion detection
algorithms, which are based on finding difference with background frame
(see and
as simple implementations) and allow extract moving objects clearly.
Sample usage:
// create instance of motion detection algorithm
IMotionDetector motionDetector = new ... ;
// create instance of motion processing algorithm
BlobCountingObjectsProcessing motionProcessing = new BlobCountingObjectsProcessing( );
// create motion detector
MotionDetector detector = new MotionDetector( motionDetector, motionProcessing );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame and check motion level
if ( detector.ProcessFrame( videoFrame ) > 0.02 )
{
// check number of detected objects
if ( motionProcessing.ObjectsCount > 1 )
{
// ...
}
}
}
Highlight motion regions or not.
The property specifies if detected moving objects should be highlighted
with rectangle or not.
Default value is set to .
Turning the value on leads to additional processing time of video frame.
Color used to highlight motion regions.
Default value is set to red color.
Minimum width of acceptable object.
The property sets minimum width of an object to count and highlight. If
objects have smaller width, they are not counted and are not highlighted.
Default value is set to 10.
Minimum height of acceptable object.
The property sets minimum height of an object to count and highlight. If
objects have smaller height, they are not counted and are not highlighted.
Default value is set to 10.
Number of detected objects.
The property provides number of moving objects detected by
the last call of method.
Rectangles of moving objects.
The property provides array of moving objects' rectangles
detected by the last call of method.
Initializes a new instance of the class.
Initializes a new instance of the class.
Highlight motion regions or not (see property).
Initializes a new instance of the class.
Minimum width of acceptable object (see property).
Minimum height of acceptable object (see property).
Initializes a new instance of the class.
Minimum width of acceptable object (see property).
Minimum height of acceptable object (see property).
Color used to highlight motion regions.
Initializes a new instance of the class.
Minimum width of acceptable object (see property).
Minimum height of acceptable object (see property).
Highlight motion regions or not (see property).
Process video and motion frames doing further post processing after
performed motion detection.
Original video frame.
Motion frame provided by motion detection
algorithm (see ).
Processes provided motion frame and counts number of separate
objects, which size satisfies and
properties. In the case if property is
set to , the found object are also highlighted on the
original video frame.
Motion frame is not 8 bpp image, but it must be so.
Video frame must be 8 bpp grayscale image or 24/32 bpp color image.
Reset internal state of motion processing algorithm.
The method allows to reset internal state of motion processing
algorithm and prepare it for processing of next video stream or to restart
the algorithm.
Motion detector based on difference with predefined background frame.
The class implements motion detection algorithm, which is based on
difference of current video frame with predefined background frame. The difference frame
is thresholded and the amount of difference pixels is calculated.
To suppress stand-alone noisy pixels erosion morphological operator may be applied, which
is controlled by property.
In the case if precise motion area's borders are required (for example,
for further motion post processing), then property
may be used to restore borders after noise suppression.
In the case if custom background frame is not specified by using
method, the algorithm takes first video frame
as a background frame and calculates difference of further video frames with it.
Unlike motion detection algorithm, this algorithm
allows to identify quite clearly all objects, which are not part of the background (scene) -
most likely moving objects.
Sample usage:
// create motion detector
MotionDetector detector = new MotionDetector(
new CustomFrameDifferenceDetector( ),
new MotionAreaHighlighting( ) );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame and check motion level
if ( detector.ProcessFrame( videoFrame ) > 0.02 )
{
// ring alarm or do somethng else
}
}
Difference threshold value, [1, 255].
The value specifies the amount off difference between pixels, which is treated
as motion pixel.
Default value is set to 15.
Motion level value, [0, 1].
Amount of changes in the last processed frame. For example, if value of
this property equals to 0.1, then it means that last processed frame has 10% difference
with defined background frame.
Motion frame containing detected areas of motion.
Motion frame is a grayscale image, which shows areas of detected motion.
All black pixels in the motion frame correspond to areas, where no motion is
detected. But white pixels correspond to areas, where motion is detected.
The property is set to after processing of the first
video frame by the algorithm in the case if custom background frame was not set manually
by using method (it will be not
after second call in this case). If correct custom background
was set then the property should bet set to estimated motion frame after
method call.
Suppress noise in video frames or not.
The value specifies if additional filtering should be
done to suppress standalone noisy pixels by applying 3x3 erosion image processing
filter. See property, if it is required to restore
edges of objects, which are not noise.
Default value is set to .
Turning the value on leads to more processing time of video frame.
Restore objects edges after noise suppression or not.
The value specifies if additional filtering should be done
to restore objects' edges after noise suppression by applying 3x3 dilation
image processing filter.
Default value is set to .
Turning the value on leads to more processing time of video frame.
Initializes a new instance of the class.
Initializes a new instance of the class.
Suppress noise in video frames or not (see property).
Initializes a new instance of the class.
Suppress noise in video frames or not (see property).
Restore objects edges after noise suppression or not (see property).
Process new video frame.
Video frame to process (detect motion in).
Processes new frame from video source and detects motion in it.
Check property to get information about amount of motion
(changes) in the processed frame.
Reset motion detector to initial state.
Resets internal state and variables of motion detection algorithm.
Usually this is required to be done before processing new video source, but
may be also done at any time to restart motion detection algorithm.
In the case if custom background frame was set using
method, this method does not reset it.
The method resets only automatically generated background frame.
Set background frame.
Background frame to set.
The method sets background frame, which will be used to calculate
difference with.
Set background frame.
Background frame to set.
The method sets background frame, which will be used to calculate
difference with.
Set background frame.
Background frame to set.
The method sets background frame, which will be used to calculate
difference with.
Motion processing algorithm, which performs grid processing of motion frame.
The aim of this motion processing algorithm is to do grid processing
of motion frame. This means that entire motion frame is divided by a grid into
certain amount of cells and the motion level is calculated for each cell. The
information about each cell's motion level may be retrieved using
property.
In addition the algorithm can highlight those cells, which have motion
level above the specified threshold (see
property). To enable this it is required to set
property to .
Sample usage:
// create instance of motion detection algorithm
IMotionDetector motionDetector = new ... ;
// create instance of motion processing algorithm
GridMotionAreaProcessing motionProcessing = new GridMotionAreaProcessing( 16, 16 );
// create motion detector
MotionDetector detector = new MotionDetector( motionDetector, motionProcessing );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame
detector.ProcessFrame( videoFrame );
// check motion level in 5th row 8th column
if ( motionProcessing.MotionGrid[5, 8] > 0.15 )
{
// ...
}
}
Color used to highlight motion regions.
Default value is set to red color.
Highlight motion regions or not.
The property specifies if motion grid should be highlighted -
if cell, which have motion level above the
specified value, should be highlighted.
Default value is set to .
Turning the value on leads to additional processing time of video frame.
Motion amount to highlight cell.
The property specifies motion level threshold for highlighting grid's
cells. If motion level of a certain cell is higher than this value, then the cell
is highlighted.
Default value is set to 0.15.
Motion levels of each grid's cell.
The property represents an array of size
x, which keeps motion level
of each grid's cell. If certain cell has motion level equal to 0.2, then it
means that this cell has 20% of changes.
Width of motion grid, [2, 64].
The property specifies motion grid's width - number of grid' columns.
Default value is set to 16.
Height of motion grid, [2, 64].
The property specifies motion grid's height - number of grid' rows.
Default value is set to 16.
Initializes a new instance of the class.
Initializes a new instance of the class.
Width of motion grid (see property).
Height of motion grid (see property).
Initializes a new instance of the class.
Width of motion grid (see property).
Height of motion grid (see property).
Highlight motion regions or not (see property).
Initializes a new instance of the class.
Width of motion grid (see property).
Height of motion grid (see property).
Highlight motion regions or not (see property).
Motion amount to highlight cell (see property).
Process video and motion frames doing further post processing after
performed motion detection.
Original video frame.
Motion frame provided by motion detection
algorithm (see ).
Processes provided motion frame and calculates motion level
for each grid's cell. In the case if property is
set to , the cell with motion level above threshold are
highlighted.
Motion frame is not 8 bpp image, but it must be so.
Video frame must be 8 bpp grayscale image or 24/32 bpp color image.
Reset internal state of motion processing algorithm.
The method allows to reset internal state of motion processing
algorithm and prepare it for processing of next video stream or to restart
the algorithm.
Interface of motion detector algorithm.
The interface specifies methods, which should be implemented
by all motion detection algorithms - algorithms which perform processing of video
frames in order to detect motion. Amount of detected motion may be checked using
property. Also property may
be used in order to see all the detected motion areas. For example, the property
is used by motion processing algorithms for further motion post processing, like
highlighting motion areas, counting number of detected moving object, etc.
Motion level value, [0, 1].
Amount of changes in the last processed frame. For example, if value of
this property equals to 0.1, then it means that last processed frame has 10% of changes
(however it is up to specific implementation to decide how to compare specified frame).
Motion frame containing detected areas of motion.
Motion frame is a grayscale image, which shows areas of detected motion.
All black pixels in the motion frame correspond to areas, where no motion is
detected. But white pixels correspond to areas, where motion is detected.
Process new video frame.
Video frame to process (detect motion in).
Processes new frame from video source and detects motion in it.
Reset motion detector to initial state.
Resets internal state and variables of motion detection algorithm.
Usually this is required to be done before processing new video source, but
may be also done at any time to restart motion detection algorithm.
Interface of motion processing algorithm.
The interface specifies methods, which should be implemented
by all motion processng algorithms - algorithm which perform further post processing
of detected motion, which is done by motion detection algorithms (see ).
Process video and motion frames doing further post processing after
performed motion detection.
Original video frame.
Motion frame provided by motion detection
algorithm (see ).
The method does father post processing of detected motion.
Type of motion post processing is specified by specific implementation
of the interface - it may motion
area highlighting, motion objects counting, etc.
Reset internal state of motion processing algorithm.
The method allows to reset internal state of motion processing
algorithm and prepare it for processing of next video stream or to restart
the algorithm.
Some motion processing algorithms may not have any stored internal
states and may just process provided video frames without relying on any motion
history etc. In this case such algorithms provide empty implementation of this method.
Motion processing algorithm, which highlights motion areas.
The aim of this motion processing algorithm is to highlight
motion areas with grid pattern of the specified color.
Sample usage:
// create motion detector
MotionDetector detector = new MotionDetector(
/* motion detection algorithm */,
new MotionAreaHighlighting( ) );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame
detector.ProcessFrame( videoFrame );
}
Color used to highlight motion regions.
Default value is set to red color.
Initializes a new instance of the class.
Initializes a new instance of the class.
Color used to highlight motion regions.
Process video and motion frames doing further post processing after
performed motion detection.
Original video frame.
Motion frame provided by motion detection
algorithm (see ).
Processes provided motion frame and highlights motion areas
on the original video frame with specified color.
Motion frame is not 8 bpp image, but it must be so.
Video frame must be 8 bpp grayscale image or 24/32 bpp color image.
Reset internal state of motion processing algorithm.
The method allows to reset internal state of motion processing
algorithm and prepare it for processing of next video stream or to restart
the algorithm.
Motion processing algorithm, which highlights border of motion areas.
The aim of this motion processing algorithm is to highlight
borders of motion areas with the specified color.
The motion processing algorithm is supposed to be used only with motion detection
algorithms, which are based on finding difference with background frame
(see and
as simple implementations) and allow extract moving objects clearly.
Sample usage:
// create motion detector
MotionDetector detector = new MotionDetector(
/* motion detection algorithm */,
new MotionBorderHighlighting( ) );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame
detector.ProcessFrame( videoFrame );
}
Color used to highlight motion regions.
Default value is set to red color.
Initializes a new instance of the class.
Initializes a new instance of the class.
Color used to highlight motion regions.
Process video and motion frames doing further post processing after
performed motion detection.
Original video frame.
Motion frame provided by motion detection
algorithm (see ).
Processes provided motion frame and highlights borders of motion areas
on the original video frame with specified color.
Motion frame is not 8 bpp image, but it must be so.
Video frame must be 8 bpp grayscale image or 24/32 bpp color image.
Reset internal state of motion processing algorithm.
The method allows to reset internal state of motion processing
algorithm and prepare it for processing of next video stream or to restart
the algorithm.
Motion detection wrapper class, which performs motion detection and processing.
The class serves as a wrapper class for
motion detection and
motion processing algorithms, allowing to call them with
single call. Unlike motion detection and motion processing interfaces, the class also
provides additional methods for convenience, so the algorithms could be applied not
only to , but to .NET's class
as well.
In addition to wrapping of motion detection and processing algorthms, the class provides
some additional functionality. Using property it is possible to specify
set of rectangular zones to observe - only motion in these zones is counted and post procesed.
Sample usage:
// create motion detector
MotionDetector detector = new MotionDetector(
new SimpleBackgroundModelingDetector( ),
new MotionAreaHighlighting( ) );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame and check motion level
if ( detector.ProcessFrame( videoFrame ) > 0.02 )
{
// ring alarm or do somethng else
}
}
Motion detection algorithm to apply to each video frame.
The property sets motion detection algorithm, which is used by
method in order to calculate
motion level and
motion frame.
Motion processing algorithm to apply to each video frame after
motion detection is done.
The property sets motion processing algorithm, which is used by
method after motion detection in order to do further
post processing of motion frames. The aim of further post processing depends on
actual implementation of the specified motion processing algorithm - it can be
highlighting of motion area, objects counting, etc.
Set of zones to detect motion in.
The property keeps array of rectangular zones, which are observed for motion detection.
Motion outside of these zones is ignored.
In the case if this property is set, the method
will filter out all motion witch was detected by motion detection algorithm, but is not
located in the specified zones.
Initializes a new instance of the class.
Motion detection algorithm to apply to each video frame.
Initializes a new instance of the class.
Motion detection algorithm to apply to each video frame.
Motion processing algorithm to apply to each video frame after
motion detection is done.
Process new video frame.
Video frame to process (detect motion in).
Returns amount of motion, which is provided
property of the motion detection algorithm in use.
See for additional details.
Process new video frame.
Video frame to process (detect motion in).
Returns amount of motion, which is provided
property of the motion detection algorithm in use.
See for additional details.
Process new video frame.
Video frame to process (detect motion in).
Returns amount of motion, which is provided
property of the motion detection algorithm in use.
The method first of all applies motion detection algorithm to the specified video
frame to calculate motion level and
motion frame. After this it applies motion processing algorithm
(if it was set) to do further post processing, like highlighting motion areas, counting moving
objects, etc.
In the case if property is set, this method will perform
motion filtering right after motion algorithm is done and before passing motion frame to motion
processing algorithm. The method does filtering right on the motion frame, which is produced
by motion detection algorithm. At the same time the method recalculates motion level and returns
new value, which takes motion zones into account (but the new value is not set back to motion detection
algorithm' property).
Reset motion detector to initial state.
The method resets motion detection and motion processing algotithms by calling
their and methods.
Motion detector based on simple background modeling.
The class implements motion detection algorithm, which is based on
difference of current video frame with modeled background frame.
The difference frame is thresholded and the
amount of difference pixels is calculated.
To suppress stand-alone noisy pixels erosion morphological operator may be applied, which
is controlled by property.
In the case if precise motion area's borders are required (for example,
for further motion post processing), then property
may be used to restore borders after noise suppression.
As the first approximation of background frame, the first frame of video stream is taken.
During further video processing the background frame is constantly updated, so it
changes in the direction to decrease difference with current video frame (the background
frame is moved towards current frame). See
properties, which control the rate of
background frame update.
Unlike motion detection algorithm, this algorithm
allows to identify quite clearly all objects, which are not part of the background (scene) -
most likely moving objects. And unlike motion
detection algorithm, this algorithm includes background adaptation feature, which allows it
to update its modeled background frame in order to take scene changes into account.
Because of the adaptation feature of the algorithm, it may adopt
to background changes, what algorithm can not do.
However, if moving object stays on the scene for a while (so algorithm adopts to it and does
not treat it as a new moving object any more) and then starts to move again, the algorithm may
find two moving objects - the true one, which is really moving, and the false one, which does not (the
place, where the object stayed for a while).
The algorithm is not applicable to such cases, when moving object resides
in camera's view most of the time (laptops camera monitoring a person sitting in front of it,
for example). The algorithm is mostly supposed for cases, when camera monitors some sort
of static scene, where moving objects appear from time to time - street, road, corridor, etc.
Sample usage:
// create motion detector
MotionDetector detector = new MotionDetector(
new SimpleBackgroundModelingDetector( ),
new MotionAreaHighlighting( ) );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame and check motion level
if ( detector.ProcessFrame( videoFrame ) > 0.02 )
{
// ring alarm or do somethng else
}
}
Difference threshold value, [1, 255].
The value specifies the amount off difference between pixels, which is treated
as motion pixel.
Default value is set to 15.
Motion level value, [0, 1].
Amount of changes in the last processed frame. For example, if value of
this property equals to 0.1, then it means that last processed frame has 10% difference
with modeled background frame.
Motion frame containing detected areas of motion.
Motion frame is a grayscale image, which shows areas of detected motion.
All black pixels in the motion frame correspond to areas, where no motion is
detected. But white pixels correspond to areas, where motion is detected.
The property is set to after processing of the first
video frame by the algorithm.
Suppress noise in video frames or not.
The value specifies if additional filtering should be
done to suppress standalone noisy pixels by applying 3x3 erosion image processing
filter. See property, if it is required to restore
edges of objects, which are not noise.
Default value is set to .
Turning the value on leads to more processing time of video frame.
Restore objects edges after noise suppression or not.
The value specifies if additional filtering should be done
to restore objects' edges after noise suppression by applying 3x3 dilation
image processing filter.
Default value is set to .
Turning the value on leads to more processing time of video frame.
Frames per background update, [1, 50].
The value controls the speed of modeled background adaptation to
scene changes. After each specified amount of frames the background frame is updated
in the direction to decrease difference with current processing frame.
Default value is set to 2.
The property has effect only in the case if
property is set to 0. Otherwise it does not have effect and background
update is managed according to the
property settings.
Milliseconds per background update, [0, 5000].
The value represents alternate way of controlling the speed of modeled
background adaptation to scene changes. The value sets number of milliseconds, which
should elapse between two consequent video frames to result in background update
for one intensity level. For example, if this value is set to 100 milliseconds and
the amount of time elapsed between two last video frames equals to 350, then background
frame will be update for 3 intensity levels in the direction to decrease difference
with current video frame (the remained 50 milliseconds will be added to time difference
between two next consequent frames, so the accuracy is preserved).
Unlike background update method controlled using
method, the method guided by this property is not affected by changes
in frame rates. If, for some reasons, a video source starts to provide delays between
frames (frame rate drops down), the amount of background update still stays consistent.
When background update is controlled by this property, it is always possible to estimate
amount of time required to change, for example, absolutely black background (0 intensity
values) into absolutely white background (255 intensity values). If value of this
property is set to 100, then it will take approximately 25.5 seconds for such update
regardless of frame rate.
Background update controlled by this property is slightly slower then
background update controlled by property,
so it has a bit greater impact on performance.
If this property is set to 0, then corresponding background updating
method is not used (turned off), but background update guided by
property is used.
Default value is set to 0.
Initializes a new instance of the class.
Initializes a new instance of the class.
Suppress noise in video frames or not (see property).
Initializes a new instance of the class.
Suppress noise in video frames or not (see property).
Restore objects edges after noise suppression or not (see property).
Process new video frame.
Video frame to process (detect motion in).
Processes new frame from video source and detects motion in it.
Check property to get information about amount of motion
(changes) in the processed frame.
Reset motion detector to initial state.
Resets internal state and variables of motion detection algorithm.
Usually this is required to be done before processing new video source, but
may be also done at any time to restart motion detection algorithm.
Motion detector based on two continues frames difference.
The class implements the simplest motion detection algorithm, which is
based on difference of two continues frames. The difference frame
is thresholded and the amount of difference pixels is calculated.
To suppress stand-alone noisy pixels erosion morphological operator may be applied, which
is controlled by property.
Although the class may be used on its own to perform motion detection, it is preferred
to use it in conjunction with class, which provides additional
features and allows to use moton post processing algorithms.
Sample usage:
// create motion detector
MotionDetector detector = new MotionDetector(
new TwoFramesDifferenceDetector( ),
new MotionAreaHighlighting( ) );
// continuously feed video frames to motion detector
while ( ... )
{
// process new video frame and check motion level
if ( detector.ProcessFrame( videoFrame ) > 0.02 )
{
// ring alarm or do somethng else
}
}
Difference threshold value, [1, 255].
The value specifies the amount off difference between pixels, which is treated
as motion pixel.
Default value is set to 15.
Motion level value, [0, 1].
Amount of changes in the last processed frame. For example, if value of
this property equals to 0.1, then it means that last processed frame has 10% difference
with previous frame.
Motion frame containing detected areas of motion.
Motion frame is a grayscale image, which shows areas of detected motion.
All black pixels in the motion frame correspond to areas, where no motion is
detected. But white pixels correspond to areas, where motion is detected.
The property is set to after processing of the first
video frame by the algorithm.
Suppress noise in video frames or not.
The value specifies if additional filtering should be
done to suppress standalone noisy pixels by applying 3x3 erosion image processing
filter.
Default value is set to .
Turning the value on leads to more processing time of video frame.
Initializes a new instance of the class.
Initializes a new instance of the class.
Suppress noise in video frames or not (see property).
Process new video frame.
Video frame to process (detect motion in).
Processes new frame from video source and detects motion in it.
Check property to get information about amount of motion
(changes) in the processed frame.
Reset motion detector to initial state.
Resets internal state and variables of motion detection algorithm.
Usually this is required to be done before processing new video source, but
may be also done at any time to restart motion detection algorithm.
Template matching object tracker.
The matching tracker will track the object presented in the search window
of the first frame given to the tracker. To reset the tracker and start
tracking another object, one can call the Reset method, then set the search
window around a new object of interest present the image containing the new
object to the tracker.
This is a very simple tracker that cannot handle size changes or occlusion.
The following example shows how to track an moving person from a video using the
VideoFileReader class, how to mark the object positions using ,
and save those frames as individual files to the disk.
Gets or sets the template being chased by the tracker.
Gets or sets the current search window.
Gets the current location of the object being tracked.
Gets or sets the similarity threshold to
determine when the object has been lost.
Default is 0.95.
Gets or sets at which similarity threshold the currently
tracked object should be re-registered as the new template
to look for. This can help track slowly changing objects.
Default is 0.99.
Gets or sets a value indicating whether the tracker should
extract the object image from the source. The extracted image
should be stored in .
Constructs a new object tracker.
Process a new video frame.
Resets this instance.
Modes for the Camshift Tracker.
By choosing RGB, the tracker will process raw high-intensity RGB values.
By choosing HSL, the tracker will perform a RGB-to-HSL conversion and use the Hue value instead.
By choosing Mixed, the tracker will use HSL with some lightness information.
Continuously Adaptive Mean Shift (Camshift) Object Tracker
Camshift stands for "Continuously Adaptive Mean Shift". It combines the basic
Mean Shift algorithm with an adaptive region-sizing step. The kernel is a step
function applied to a probability map. The probability of each image pixel is
based on color using a method called histogram backprojection.
The implementation of this code has used Gary Bradski's original publication,
the OpenCV Library and the FaceIt implementation as references. The OpenCV
library is distributed under a BSD license. FaceIt is distributed under a MIT
license. The original licensing terms for FaceIt are described in the source
code and in the Copyright.txt file accompanying the framework.
References:
-
G.R. Bradski, Computer video face tracking for use in a perceptual user interface,
Intel Technology Journal, Q2 1998. Available on:
ftp://download.intel.com/technology/itj/q21998/pdf/camshift.pdf
-
R. Hewitt, Face tracking project description: Camshift Algorithm. Available on:
http://www.robinhewitt.com/research/track/camshift.html
-
OpenCV Computer Vision Library. Available on:
http://sourceforge.net/projects/opencvlibrary/
-
FaceIt object tracking in Flash AS3. Available on:
http://www.libspark.org/browser/as3/FaceIt
Constructs a new Camshift tracking algorithm.
Constructs a new Camshift tracking algorithm.
Constructs a new Camshift tracking algorithm.
Constructs a new Camshift tracking algorithm.
Constructs a new Camshift tracking algorithm.
Gets or sets the current search window.
Gets or sets the desired window aspect ratio.
Gets or sets the mode of operation for this tracker.
If using HSL mode, specifies the operational saturation range for the tracker.
If using HSL mode, specifies the operational lightness range for the tracker.
Gets the location of the object being tracked.
Gets or sets a value indicating whether the tracker
should extract the object image from the source. The
extracted image will be available in .
Probability map
Gets or sets whether the algorithm should scan only the
active window or the entire image for histogram ratio.
Gets or sets a value indicating whether the angular
movements should be smoothed using a moving average.
true to smooth angular movements; otherwise, false.
Gets whether the tracking object is
showing little variation of fluctuation.
true if the tracking object is steady; otherwise, false.
Resets the object tracking algorithm.
Generates a image of the histogram back projection
Generates a image of the histogram backprojection
Generates a image of the histogram backprojection
Generates a image of the histogram backprojection
Processes a new video frame.
Camshift algorithm
Mean shift algorithm
Computes the ratio histogram between to histograms.
http://www.robinhewitt.com/research/track/backproject.html
Image histogram back-projection.
Creates a color histogram discarding low intensity colors
Checks for aberrant fluctuations in the tracking object.
Blob object tracker.
Gets or sets the maximum width of tracked objects.
Gets or sets the maximum height of tracked objects.
Gets or sets the minimum width of tracked objects.
Gets or sets the minimum height of tracked objects.
Gets or sets a value indicating whether the tracker
should extract the object image from the source. The
extracted image will be available in .
Gets or sets whether the tracker should compute blob's orientation.
Gets the HSL filter used in color segmentation.
The HSL filter used in segmentation.
Gets the HSL filtered image.
Gets the current location of the object being tracked.
Initializes a new instance of the class.
Initializes a new instance of the class.
The filter.
Process a new video frame.
Resets this instance.
Object tracker interface.
Gets the current location of the object being tracked.
Process a new video frame.
Gets or sets a value indicating whether the tracker should
extract the object image from the source. The extracted image
should be stored in .
Axis orientation.
Horizontal axis.
Vertical axis.
Tracking object to represent an object in a scene.
Gets or sets an user-defined tag associated with this object.
Gets or sets the rectangle containing the object.
Gets or sets the center of gravity of the object
relative to the original image from where it has
been extracted.
Gets or sets the object's extracted image.
Gets a value indicating whether the object is empty.
true if this instance is empty; otherwise, false.
Gets the area of the object.
Gets or sets the angle of the object.
Constructs a new tracking object.
Constructs a new tracking object.
The center of gravity of the object.
Constructs a new tracking object.
The angle of orientation for the object.
The center of gravity of the object.
The rectangle containing the object.
Constructs a new tracking object.
The rectangle containing the object.
The angle of the object.
Gets two points defining the horizontal axis of the object.
Gets two points defining the axis of the object.
Resets this tracking object.
Creates a new object that is a copy of the current instance.
A new object that is a copy of this instance.
Creates a new object that is a copy of the current instance.
A new object that is a copy of this instance.
Pass true to not include
the in the copy object.