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

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

getDefaultName

getFindLargestObject

getMaxNumObjects

getMaxObjectSize

getMinNeighbors

getMinObjectSize

getScaleFactor

Reads algorithm parameters from a file storage

Stores algorithm parameters in a file storage

Link to this section Types

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

Type that represents an CUDA.CascadeClassifier struct.

  • ref. reference()

    The underlying erlang resource variable.

Link to this section Functions

Clears the algorithm state

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

Python prototype (for reference only):

clear() -> None
@spec convert(Evision.CascadeClassifier.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(
  Evision.CascadeClassifier.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(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(self, image)

View Source
@spec detectMultiScale(Evision.CascadeClassifier.t(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | {:error, String.t()}
@spec detectMultiScale(Evision.CascadeClassifier.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.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.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(
  Evision.CascadeClassifier.t(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) :: Evision.Mat.t() | {:error, String.t()}
@spec detectMultiScale(
  Evision.CascadeClassifier.t(),
  Evision.CUDA.GpuMat.t(),
  [{atom(), 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.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.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(Evision.CascadeClassifier.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
@spec getClassifierSize(Evision.CascadeClassifier.t()) ::
  {number(), number()} | {:error, String.t()}

getClassifierSize

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

Python prototype (for reference only):

getClassifierSize() -> retval
@spec getDefaultName(Evision.CascadeClassifier.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(self)

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

getFindLargestObject

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

Python prototype (for reference only):

getFindLargestObject() -> retval
@spec getMaxNumObjects(Evision.CascadeClassifier.t()) ::
  integer() | {:error, String.t()}

getMaxNumObjects

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

Python prototype (for reference only):

getMaxNumObjects() -> retval
@spec getMaxObjectSize(Evision.CascadeClassifier.t()) ::
  {number(), number()} | {:error, String.t()}

getMaxObjectSize

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

Python prototype (for reference only):

getMaxObjectSize() -> retval
@spec getMinNeighbors(Evision.CascadeClassifier.t()) ::
  integer() | {:error, String.t()}

getMinNeighbors

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

Python prototype (for reference only):

getMinNeighbors() -> retval
@spec getMinObjectSize(Evision.CascadeClassifier.t()) ::
  {number(), number()} | {:error, String.t()}

getMinObjectSize

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

Python prototype (for reference only):

getMinObjectSize() -> retval
@spec getScaleFactor(Evision.CascadeClassifier.t()) :: number() | {:error, String.t()}

getScaleFactor

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

Python prototype (for reference only):

getScaleFactor() -> retval

Reads algorithm parameters from a file storage

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

Python prototype (for reference only):

read(fn_) -> None

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(self, findLargestObject)

View Source
@spec setFindLargestObject(Evision.CascadeClassifier.t(), boolean()) ::
  Evision.CascadeClassifier.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(self, maxNumObjects)

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

setMaxNumObjects

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

Python prototype (for reference only):

setMaxNumObjects(maxNumObjects) -> None
Link to this function

setMaxObjectSize(self, maxObjectSize)

View Source
@spec setMaxObjectSize(
  Evision.CascadeClassifier.t(),
  {number(), number()}
) :: Evision.CascadeClassifier.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(self, minNeighbors)

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

setMinNeighbors

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

Python prototype (for reference only):

setMinNeighbors(minNeighbors) -> None
Link to this function

setMinObjectSize(self, minSize)

View Source
@spec setMinObjectSize(
  Evision.CascadeClassifier.t(),
  {number(), number()}
) :: Evision.CascadeClassifier.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(self, scaleFactor)

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

setScaleFactor

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

Python prototype (for reference only):

setScaleFactor(scaleFactor) -> None

Stores algorithm parameters in a file storage

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

Python prototype (for reference only):

write(fs) -> None

write

Positional Arguments
  • self: Evision.CUDA.CascadeClassifier.t()
  • fs: Evision.FileStorage.t()
  • name: String

Has overloading in C++

Python prototype (for reference only):

write(fs, name) -> None