View Source Evision.CUDA.CascadeClassifier (Evision v0.2.9)

Summary

Types

t()

Type that represents an CUDA.CascadeClassifier struct.

Functions

Clears the algorithm state

Converts objects array from internal representation to standard vector.

Converts objects array from internal representation to standard vector.

Loads the classifier from a file. Cascade type is detected automatically by constructor parameter.

Variant 1:

Detects objects of different sizes in the input image.

Variant 1:

Detects objects of different sizes in the input image.

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read

getClassifierSize

getFindLargestObject

getMaxNumObjects

getMaxObjectSize

getMinNeighbors

getMinObjectSize

Reads algorithm parameters from a file storage

Stores algorithm parameters in a file storage

Types

@type t() :: %Evision.CUDA.CascadeClassifier{ref: reference()}

Type that represents an CUDA.CascadeClassifier struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec clear(Keyword.t()) :: any() | {:error, String.t()}
@spec clear(t()) :: t() | {:error, String.t()}

Clears the algorithm state

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

Python prototype (for reference only):

clear() -> None
@spec convert(Keyword.t()) :: any() | {:error, String.t()}
@spec convert(t(), [{number(), number(), number(), number()}]) ::
  Evision.Mat.t() | {:error, String.t()}

Converts objects array from internal representation to standard vector.

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

  • objects: [Rect].

    Resulting array.

Return
  • gpu_objects: Evision.Mat.t().

    Objects array in internal representation.

Python prototype (for reference only):

convert(objects[, gpu_objects]) -> gpu_objects
Link to this function

convert(self, objects, opts)

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

Converts objects array from internal representation to standard vector.

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

  • objects: [Rect].

    Resulting array.

Return
  • gpu_objects: Evision.Mat.t().

    Objects array in internal representation.

Python prototype (for reference only):

convert(objects[, gpu_objects]) -> gpu_objects
@spec create(Keyword.t()) :: any() | {:error, String.t()}
@spec create(binary()) :: t() | {:error, String.t()}

Loads the classifier from a file. Cascade type is detected automatically by constructor parameter.

Positional Arguments
  • filename: String.

    Name of the file from which the classifier is loaded. Only the old haar classifier (trained by the haar training application) and NVIDIA's nvbin are supported for HAAR and only new type of OpenCV XML cascade supported for LBP. The working haar models can be found at opencv_folder/data/haarcascades_cuda/

Return
  • retval: Evision.CUDA.CascadeClassifier.t()

Python prototype (for reference only):

create(filename) -> retval
Link to this function

detectMultiScale(named_args)

View Source
@spec detectMultiScale(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

detectMultiScale(self, image)

View Source
@spec detectMultiScale(t(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | {:error, String.t()}
@spec detectMultiScale(t(), Evision.CUDA.GpuMat.t()) ::
  Evision.CUDA.GpuMat.t() | {:error, String.t()}

Variant 1:

Detects objects of different sizes in the input image.

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

  • image: Evision.Mat.

    Matrix of type CV_8U containing an image where objects should be detected.

Keyword Arguments
  • stream: Evision.CUDA.Stream.t().

    CUDA stream.

Return
  • objects: Evision.Mat.t().

    Buffer to store detected objects (rectangles).

To get final array of detected objects use CascadeClassifier::convert method.

Ptr<cuda::CascadeClassifier> cascade_gpu = cuda::CascadeClassifier::create(...);
Mat image_cpu = imread(...)
GpuMat image_gpu(image_cpu);
GpuMat objbuf;
cascade_gpu->detectMultiScale(image_gpu, objbuf);
std::vector<Rect> faces;
cascade_gpu->convert(objbuf, faces);
for(int i = 0; i < detections_num; ++i)
cv::rectangle(image_cpu, faces[i], Scalar(255));
imshow("Faces", image_cpu);

@sa CascadeClassifier::detectMultiScale

Python prototype (for reference only):

detectMultiScale(image[, objects[, stream]]) -> objects

Variant 2:

Detects objects of different sizes in the input image.

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

  • image: Evision.CUDA.GpuMat.t().

    Matrix of type CV_8U containing an image where objects should be detected.

Keyword Arguments
  • stream: Evision.CUDA.Stream.t().

    CUDA stream.

Return
  • objects: Evision.CUDA.GpuMat.t().

    Buffer to store detected objects (rectangles).

To get final array of detected objects use CascadeClassifier::convert method.

Ptr<cuda::CascadeClassifier> cascade_gpu = cuda::CascadeClassifier::create(...);
Mat image_cpu = imread(...)
GpuMat image_gpu(image_cpu);
GpuMat objbuf;
cascade_gpu->detectMultiScale(image_gpu, objbuf);
std::vector<Rect> faces;
cascade_gpu->convert(objbuf, faces);
for(int i = 0; i < detections_num; ++i)
cv::rectangle(image_cpu, faces[i], Scalar(255));
imshow("Faces", image_cpu);

@sa CascadeClassifier::detectMultiScale

Python prototype (for reference only):

detectMultiScale(image[, objects[, stream]]) -> objects
Link to this function

detectMultiScale(self, image, opts)

View Source
@spec detectMultiScale(t(), Evision.Mat.maybe_mat_in(), [{:stream, term()}] | nil) ::
  Evision.Mat.t() | {:error, String.t()}
@spec detectMultiScale(t(), Evision.CUDA.GpuMat.t(), [{:stream, term()}] | nil) ::
  Evision.CUDA.GpuMat.t() | {:error, String.t()}

Variant 1:

Detects objects of different sizes in the input image.

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

  • image: Evision.Mat.

    Matrix of type CV_8U containing an image where objects should be detected.

Keyword Arguments
  • stream: Evision.CUDA.Stream.t().

    CUDA stream.

Return
  • objects: Evision.Mat.t().

    Buffer to store detected objects (rectangles).

To get final array of detected objects use CascadeClassifier::convert method.

Ptr<cuda::CascadeClassifier> cascade_gpu = cuda::CascadeClassifier::create(...);
Mat image_cpu = imread(...)
GpuMat image_gpu(image_cpu);
GpuMat objbuf;
cascade_gpu->detectMultiScale(image_gpu, objbuf);
std::vector<Rect> faces;
cascade_gpu->convert(objbuf, faces);
for(int i = 0; i < detections_num; ++i)
cv::rectangle(image_cpu, faces[i], Scalar(255));
imshow("Faces", image_cpu);

@sa CascadeClassifier::detectMultiScale

Python prototype (for reference only):

detectMultiScale(image[, objects[, stream]]) -> objects

Variant 2:

Detects objects of different sizes in the input image.

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

  • image: Evision.CUDA.GpuMat.t().

    Matrix of type CV_8U containing an image where objects should be detected.

Keyword Arguments
  • stream: Evision.CUDA.Stream.t().

    CUDA stream.

Return
  • objects: Evision.CUDA.GpuMat.t().

    Buffer to store detected objects (rectangles).

To get final array of detected objects use CascadeClassifier::convert method.

Ptr<cuda::CascadeClassifier> cascade_gpu = cuda::CascadeClassifier::create(...);
Mat image_cpu = imread(...)
GpuMat image_gpu(image_cpu);
GpuMat objbuf;
cascade_gpu->detectMultiScale(image_gpu, objbuf);
std::vector<Rect> faces;
cascade_gpu->convert(objbuf, faces);
for(int i = 0; i < detections_num; ++i)
cv::rectangle(image_cpu, faces[i], Scalar(255));
imshow("Faces", image_cpu);

@sa CascadeClassifier::detectMultiScale

Python prototype (for reference only):

detectMultiScale(image[, objects[, stream]]) -> objects
@spec empty(Keyword.t()) :: any() | {:error, String.t()}
@spec empty(t()) :: boolean() | {:error, String.t()}

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read

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

Python prototype (for reference only):

empty() -> retval
Link to this function

getClassifierSize(named_args)

View Source
@spec getClassifierSize(Keyword.t()) :: any() | {:error, String.t()}
@spec getClassifierSize(t()) :: {number(), number()} | {:error, String.t()}

getClassifierSize

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

Python prototype (for reference only):

getClassifierSize() -> retval
Link to this function

getDefaultName(named_args)

View Source
@spec getDefaultName(Keyword.t()) :: any() | {:error, String.t()}
@spec getDefaultName(t()) :: binary() | {:error, String.t()}

getDefaultName

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

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.

Python prototype (for reference only):

getDefaultName() -> retval
Link to this function

getFindLargestObject(named_args)

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

getFindLargestObject

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

Python prototype (for reference only):

getFindLargestObject() -> retval
Link to this function

getMaxNumObjects(named_args)

View Source
@spec getMaxNumObjects(Keyword.t()) :: any() | {:error, String.t()}
@spec getMaxNumObjects(t()) :: integer() | {:error, String.t()}

getMaxNumObjects

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

Python prototype (for reference only):

getMaxNumObjects() -> retval
Link to this function

getMaxObjectSize(named_args)

View Source
@spec getMaxObjectSize(Keyword.t()) :: any() | {:error, String.t()}
@spec getMaxObjectSize(t()) :: {number(), number()} | {:error, String.t()}

getMaxObjectSize

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

Python prototype (for reference only):

getMaxObjectSize() -> retval
Link to this function

getMinNeighbors(named_args)

View Source
@spec getMinNeighbors(Keyword.t()) :: any() | {:error, String.t()}
@spec getMinNeighbors(t()) :: integer() | {:error, String.t()}

getMinNeighbors

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

Python prototype (for reference only):

getMinNeighbors() -> retval
Link to this function

getMinObjectSize(named_args)

View Source
@spec getMinObjectSize(Keyword.t()) :: any() | {:error, String.t()}
@spec getMinObjectSize(t()) :: {number(), number()} | {:error, String.t()}

getMinObjectSize

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

Python prototype (for reference only):

getMinObjectSize() -> retval
Link to this function

getScaleFactor(named_args)

View Source
@spec getScaleFactor(Keyword.t()) :: any() | {:error, String.t()}
@spec getScaleFactor(t()) :: number() | {:error, String.t()}

getScaleFactor

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

Python prototype (for reference only):

getScaleFactor() -> retval
@spec read(Keyword.t()) :: any() | {:error, String.t()}
@spec read(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}

Reads algorithm parameters from a file storage

Positional Arguments

Python prototype (for reference only):

read(fn) -> None
@spec save(Keyword.t()) :: any() | {:error, String.t()}
@spec save(t(), binary()) :: t() | {:error, String.t()}

save

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • filename: String

Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).

Python prototype (for reference only):

save(filename) -> None
Link to this function

setFindLargestObject(named_args)

View Source
@spec setFindLargestObject(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setFindLargestObject(self, findLargestObject)

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

setFindLargestObject

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • findLargestObject: bool

Python prototype (for reference only):

setFindLargestObject(findLargestObject) -> None
Link to this function

setMaxNumObjects(named_args)

View Source
@spec setMaxNumObjects(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMaxNumObjects(self, maxNumObjects)

View Source
@spec setMaxNumObjects(t(), integer()) :: t() | {:error, String.t()}

setMaxNumObjects

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • maxNumObjects: integer()

Python prototype (for reference only):

setMaxNumObjects(maxNumObjects) -> None
Link to this function

setMaxObjectSize(named_args)

View Source
@spec setMaxObjectSize(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMaxObjectSize(self, maxObjectSize)

View Source
@spec setMaxObjectSize(
  t(),
  {number(), number()}
) :: t() | {:error, String.t()}

setMaxObjectSize

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • maxObjectSize: Size

Has overloading in C++

Python prototype (for reference only):

setMaxObjectSize(maxObjectSize) -> None
Link to this function

setMinNeighbors(named_args)

View Source
@spec setMinNeighbors(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMinNeighbors(self, minNeighbors)

View Source
@spec setMinNeighbors(t(), integer()) :: t() | {:error, String.t()}

setMinNeighbors

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • minNeighbors: integer()

Python prototype (for reference only):

setMinNeighbors(minNeighbors) -> None
Link to this function

setMinObjectSize(named_args)

View Source
@spec setMinObjectSize(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMinObjectSize(self, minSize)

View Source
@spec setMinObjectSize(
  t(),
  {number(), number()}
) :: t() | {:error, String.t()}

setMinObjectSize

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • minSize: Size

Python prototype (for reference only):

setMinObjectSize(minSize) -> None
Link to this function

setScaleFactor(named_args)

View Source
@spec setScaleFactor(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setScaleFactor(self, scaleFactor)

View Source
@spec setScaleFactor(t(), number()) :: t() | {:error, String.t()}

setScaleFactor

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • scaleFactor: double

Python prototype (for reference only):

setScaleFactor(scaleFactor) -> None
@spec write(Keyword.t()) :: any() | {:error, String.t()}
@spec write(t(), Evision.FileStorage.t()) :: t() | {:error, String.t()}

Stores algorithm parameters in a file storage

Positional Arguments

Python prototype (for reference only):

write(fs) -> None
@spec write(t(), Evision.FileStorage.t(), binary()) :: t() | {:error, String.t()}

write

Positional Arguments

Has overloading in C++

Python prototype (for reference only):

write(fs, name) -> None