View Source Evision.CascadeClassifier (Evision v0.2.9)
Summary
Functions
CascadeClassifier
Loads a classifier from a file.
convert
detectMultiScale2
detectMultiScale2
detectMultiScale3
detectMultiScale3
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
Checks whether the classifier has been loaded.
getFeatureType
getOriginalWindowSize
isOldFormatCascade
Loads a classifier from a file.
Reads a classifier from a FileStorage node.
Types
@type t() :: %Evision.CascadeClassifier{ref: reference()}
Type that represents an CascadeClassifier
struct.
ref.
reference()
The underlying erlang resource variable.
Functions
CascadeClassifier
Return
- self:
Evision.CascadeClassifier.t()
Python prototype (for reference only):
CascadeClassifier() -> <CascadeClassifier object>
@spec cascadeClassifier(Keyword.t()) :: any() | {:error, String.t()}
@spec cascadeClassifier(binary()) :: t() | {:error, String.t()}
Loads a classifier from a file.
Positional Arguments
filename:
String
.Name of the file from which the classifier is loaded.
Return
- self:
Evision.CascadeClassifier.t()
Python prototype (for reference only):
CascadeClassifier(filename) -> <CascadeClassifier object>
convert
Positional Arguments
Return
- retval:
bool
Python prototype (for reference only):
convert(oldcascade, newcascade) -> retval
@spec detectMultiScale2(t(), Evision.Mat.maybe_mat_in()) :: {[{number(), number(), number(), number()}], [integer()]} | {:error, String.t()}
detectMultiScale2
Positional Arguments
self:
Evision.CascadeClassifier.t()
image:
Evision.Mat
.Matrix of the type CV_8U containing an image where objects are detected.
Keyword Arguments
scaleFactor:
double
.Parameter specifying how much the image size is reduced at each image scale.
minNeighbors:
integer()
.Parameter specifying how many neighbors each candidate rectangle should have to retain it.
flags:
integer()
.Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSize:
Size
.Minimum possible object size. Objects smaller than that are ignored.
maxSize:
Size
.Maximum possible object size. Objects larger than that are ignored. If
maxSize == minSize
model is evaluated on single scale.
Return
objects:
[Rect]
.Vector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetections:
[integer()]
.Vector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
Has overloading in C++
Python prototype (for reference only):
detectMultiScale2(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects, numDetections
@spec detectMultiScale2( t(), Evision.Mat.maybe_mat_in(), [ flags: term(), maxSize: term(), minNeighbors: term(), minSize: term(), scaleFactor: term() ] | nil ) :: {[{number(), number(), number(), number()}], [integer()]} | {:error, String.t()}
detectMultiScale2
Positional Arguments
self:
Evision.CascadeClassifier.t()
image:
Evision.Mat
.Matrix of the type CV_8U containing an image where objects are detected.
Keyword Arguments
scaleFactor:
double
.Parameter specifying how much the image size is reduced at each image scale.
minNeighbors:
integer()
.Parameter specifying how many neighbors each candidate rectangle should have to retain it.
flags:
integer()
.Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSize:
Size
.Minimum possible object size. Objects smaller than that are ignored.
maxSize:
Size
.Maximum possible object size. Objects larger than that are ignored. If
maxSize == minSize
model is evaluated on single scale.
Return
objects:
[Rect]
.Vector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetections:
[integer()]
.Vector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
Has overloading in C++
Python prototype (for reference only):
detectMultiScale2(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects, numDetections
@spec detectMultiScale3(t(), Evision.Mat.maybe_mat_in()) :: {[{number(), number(), number(), number()}], [integer()], [number()]} | {:error, String.t()}
detectMultiScale3
Positional Arguments
- self:
Evision.CascadeClassifier.t()
- image:
Evision.Mat
Keyword Arguments
- scaleFactor:
double
. - minNeighbors:
integer()
. - flags:
integer()
. - minSize:
Size
. - maxSize:
Size
. - outputRejectLevels:
bool
.
Return
- objects:
[Rect]
- rejectLevels:
[integer()]
- levelWeights:
[double]
Has overloading in C++
This function allows you to retrieve the final stage decision certainty of classification.
For this, one needs to set outputRejectLevels
on true and provide the rejectLevels
and levelWeights
parameter.
For each resulting detection, levelWeights
will then contain the certainty of classification at the final stage.
This value can then be used to separate strong from weaker classifications.
A code sample on how to use it efficiently can be found below:
Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;
Python prototype (for reference only):
detectMultiScale3(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize[, outputRejectLevels]]]]]]) -> objects, rejectLevels, levelWeights
@spec detectMultiScale3( t(), Evision.Mat.maybe_mat_in(), [ flags: term(), maxSize: term(), minNeighbors: term(), minSize: term(), outputRejectLevels: term(), scaleFactor: term() ] | nil ) :: {[{number(), number(), number(), number()}], [integer()], [number()]} | {:error, String.t()}
detectMultiScale3
Positional Arguments
- self:
Evision.CascadeClassifier.t()
- image:
Evision.Mat
Keyword Arguments
- scaleFactor:
double
. - minNeighbors:
integer()
. - flags:
integer()
. - minSize:
Size
. - maxSize:
Size
. - outputRejectLevels:
bool
.
Return
- objects:
[Rect]
- rejectLevels:
[integer()]
- levelWeights:
[double]
Has overloading in C++
This function allows you to retrieve the final stage decision certainty of classification.
For this, one needs to set outputRejectLevels
on true and provide the rejectLevels
and levelWeights
parameter.
For each resulting detection, levelWeights
will then contain the certainty of classification at the final stage.
This value can then be used to separate strong from weaker classifications.
A code sample on how to use it efficiently can be found below:
Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;
Python prototype (for reference only):
detectMultiScale3(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize[, outputRejectLevels]]]]]]) -> objects, rejectLevels, levelWeights
@spec detectMultiScale(t(), Evision.Mat.maybe_mat_in()) :: [{number(), number(), number(), number()}] | {:error, String.t()}
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
Positional Arguments
self:
Evision.CascadeClassifier.t()
image:
Evision.Mat
.Matrix of the type CV_8U containing an image where objects are detected.
Keyword Arguments
scaleFactor:
double
.Parameter specifying how much the image size is reduced at each image scale.
minNeighbors:
integer()
.Parameter specifying how many neighbors each candidate rectangle should have to retain it.
flags:
integer()
.Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSize:
Size
.Minimum possible object size. Objects smaller than that are ignored.
maxSize:
Size
.Maximum possible object size. Objects larger than that are ignored. If
maxSize == minSize
model is evaluated on single scale.
Return
objects:
[Rect]
.Vector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
Python prototype (for reference only):
detectMultiScale(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects
@spec detectMultiScale( t(), Evision.Mat.maybe_mat_in(), [ flags: term(), maxSize: term(), minNeighbors: term(), minSize: term(), scaleFactor: term() ] | nil ) :: [{number(), number(), number(), number()}] | {:error, String.t()}
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
Positional Arguments
self:
Evision.CascadeClassifier.t()
image:
Evision.Mat
.Matrix of the type CV_8U containing an image where objects are detected.
Keyword Arguments
scaleFactor:
double
.Parameter specifying how much the image size is reduced at each image scale.
minNeighbors:
integer()
.Parameter specifying how many neighbors each candidate rectangle should have to retain it.
flags:
integer()
.Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSize:
Size
.Minimum possible object size. Objects smaller than that are ignored.
maxSize:
Size
.Maximum possible object size. Objects larger than that are ignored. If
maxSize == minSize
model is evaluated on single scale.
Return
objects:
[Rect]
.Vector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
Python prototype (for reference only):
detectMultiScale(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects
@spec empty(Keyword.t()) :: any() | {:error, String.t()}
@spec empty(t()) :: boolean() | {:error, String.t()}
Checks whether the classifier has been loaded.
Positional Arguments
- self:
Evision.CascadeClassifier.t()
Return
- retval:
bool
Python prototype (for reference only):
empty() -> retval
@spec getFeatureType(Keyword.t()) :: any() | {:error, String.t()}
@spec getFeatureType(t()) :: integer() | {:error, String.t()}
getFeatureType
Positional Arguments
- self:
Evision.CascadeClassifier.t()
Return
- retval:
integer()
Python prototype (for reference only):
getFeatureType() -> retval
@spec getOriginalWindowSize(Keyword.t()) :: any() | {:error, String.t()}
@spec getOriginalWindowSize(t()) :: {number(), number()} | {:error, String.t()}
getOriginalWindowSize
Positional Arguments
- self:
Evision.CascadeClassifier.t()
Return
- retval:
Size
Python prototype (for reference only):
getOriginalWindowSize() -> retval
@spec isOldFormatCascade(Keyword.t()) :: any() | {:error, String.t()}
@spec isOldFormatCascade(t()) :: boolean() | {:error, String.t()}
isOldFormatCascade
Positional Arguments
- self:
Evision.CascadeClassifier.t()
Return
- retval:
bool
Python prototype (for reference only):
isOldFormatCascade() -> retval
Loads a classifier from a file.
Positional Arguments
self:
Evision.CascadeClassifier.t()
filename:
String
.Name of the file from which the classifier is loaded. The file may contain an old HAAR classifier trained by the haartraining application or a new cascade classifier trained by the traincascade application.
Return
- retval:
bool
Python prototype (for reference only):
load(filename) -> retval
@spec read(t(), Evision.FileNode.t()) :: boolean() | {:error, String.t()}
Reads a classifier from a FileStorage node.
Positional Arguments
- self:
Evision.CascadeClassifier.t()
- node:
Evision.FileNode
Return
- retval:
bool
Note: The file may contain a new cascade classifier (trained by the traincascade application) only.
Python prototype (for reference only):
read(node) -> retval