View Source Evision.CascadeClassifier (Evision v0.1.37)

Summary

Types

t()

Type that represents an CascadeClassifier struct.

Functions

CascadeClassifier

Loads a classifier from a file.

detectMultiScale2

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

@spec cascadeClassifier() :: t() | {:error, String.t()}

CascadeClassifier

Return
  • self: Evision.CascadeClassifier.t()

Python prototype (for reference only):

CascadeClassifier() -> <CascadeClassifier object>
Link to this function

cascadeClassifier(filename)

View Source
@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>
Link to this function

convert(oldcascade, newcascade)

View Source
@spec convert(binary(), binary()) :: boolean() | {:error, String.t()}

convert

Positional Arguments
Return
  • retval: bool

Python prototype (for reference only):

convert(oldcascade, newcascade) -> retval
Link to this function

detectMultiScale2(self, image)

View Source
@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.t().

    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: int.

    Parameter specifying how many neighbors each candidate rectangle should have to retain it.

  • flags: int.

    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: [int].

    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
Link to this function

detectMultiScale2(self, image, opts)

View Source
@spec detectMultiScale2(
  t(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) ::
  {[{number(), number(), number(), number()}], [integer()]}
  | {:error, String.t()}

detectMultiScale2

Positional Arguments
  • self: Evision.CascadeClassifier.t()

  • image: Evision.Mat.t().

    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: int.

    Parameter specifying how many neighbors each candidate rectangle should have to retain it.

  • flags: int.

    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: [int].

    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
Link to this function

detectMultiScale3(self, image)

View Source
@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.t()
Keyword Arguments
  • scaleFactor: double.
  • minNeighbors: int.
  • flags: int.
  • minSize: Size.
  • maxSize: Size.
  • outputRejectLevels: bool.
Return
  • objects: [Rect]
  • rejectLevels: [int]
  • 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
Link to this function

detectMultiScale3(self, image, opts)

View Source
@spec detectMultiScale3(
  t(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) ::
  {[{number(), number(), number(), number()}], [integer()], [number()]}
  | {:error, String.t()}

detectMultiScale3

Positional Arguments
  • self: Evision.CascadeClassifier.t()
  • image: Evision.Mat.t()
Keyword Arguments
  • scaleFactor: double.
  • minNeighbors: int.
  • flags: int.
  • minSize: Size.
  • maxSize: Size.
  • outputRejectLevels: bool.
Return
  • objects: [Rect]
  • rejectLevels: [int]
  • 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
Link to this function

detectMultiScale(self, image)

View Source
@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.t().

    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: int.

    Parameter specifying how many neighbors each candidate rectangle should have to retain it.

  • flags: int.

    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
Link to this function

detectMultiScale(self, image, opts)

View Source
@spec detectMultiScale(t(), Evision.Mat.maybe_mat_in(), [{atom(), 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.t().

    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: int.

    Parameter specifying how many neighbors each candidate rectangle should have to retain it.

  • flags: int.

    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(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(t()) :: integer() | {:error, String.t()}

getFeatureType

Positional Arguments
  • self: Evision.CascadeClassifier.t()
Return
  • retval: int

Python prototype (for reference only):

getFeatureType() -> retval
Link to this function

getOriginalWindowSize(self)

View Source
@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
Link to this function

isOldFormatCascade(self)

View Source
@spec isOldFormatCascade(t()) :: boolean() | {:error, String.t()}

isOldFormatCascade

Positional Arguments
  • self: Evision.CascadeClassifier.t()
Return
  • retval: bool

Python prototype (for reference only):

isOldFormatCascade() -> retval
@spec load(t(), binary()) :: boolean() | {:error, String.t()}

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.t()
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