mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Removed Sphinx documentation files
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
Camera Calibration and 3D Reconstruction
|
||||
========================================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
cuda::solvePnPRansac
|
||||
--------------------
|
||||
Finds the object pose from 3D-2D point correspondences.
|
||||
|
||||
.. ocv:function:: void cuda::solvePnPRansac(const Mat& object, const Mat& image, const Mat& camera_mat, const Mat& dist_coef, Mat& rvec, Mat& tvec, bool use_extrinsic_guess=false, int num_iters=100, float max_dist=8.0, int min_inlier_count=100, vector<int>* inliers=NULL)
|
||||
|
||||
:param object: Single-row matrix of object points.
|
||||
|
||||
:param image: Single-row matrix of image points.
|
||||
|
||||
:param camera_mat: 3x3 matrix of intrinsic camera parameters.
|
||||
|
||||
:param dist_coef: Distortion coefficients. See :ocv:func:`undistortPoints` for details.
|
||||
|
||||
:param rvec: Output 3D rotation vector.
|
||||
|
||||
:param tvec: Output 3D translation vector.
|
||||
|
||||
:param use_extrinsic_guess: Flag to indicate that the function must use ``rvec`` and ``tvec`` as an initial transformation guess. It is not supported for now.
|
||||
|
||||
:param num_iters: Maximum number of RANSAC iterations.
|
||||
|
||||
:param max_dist: Euclidean distance threshold to detect whether point is inlier or not.
|
||||
|
||||
:param min_inlier_count: Flag to indicate that the function must stop if greater or equal number of inliers is achieved. It is not supported for now.
|
||||
|
||||
:param inliers: Output vector of inlier indices.
|
||||
|
||||
.. seealso:: :ocv:func:`solvePnPRansac`
|
||||
@@ -1,12 +0,0 @@
|
||||
**************************************
|
||||
cuda. CUDA-accelerated Computer Vision
|
||||
**************************************
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
introduction
|
||||
initalization_and_information
|
||||
data_structures
|
||||
object_detection
|
||||
calib3d
|
||||
@@ -1,311 +0,0 @@
|
||||
Data Structures
|
||||
===============
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
cuda::PtrStepSz
|
||||
---------------
|
||||
.. ocv:class:: cuda::PtrStepSz
|
||||
|
||||
Lightweight class encapsulating pitched memory on a GPU and passed to nvcc-compiled code (CUDA kernels). Typically, it is used internally by OpenCV and by users who write device code. You can call its members from both host and device code. ::
|
||||
|
||||
template <typename T> struct PtrStepSz : public PtrStep<T>
|
||||
{
|
||||
__CV_GPU_HOST_DEVICE__ PtrStepSz() : cols(0), rows(0) {}
|
||||
__CV_GPU_HOST_DEVICE__ PtrStepSz(int rows_, int cols_, T* data_, size_t step_)
|
||||
: PtrStep<T>(data_, step_), cols(cols_), rows(rows_) {}
|
||||
|
||||
template <typename U>
|
||||
explicit PtrStepSz(const PtrStepSz<U>& d) : PtrStep<T>((T*)d.data, d.step), cols(d.cols), rows(d.rows){}
|
||||
|
||||
int cols;
|
||||
int rows;
|
||||
};
|
||||
|
||||
typedef PtrStepSz<unsigned char> PtrStepSzb;
|
||||
typedef PtrStepSz<float> PtrStepSzf;
|
||||
typedef PtrStepSz<int> PtrStepSzi;
|
||||
|
||||
|
||||
|
||||
cuda::PtrStep
|
||||
-------------
|
||||
.. ocv:class:: cuda::PtrStep
|
||||
|
||||
Structure similar to :ocv:class:`cuda::PtrStepSz` but containing only a pointer and row step. Width and height fields are excluded due to performance reasons. The structure is intended for internal use or for users who write device code. ::
|
||||
|
||||
template <typename T> struct PtrStep : public DevPtr<T>
|
||||
{
|
||||
__CV_GPU_HOST_DEVICE__ PtrStep() : step(0) {}
|
||||
__CV_GPU_HOST_DEVICE__ PtrStep(T* data_, size_t step_) : DevPtr<T>(data_), step(step_) {}
|
||||
|
||||
//! stride between two consecutive rows in bytes. Step is stored always and everywhere in bytes!!!
|
||||
size_t step;
|
||||
|
||||
__CV_GPU_HOST_DEVICE__ T* ptr(int y = 0) { return ( T*)( ( char*)DevPtr<T>::data + y * step); }
|
||||
__CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const { return (const T*)( (const char*)DevPtr<T>::data + y * step); }
|
||||
|
||||
__CV_GPU_HOST_DEVICE__ T& operator ()(int y, int x) { return ptr(y)[x]; }
|
||||
__CV_GPU_HOST_DEVICE__ const T& operator ()(int y, int x) const { return ptr(y)[x]; }
|
||||
};
|
||||
|
||||
typedef PtrStep<unsigned char> PtrStepb;
|
||||
typedef PtrStep<float> PtrStepf;
|
||||
typedef PtrStep<int> PtrStepi;
|
||||
|
||||
|
||||
|
||||
cuda::GpuMat
|
||||
------------
|
||||
.. ocv:class:: cuda::GpuMat
|
||||
|
||||
Base storage class for GPU memory with reference counting. Its interface matches the :ocv:class:`Mat` interface with the following limitations:
|
||||
|
||||
* no arbitrary dimensions support (only 2D)
|
||||
* no functions that return references to their data (because references on GPU are not valid for CPU)
|
||||
* no expression templates technique support
|
||||
|
||||
Beware that the latter limitation may lead to overloaded matrix operators that cause memory allocations. The ``GpuMat`` class is convertible to :ocv:class:`cuda::PtrStepSz` and :ocv:class:`cuda::PtrStep` so it can be passed directly to the kernel.
|
||||
|
||||
.. note:: In contrast with :ocv:class:`Mat`, in most cases ``GpuMat::isContinuous() == false`` . This means that rows are aligned to a size depending on the hardware. Single-row ``GpuMat`` is always a continuous matrix.
|
||||
|
||||
::
|
||||
|
||||
class CV_EXPORTS GpuMat
|
||||
{
|
||||
public:
|
||||
//! default constructor
|
||||
GpuMat();
|
||||
|
||||
//! constructs GpuMat of the specified size and type
|
||||
GpuMat(int rows, int cols, int type);
|
||||
GpuMat(Size size, int type);
|
||||
|
||||
.....
|
||||
|
||||
//! builds GpuMat from host memory (Blocking call)
|
||||
explicit GpuMat(InputArray arr);
|
||||
|
||||
//! returns lightweight PtrStepSz structure for passing
|
||||
//to nvcc-compiled code. Contains size, data ptr and step.
|
||||
template <class T> operator PtrStepSz<T>() const;
|
||||
template <class T> operator PtrStep<T>() const;
|
||||
|
||||
//! pefroms upload data to GpuMat (Blocking call)
|
||||
void upload(InputArray arr);
|
||||
|
||||
//! pefroms upload data to GpuMat (Non-Blocking call)
|
||||
void upload(InputArray arr, Stream& stream);
|
||||
|
||||
//! pefroms download data from device to host memory (Blocking call)
|
||||
void download(OutputArray dst) const;
|
||||
|
||||
//! pefroms download data from device to host memory (Non-Blocking call)
|
||||
void download(OutputArray dst, Stream& stream) const;
|
||||
};
|
||||
|
||||
|
||||
.. note:: You are not recommended to leave static or global ``GpuMat`` variables allocated, that is, to rely on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory release function returns error if the CUDA context has been destroyed before.
|
||||
|
||||
.. seealso:: :ocv:class:`Mat`
|
||||
|
||||
|
||||
|
||||
cuda::createContinuous
|
||||
----------------------
|
||||
Creates a continuous matrix.
|
||||
|
||||
.. ocv:function:: void cuda::createContinuous(int rows, int cols, int type, OutputArray arr)
|
||||
|
||||
:param rows: Row count.
|
||||
|
||||
:param cols: Column count.
|
||||
|
||||
:param type: Type of the matrix.
|
||||
|
||||
:param arr: Destination matrix. This parameter changes only if it has a proper type and area ( :math:`\texttt{rows} \times \texttt{cols}` ).
|
||||
|
||||
Matrix is called continuous if its elements are stored continuously, that is, without gaps at the end of each row.
|
||||
|
||||
|
||||
|
||||
cuda::ensureSizeIsEnough
|
||||
------------------------
|
||||
Ensures that the size of a matrix is big enough and the matrix has a proper type.
|
||||
|
||||
.. ocv:function:: void cuda::ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr)
|
||||
|
||||
:param rows: Minimum desired number of rows.
|
||||
|
||||
:param cols: Minimum desired number of columns.
|
||||
|
||||
:param type: Desired matrix type.
|
||||
|
||||
:param arr: Destination matrix.
|
||||
|
||||
The function does not reallocate memory if the matrix has proper attributes already.
|
||||
|
||||
|
||||
|
||||
cuda::CudaMem
|
||||
-------------
|
||||
.. ocv:class:: cuda::CudaMem
|
||||
|
||||
Class with reference counting wrapping special memory type allocation functions from CUDA. Its interface is also :ocv:func:`Mat`-like but with additional memory type parameters.
|
||||
|
||||
* **PAGE_LOCKED** sets a page locked memory type used commonly for fast and asynchronous uploading/downloading data from/to GPU.
|
||||
* **SHARED** specifies a zero copy memory allocation that enables mapping the host memory to GPU address space, if supported.
|
||||
* **WRITE_COMBINED** sets the write combined buffer that is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache utilization.
|
||||
|
||||
.. note:: Allocation size of such memory types is usually limited. For more details, see *CUDA 2.2 Pinned Memory APIs* document or *CUDA C Programming Guide*.
|
||||
|
||||
::
|
||||
|
||||
class CV_EXPORTS CudaMem
|
||||
{
|
||||
public:
|
||||
enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 };
|
||||
|
||||
explicit CudaMem(AllocType alloc_type = PAGE_LOCKED);
|
||||
|
||||
CudaMem(int rows, int cols, int type, AllocType alloc_type = PAGE_LOCKED);
|
||||
CudaMem(Size size, int type, AllocType alloc_type = PAGE_LOCKED);
|
||||
|
||||
//! creates from host memory with coping data
|
||||
explicit CudaMem(InputArray arr, AllocType alloc_type = PAGE_LOCKED);
|
||||
|
||||
......
|
||||
|
||||
//! returns matrix header with disabled reference counting for CudaMem data.
|
||||
Mat createMatHeader() const;
|
||||
|
||||
//! maps host memory into device address space and returns GpuMat header for it. Throws exception if not supported by hardware.
|
||||
GpuMat createGpuMatHeader() const;
|
||||
|
||||
......
|
||||
|
||||
AllocType alloc_type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
cuda::CudaMem::createMatHeader
|
||||
------------------------------
|
||||
Creates a header without reference counting to :ocv:class:`cuda::CudaMem` data.
|
||||
|
||||
.. ocv:function:: Mat cuda::CudaMem::createMatHeader() const
|
||||
|
||||
|
||||
|
||||
cuda::CudaMem::createGpuMatHeader
|
||||
---------------------------------
|
||||
Maps CPU memory to GPU address space and creates the :ocv:class:`cuda::GpuMat` header without reference counting for it.
|
||||
|
||||
.. ocv:function:: GpuMat cuda::CudaMem::createGpuMatHeader() const
|
||||
|
||||
This can be done only if memory was allocated with the ``SHARED`` flag and if it is supported by the hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which eliminates an extra copy.
|
||||
|
||||
|
||||
|
||||
cuda::registerPageLocked
|
||||
------------------------
|
||||
Page-locks the memory of matrix and maps it for the device(s).
|
||||
|
||||
.. ocv:function:: void cuda::registerPageLocked(Mat& m)
|
||||
|
||||
:param m: Input matrix.
|
||||
|
||||
|
||||
|
||||
cuda::unregisterPageLocked
|
||||
--------------------------
|
||||
Unmaps the memory of matrix and makes it pageable again.
|
||||
|
||||
.. ocv:function:: void cuda::unregisterPageLocked(Mat& m)
|
||||
|
||||
:param m: Input matrix.
|
||||
|
||||
|
||||
|
||||
cuda::Stream
|
||||
------------
|
||||
.. ocv:class:: cuda::Stream
|
||||
|
||||
This class encapsulates a queue of asynchronous calls.
|
||||
|
||||
.. note:: Currently, you may face problems if an operation is enqueued twice with different data. Some functions use the constant GPU memory, and next call may update the memory before the previous one has been finished. But calling different operations asynchronously is safe because each operation has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are also safe.
|
||||
|
||||
::
|
||||
|
||||
class CV_EXPORTS Stream
|
||||
{
|
||||
public:
|
||||
Stream();
|
||||
|
||||
//! queries an asynchronous stream for completion status
|
||||
bool queryIfComplete() const;
|
||||
|
||||
//! waits for stream tasks to complete
|
||||
void waitForCompletion();
|
||||
|
||||
//! makes a compute stream wait on an event
|
||||
void waitEvent(const Event& event);
|
||||
|
||||
//! adds a callback to be called on the host after all currently enqueued items in the stream have completed
|
||||
void enqueueHostCallback(StreamCallback callback, void* userData);
|
||||
|
||||
//! return Stream object for default CUDA stream
|
||||
static Stream& Null();
|
||||
|
||||
//! returns true if stream object is not default (!= 0)
|
||||
operator bool_type() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
cuda::Stream::queryIfComplete
|
||||
-----------------------------
|
||||
Returns ``true`` if the current stream queue is finished. Otherwise, it returns false.
|
||||
|
||||
.. ocv:function:: bool cuda::Stream::queryIfComplete()
|
||||
|
||||
|
||||
|
||||
cuda::Stream::waitForCompletion
|
||||
-------------------------------
|
||||
Blocks the current CPU thread until all operations in the stream are complete.
|
||||
|
||||
.. ocv:function:: void cuda::Stream::waitForCompletion()
|
||||
|
||||
|
||||
|
||||
cuda::Stream::waitEvent
|
||||
-----------------------
|
||||
Makes a compute stream wait on an event.
|
||||
|
||||
.. ocv:function:: void cuda::Stream::waitEvent(const Event& event)
|
||||
|
||||
|
||||
|
||||
cuda::Stream::enqueueHostCallback
|
||||
---------------------------------
|
||||
Adds a callback to be called on the host after all currently enqueued items in the stream have completed.
|
||||
|
||||
.. ocv:function:: void cuda::Stream::enqueueHostCallback(StreamCallback callback, void* userData)
|
||||
|
||||
.. note:: Callbacks must not make any CUDA API calls. Callbacks must not perform any synchronization that may depend on outstanding device work or other callbacks that are not mandated to run earlier. Callbacks without a mandated order (in independent streams) execute in undefined order and may be serialized.
|
||||
|
||||
|
||||
|
||||
cuda::StreamAccessor
|
||||
--------------------
|
||||
.. ocv:struct:: cuda::StreamAccessor
|
||||
|
||||
Class that enables getting ``cudaStream_t`` from :ocv:class:`cuda::Stream` and is declared in ``stream_accessor.hpp`` because it is the only public header that depends on the CUDA Runtime API. Including it brings a dependency to your code. ::
|
||||
|
||||
struct StreamAccessor
|
||||
{
|
||||
CV_EXPORTS static cudaStream_t getStream(const Stream& stream);
|
||||
};
|
||||
@@ -1,375 +0,0 @@
|
||||
Initalization and Information
|
||||
=============================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
cuda::getCudaEnabledDeviceCount
|
||||
-------------------------------
|
||||
Returns the number of installed CUDA-enabled devices.
|
||||
|
||||
.. ocv:function:: int cuda::getCudaEnabledDeviceCount()
|
||||
|
||||
Use this function before any other CUDA functions calls. If OpenCV is compiled without CUDA support, this function returns 0.
|
||||
|
||||
|
||||
|
||||
cuda::setDevice
|
||||
---------------
|
||||
Sets a device and initializes it for the current thread.
|
||||
|
||||
.. ocv:function:: void cuda::setDevice(int device)
|
||||
|
||||
:param device: System index of a CUDA device starting with 0.
|
||||
|
||||
If the call of this function is omitted, a default device is initialized at the fist CUDA usage.
|
||||
|
||||
|
||||
|
||||
cuda::getDevice
|
||||
---------------
|
||||
Returns the current device index set by :ocv:func:`cuda::setDevice` or initialized by default.
|
||||
|
||||
.. ocv:function:: int cuda::getDevice()
|
||||
|
||||
|
||||
|
||||
cuda::resetDevice
|
||||
-----------------
|
||||
Explicitly destroys and cleans up all resources associated with the current device in the current process.
|
||||
|
||||
.. ocv:function:: void cuda::resetDevice()
|
||||
|
||||
Any subsequent API call to this device will reinitialize the device.
|
||||
|
||||
|
||||
|
||||
cuda::FeatureSet
|
||||
----------------
|
||||
Enumeration providing CUDA computing features.
|
||||
|
||||
.. ocv:enum:: cuda::FeatureSet
|
||||
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_10
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_11
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_12
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_13
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_20
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_21
|
||||
.. ocv:emember:: GLOBAL_ATOMICS
|
||||
.. ocv:emember:: SHARED_ATOMICS
|
||||
.. ocv:emember:: NATIVE_DOUBLE
|
||||
|
||||
|
||||
|
||||
cuda::TargetArchs
|
||||
-----------------
|
||||
.. ocv:class:: cuda::TargetArchs
|
||||
|
||||
Class providing a set of static methods to check what NVIDIA* card architecture the CUDA module was built for.
|
||||
|
||||
The following method checks whether the module was built with the support of the given feature:
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::builtWith( FeatureSet feature_set )
|
||||
|
||||
:param feature_set: Features to be checked. See :ocv:enum:`cuda::FeatureSet`.
|
||||
|
||||
There is a set of methods to check whether the module contains intermediate (PTX) or binary CUDA code for the given architecture(s):
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::has(int major, int minor)
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::hasPtx(int major, int minor)
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::hasBin(int major, int minor)
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::hasEqualOrLessPtx(int major, int minor)
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::hasEqualOrGreater(int major, int minor)
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::hasEqualOrGreaterPtx(int major, int minor)
|
||||
|
||||
.. ocv:function:: static bool cuda::TargetArchs::hasEqualOrGreaterBin(int major, int minor)
|
||||
|
||||
:param major: Major compute capability version.
|
||||
|
||||
:param minor: Minor compute capability version.
|
||||
|
||||
According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute capability can always be compiled to binary code of greater or equal compute capability".
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo
|
||||
----------------
|
||||
.. ocv:class:: cuda::DeviceInfo
|
||||
|
||||
Class providing functionality for querying the specified GPU properties. ::
|
||||
|
||||
class CV_EXPORTS DeviceInfo
|
||||
{
|
||||
public:
|
||||
//! creates DeviceInfo object for the current GPU
|
||||
DeviceInfo();
|
||||
|
||||
//! creates DeviceInfo object for the given GPU
|
||||
DeviceInfo(int device_id);
|
||||
|
||||
//! ASCII string identifying device
|
||||
const char* name() const;
|
||||
|
||||
//! global memory available on device in bytes
|
||||
size_t totalGlobalMem() const;
|
||||
|
||||
//! shared memory available per block in bytes
|
||||
size_t sharedMemPerBlock() const;
|
||||
|
||||
//! 32-bit registers available per block
|
||||
int regsPerBlock() const;
|
||||
|
||||
//! warp size in threads
|
||||
int warpSize() const;
|
||||
|
||||
//! maximum pitch in bytes allowed by memory copies
|
||||
size_t memPitch() const;
|
||||
|
||||
//! maximum number of threads per block
|
||||
int maxThreadsPerBlock() const;
|
||||
|
||||
//! maximum size of each dimension of a block
|
||||
Vec3i maxThreadsDim() const;
|
||||
|
||||
//! maximum size of each dimension of a grid
|
||||
Vec3i maxGridSize() const;
|
||||
|
||||
//! clock frequency in kilohertz
|
||||
int clockRate() const;
|
||||
|
||||
//! constant memory available on device in bytes
|
||||
size_t totalConstMem() const;
|
||||
|
||||
//! major compute capability
|
||||
int majorVersion() const;
|
||||
|
||||
//! minor compute capability
|
||||
int minorVersion() const;
|
||||
|
||||
//! alignment requirement for textures
|
||||
size_t textureAlignment() const;
|
||||
|
||||
//! pitch alignment requirement for texture references bound to pitched memory
|
||||
size_t texturePitchAlignment() const;
|
||||
|
||||
//! number of multiprocessors on device
|
||||
int multiProcessorCount() const;
|
||||
|
||||
//! specified whether there is a run time limit on kernels
|
||||
bool kernelExecTimeoutEnabled() const;
|
||||
|
||||
//! device is integrated as opposed to discrete
|
||||
bool integrated() const;
|
||||
|
||||
//! device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer
|
||||
bool canMapHostMemory() const;
|
||||
|
||||
enum ComputeMode
|
||||
{
|
||||
ComputeModeDefault, /**< default compute mode (Multiple threads can use ::cudaSetDevice() with this device) */
|
||||
ComputeModeExclusive, /**< compute-exclusive-thread mode (Only one thread in one process will be able to use ::cudaSetDevice() with this device) */
|
||||
ComputeModeProhibited, /**< compute-prohibited mode (No threads can use ::cudaSetDevice() with this device) */
|
||||
ComputeModeExclusiveProcess /**< compute-exclusive-process mode (Many threads in one process will be able to use ::cudaSetDevice() with this device) */
|
||||
};
|
||||
|
||||
//! compute mode
|
||||
ComputeMode computeMode() const;
|
||||
|
||||
//! maximum 1D texture size
|
||||
int maxTexture1D() const;
|
||||
|
||||
//! maximum 1D mipmapped texture size
|
||||
int maxTexture1DMipmap() const;
|
||||
|
||||
//! maximum size for 1D textures bound to linear memory
|
||||
int maxTexture1DLinear() const;
|
||||
|
||||
//! maximum 2D texture dimensions
|
||||
Vec2i maxTexture2D() const;
|
||||
|
||||
//! maximum 2D mipmapped texture dimensions
|
||||
Vec2i maxTexture2DMipmap() const;
|
||||
|
||||
//! maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory
|
||||
Vec3i maxTexture2DLinear() const;
|
||||
|
||||
//! maximum 2D texture dimensions if texture gather operations have to be performed
|
||||
Vec2i maxTexture2DGather() const;
|
||||
|
||||
//! maximum 3D texture dimensions
|
||||
Vec3i maxTexture3D() const;
|
||||
|
||||
//! maximum Cubemap texture dimensions
|
||||
int maxTextureCubemap() const;
|
||||
|
||||
//! maximum 1D layered texture dimensions
|
||||
Vec2i maxTexture1DLayered() const;
|
||||
|
||||
//! maximum 2D layered texture dimensions
|
||||
Vec3i maxTexture2DLayered() const;
|
||||
|
||||
//! maximum Cubemap layered texture dimensions
|
||||
Vec2i maxTextureCubemapLayered() const;
|
||||
|
||||
//! maximum 1D surface size
|
||||
int maxSurface1D() const;
|
||||
|
||||
//! maximum 2D surface dimensions
|
||||
Vec2i maxSurface2D() const;
|
||||
|
||||
//! maximum 3D surface dimensions
|
||||
Vec3i maxSurface3D() const;
|
||||
|
||||
//! maximum 1D layered surface dimensions
|
||||
Vec2i maxSurface1DLayered() const;
|
||||
|
||||
//! maximum 2D layered surface dimensions
|
||||
Vec3i maxSurface2DLayered() const;
|
||||
|
||||
//! maximum Cubemap surface dimensions
|
||||
int maxSurfaceCubemap() const;
|
||||
|
||||
//! maximum Cubemap layered surface dimensions
|
||||
Vec2i maxSurfaceCubemapLayered() const;
|
||||
|
||||
//! alignment requirements for surfaces
|
||||
size_t surfaceAlignment() const;
|
||||
|
||||
//! device can possibly execute multiple kernels concurrently
|
||||
bool concurrentKernels() const;
|
||||
|
||||
//! device has ECC support enabled
|
||||
bool ECCEnabled() const;
|
||||
|
||||
//! PCI bus ID of the device
|
||||
int pciBusID() const;
|
||||
|
||||
//! PCI device ID of the device
|
||||
int pciDeviceID() const;
|
||||
|
||||
//! PCI domain ID of the device
|
||||
int pciDomainID() const;
|
||||
|
||||
//! true if device is a Tesla device using TCC driver, false otherwise
|
||||
bool tccDriver() const;
|
||||
|
||||
//! number of asynchronous engines
|
||||
int asyncEngineCount() const;
|
||||
|
||||
//! device shares a unified address space with the host
|
||||
bool unifiedAddressing() const;
|
||||
|
||||
//! peak memory clock frequency in kilohertz
|
||||
int memoryClockRate() const;
|
||||
|
||||
//! global memory bus width in bits
|
||||
int memoryBusWidth() const;
|
||||
|
||||
//! size of L2 cache in bytes
|
||||
int l2CacheSize() const;
|
||||
|
||||
//! maximum resident threads per multiprocessor
|
||||
int maxThreadsPerMultiProcessor() const;
|
||||
|
||||
//! gets free and total device memory
|
||||
void queryMemory(size_t& totalMemory, size_t& freeMemory) const;
|
||||
size_t freeMemory() const;
|
||||
size_t totalMemory() const;
|
||||
|
||||
//! checks whether device supports the given feature
|
||||
bool supports(FeatureSet feature_set) const;
|
||||
|
||||
//! checks whether the CUDA module can be run on the given device
|
||||
bool isCompatible() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::DeviceInfo
|
||||
----------------------------
|
||||
The constructors.
|
||||
|
||||
.. ocv:function:: cuda::DeviceInfo::DeviceInfo()
|
||||
|
||||
.. ocv:function:: cuda::DeviceInfo::DeviceInfo(int device_id)
|
||||
|
||||
:param device_id: System index of the CUDA device starting with 0.
|
||||
|
||||
Constructs the ``DeviceInfo`` object for the specified device. If ``device_id`` parameter is missed, it constructs an object for the current device.
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::name
|
||||
----------------------
|
||||
Returns the device name.
|
||||
|
||||
.. ocv:function:: const char* cuda::DeviceInfo::name() const
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::majorVersion
|
||||
------------------------------
|
||||
Returns the major compute capability version.
|
||||
|
||||
.. ocv:function:: int cuda::DeviceInfo::majorVersion()
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::minorVersion
|
||||
------------------------------
|
||||
Returns the minor compute capability version.
|
||||
|
||||
.. ocv:function:: int cuda::DeviceInfo::minorVersion()
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::freeMemory
|
||||
----------------------------
|
||||
Returns the amount of free memory in bytes.
|
||||
|
||||
.. ocv:function:: size_t cuda::DeviceInfo::freeMemory()
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::totalMemory
|
||||
-----------------------------
|
||||
Returns the amount of total memory in bytes.
|
||||
|
||||
.. ocv:function:: size_t cuda::DeviceInfo::totalMemory()
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::supports
|
||||
--------------------------
|
||||
Provides information on CUDA feature support.
|
||||
|
||||
.. ocv:function:: bool cuda::DeviceInfo::supports(FeatureSet feature_set) const
|
||||
|
||||
:param feature_set: Features to be checked. See :ocv:enum:`cuda::FeatureSet`.
|
||||
|
||||
This function returns ``true`` if the device has the specified CUDA feature. Otherwise, it returns ``false`` .
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::isCompatible
|
||||
------------------------------
|
||||
Checks the CUDA module and device compatibility.
|
||||
|
||||
.. ocv:function:: bool cuda::DeviceInfo::isCompatible()
|
||||
|
||||
This function returns ``true`` if the CUDA module can be run on the specified device. Otherwise, it returns ``false`` .
|
||||
|
||||
|
||||
|
||||
cuda::DeviceInfo::deviceID
|
||||
--------------------------
|
||||
Returns system index of the CUDA device starting with 0.
|
||||
|
||||
.. ocv:function:: int cuda::DeviceInfo::deviceID()
|
||||
@@ -1,61 +0,0 @@
|
||||
CUDA Module Introduction
|
||||
========================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
General Information
|
||||
-------------------
|
||||
|
||||
The OpenCV CUDA module is a set of classes and functions to utilize CUDA computational capabilities. It is implemented using NVIDIA* CUDA* Runtime API and supports only NVIDIA GPUs. The OpenCV CUDA module includes utility functions, low-level vision primitives, and high-level algorithms. The utility functions and low-level primitives provide a powerful infrastructure for developing fast vision algorithms taking advantage of CUDA whereas the high-level functionality includes some state-of-the-art algorithms (such as stereo correspondence, face and people detectors, and others) ready to be used by the application developers.
|
||||
|
||||
The CUDA module is designed as a host-level API. This means that if you have pre-compiled OpenCV CUDA binaries, you are not required to have the CUDA Toolkit installed or write any extra code to make use of the CUDA.
|
||||
|
||||
The OpenCV CUDA module is designed for ease of use and does not require any knowledge of CUDA. Though, such a knowledge will certainly be useful to handle non-trivial cases or achieve the highest performance. It is helpful to understand the cost of various operations, what the GPU does, what the preferred data formats are, and so on. The CUDA module is an effective instrument for quick implementation of CUDA-accelerated computer vision algorithms. However, if your algorithm involves many simple operations, then, for the best possible performance, you may still need to write your own kernels to avoid extra write and read operations on the intermediate results.
|
||||
|
||||
To enable CUDA support, configure OpenCV using ``CMake`` with ``WITH_CUDA=ON`` . When the flag is set and if CUDA is installed, the full-featured OpenCV CUDA module is built. Otherwise, the module is still built but at runtime all functions from the module throw
|
||||
:ocv:class:`Exception` with ``CV_GpuNotSupported`` error code, except for
|
||||
:ocv:func:`cuda::getCudaEnabledDeviceCount()`. The latter function returns zero GPU count in this case. Building OpenCV without CUDA support does not perform device code compilation, so it does not require the CUDA Toolkit installed. Therefore, using the
|
||||
:ocv:func:`cuda::getCudaEnabledDeviceCount()` function, you can implement a high-level algorithm that will detect GPU presence at runtime and choose an appropriate implementation (CPU or GPU) accordingly.
|
||||
|
||||
Compilation for Different NVIDIA* Platforms
|
||||
-------------------------------------------
|
||||
|
||||
NVIDIA* compiler enables generating binary code (cubin and fatbin) and intermediate code (PTX). Binary code often implies a specific GPU architecture and generation, so the compatibility with other GPUs is not guaranteed. PTX is targeted for a virtual platform that is defined entirely by the set of capabilities or features. Depending on the selected virtual platform, some of the instructions are emulated or disabled, even if the real hardware supports all the features.
|
||||
|
||||
At the first call, the PTX code is compiled to binary code for the particular GPU using a JIT compiler. When the target GPU has a compute capability (CC) lower than the PTX code, JIT fails.
|
||||
By default, the OpenCV CUDA module includes:
|
||||
|
||||
*
|
||||
Binaries for compute capabilities 1.3 and 2.0 (controlled by ``CUDA_ARCH_BIN`` in ``CMake``)
|
||||
|
||||
*
|
||||
PTX code for compute capabilities 1.1 and 1.3 (controlled by ``CUDA_ARCH_PTX`` in ``CMake``)
|
||||
|
||||
This means that for devices with CC 1.3 and 2.0 binary images are ready to run. For all newer platforms, the PTX code for 1.3 is JIT'ed to a binary image. For devices with CC 1.1 and 1.2, the PTX for 1.1 is JIT'ed. For devices with CC 1.0, no code is available and the functions throw
|
||||
:ocv:class:`Exception`. For platforms where JIT compilation is performed first, the run is slow.
|
||||
|
||||
On a GPU with CC 1.0, you can still compile the CUDA module and most of the functions will run flawlessly. To achieve this, add "1.0" to the list of binaries, for example, ``CUDA_ARCH_BIN="1.0 1.3 2.0"`` . The functions that cannot be run on CC 1.0 GPUs throw an exception.
|
||||
|
||||
You can always determine at runtime whether the OpenCV GPU-built binaries (or PTX code) are compatible with your GPU. The function
|
||||
:ocv:func:`cuda::DeviceInfo::isCompatible` returns the compatibility status (true/false).
|
||||
|
||||
Utilizing Multiple GPUs
|
||||
-----------------------
|
||||
|
||||
In the current version, each of the OpenCV CUDA algorithms can use only a single GPU. So, to utilize multiple GPUs, you have to manually distribute the work between GPUs.
|
||||
Switching active devie can be done using :ocv:func:`cuda::setDevice()` function. For more details please read Cuda C Programming Guide.
|
||||
|
||||
While developing algorithms for multiple GPUs, note a data passing overhead. For primitive functions and small images, it can be significant, which may eliminate all the advantages of having multiple GPUs. But for high-level algorithms, consider using multi-GPU acceleration. For example, the Stereo Block Matching algorithm has been successfully parallelized using the following algorithm:
|
||||
|
||||
|
||||
1. Split each image of the stereo pair into two horizontal overlapping stripes.
|
||||
|
||||
|
||||
2. Process each pair of stripes (from the left and right images) on a separate Fermi* GPU.
|
||||
|
||||
|
||||
3. Merge the results into a single disparity map.
|
||||
|
||||
With this algorithm, a dual GPU gave a 180% performance increase comparing to the single Fermi GPU. For a source code example, see https://github.com/Itseez/opencv/tree/master/samples/gpu/.
|
||||
@@ -1,331 +0,0 @@
|
||||
Object Detection
|
||||
================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor
|
||||
-------------------
|
||||
.. ocv:struct:: cuda::HOGDescriptor
|
||||
|
||||
The class implements Histogram of Oriented Gradients ([Dalal2005]_) object detector. ::
|
||||
|
||||
struct CV_EXPORTS HOGDescriptor
|
||||
{
|
||||
enum { DEFAULT_WIN_SIGMA = -1 };
|
||||
enum { DEFAULT_NLEVELS = 64 };
|
||||
enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL };
|
||||
|
||||
HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16),
|
||||
Size block_stride=Size(8, 8), Size cell_size=Size(8, 8),
|
||||
int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA,
|
||||
double threshold_L2hys=0.2, bool gamma_correction=true,
|
||||
int nlevels=DEFAULT_NLEVELS);
|
||||
|
||||
size_t getDescriptorSize() const;
|
||||
size_t getBlockHistogramSize() const;
|
||||
|
||||
void setSVMDetector(const vector<float>& detector);
|
||||
|
||||
static vector<float> getDefaultPeopleDetector();
|
||||
static vector<float> getPeopleDetector48x96();
|
||||
static vector<float> getPeopleDetector64x128();
|
||||
|
||||
void detect(const GpuMat& img, vector<Point>& found_locations,
|
||||
double hit_threshold=0, Size win_stride=Size(),
|
||||
Size padding=Size());
|
||||
|
||||
void detectMultiScale(const GpuMat& img, vector<Rect>& found_locations,
|
||||
double hit_threshold=0, Size win_stride=Size(),
|
||||
Size padding=Size(), double scale0=1.05,
|
||||
int group_threshold=2);
|
||||
|
||||
void getDescriptors(const GpuMat& img, Size win_stride,
|
||||
GpuMat& descriptors,
|
||||
int descr_format=DESCR_FORMAT_COL_BY_COL);
|
||||
|
||||
Size win_size;
|
||||
Size block_size;
|
||||
Size block_stride;
|
||||
Size cell_size;
|
||||
int nbins;
|
||||
double win_sigma;
|
||||
double threshold_L2hys;
|
||||
bool gamma_correction;
|
||||
int nlevels;
|
||||
|
||||
private:
|
||||
// Hidden
|
||||
}
|
||||
|
||||
|
||||
Interfaces of all methods are kept similar to the ``CPU HOG`` descriptor and detector analogues as much as possible.
|
||||
|
||||
.. note::
|
||||
|
||||
* An example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/cpp/peopledetect.cpp
|
||||
* A CUDA example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/gpu/hog.cpp
|
||||
|
||||
* (Python) An example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/python2/peopledetect.py
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::HOGDescriptor
|
||||
----------------------------------
|
||||
Creates the ``HOG`` descriptor and detector.
|
||||
|
||||
.. ocv:function:: cuda::HOGDescriptor::HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16), Size block_stride=Size(8, 8), Size cell_size=Size(8, 8), int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA, double threshold_L2hys=0.2, bool gamma_correction=true, int nlevels=DEFAULT_NLEVELS)
|
||||
|
||||
:param win_size: Detection window size. Align to block size and block stride.
|
||||
|
||||
:param block_size: Block size in pixels. Align to cell size. Only (16,16) is supported for now.
|
||||
|
||||
:param block_stride: Block stride. It must be a multiple of cell size.
|
||||
|
||||
:param cell_size: Cell size. Only (8, 8) is supported for now.
|
||||
|
||||
:param nbins: Number of bins. Only 9 bins per cell are supported for now.
|
||||
|
||||
:param win_sigma: Gaussian smoothing window parameter.
|
||||
|
||||
:param threshold_L2hys: L2-Hys normalization method shrinkage.
|
||||
|
||||
:param gamma_correction: Flag to specify whether the gamma correction preprocessing is required or not.
|
||||
|
||||
:param nlevels: Maximum number of detection window increases.
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::getDescriptorSize
|
||||
--------------------------------------
|
||||
Returns the number of coefficients required for the classification.
|
||||
|
||||
.. ocv:function:: size_t cuda::HOGDescriptor::getDescriptorSize() const
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::getBlockHistogramSize
|
||||
------------------------------------------
|
||||
Returns the block histogram size.
|
||||
|
||||
.. ocv:function:: size_t cuda::HOGDescriptor::getBlockHistogramSize() const
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::setSVMDetector
|
||||
-----------------------------------
|
||||
Sets coefficients for the linear SVM classifier.
|
||||
|
||||
.. ocv:function:: void cuda::HOGDescriptor::setSVMDetector(const vector<float>& detector)
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::getDefaultPeopleDetector
|
||||
---------------------------------------------
|
||||
Returns coefficients of the classifier trained for people detection (for default window size).
|
||||
|
||||
.. ocv:function:: static vector<float> cuda::HOGDescriptor::getDefaultPeopleDetector()
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::getPeopleDetector48x96
|
||||
-------------------------------------------
|
||||
Returns coefficients of the classifier trained for people detection (for 48x96 windows).
|
||||
|
||||
.. ocv:function:: static vector<float> cuda::HOGDescriptor::getPeopleDetector48x96()
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::getPeopleDetector64x128
|
||||
--------------------------------------------
|
||||
Returns coefficients of the classifier trained for people detection (for 64x128 windows).
|
||||
|
||||
.. ocv:function:: static vector<float> cuda::HOGDescriptor::getPeopleDetector64x128()
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::detect
|
||||
---------------------------
|
||||
Performs object detection without a multi-scale window.
|
||||
|
||||
.. ocv:function:: void cuda::HOGDescriptor::detect(const GpuMat& img, vector<Point>& found_locations, double hit_threshold=0, Size win_stride=Size(), Size padding=Size())
|
||||
|
||||
:param img: Source image. ``CV_8UC1`` and ``CV_8UC4`` types are supported for now.
|
||||
|
||||
:param found_locations: Left-top corner points of detected objects boundaries.
|
||||
|
||||
:param hit_threshold: Threshold for the distance between features and SVM classifying plane. Usually it is 0 and should be specfied in the detector coefficients (as the last free coefficient). But if the free coefficient is omitted (which is allowed), you can specify it manually here.
|
||||
|
||||
:param win_stride: Window stride. It must be a multiple of block stride.
|
||||
|
||||
:param padding: Mock parameter to keep the CPU interface compatibility. It must be (0,0).
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::detectMultiScale
|
||||
-------------------------------------
|
||||
Performs object detection with a multi-scale window.
|
||||
|
||||
.. ocv:function:: void cuda::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& found_locations, double hit_threshold=0, Size win_stride=Size(), Size padding=Size(), double scale0=1.05, int group_threshold=2)
|
||||
|
||||
:param img: Source image. See :ocv:func:`cuda::HOGDescriptor::detect` for type limitations.
|
||||
|
||||
:param found_locations: Detected objects boundaries.
|
||||
|
||||
:param hit_threshold: Threshold for the distance between features and SVM classifying plane. See :ocv:func:`cuda::HOGDescriptor::detect` for details.
|
||||
|
||||
:param win_stride: Window stride. It must be a multiple of block stride.
|
||||
|
||||
:param padding: Mock parameter to keep the CPU interface compatibility. It must be (0,0).
|
||||
|
||||
:param scale0: Coefficient of the detection window increase.
|
||||
|
||||
:param group_threshold: Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. See :ocv:func:`groupRectangles` .
|
||||
|
||||
|
||||
|
||||
cuda::HOGDescriptor::getDescriptors
|
||||
-----------------------------------
|
||||
Returns block descriptors computed for the whole image.
|
||||
|
||||
.. ocv:function:: void cuda::HOGDescriptor::getDescriptors(const GpuMat& img, Size win_stride, GpuMat& descriptors, int descr_format=DESCR_FORMAT_COL_BY_COL)
|
||||
|
||||
:param img: Source image. See :ocv:func:`cuda::HOGDescriptor::detect` for type limitations.
|
||||
|
||||
:param win_stride: Window stride. It must be a multiple of block stride.
|
||||
|
||||
:param descriptors: 2D array of descriptors.
|
||||
|
||||
:param descr_format: Descriptor storage format:
|
||||
|
||||
* **DESCR_FORMAT_ROW_BY_ROW** - Row-major order.
|
||||
|
||||
* **DESCR_FORMAT_COL_BY_COL** - Column-major order.
|
||||
|
||||
The function is mainly used to learn the classifier.
|
||||
|
||||
|
||||
|
||||
cuda::CascadeClassifier_CUDA
|
||||
----------------------------
|
||||
.. ocv:class:: cuda::CascadeClassifier_CUDA
|
||||
|
||||
Cascade classifier class used for object detection. Supports HAAR and LBP cascades. ::
|
||||
|
||||
class CV_EXPORTS CascadeClassifier_CUDA
|
||||
{
|
||||
public:
|
||||
CascadeClassifier_CUDA();
|
||||
CascadeClassifier_CUDA(const String& filename);
|
||||
~CascadeClassifier_CUDA();
|
||||
|
||||
bool empty() const;
|
||||
bool load(const String& filename);
|
||||
void release();
|
||||
|
||||
/* Returns number of detected objects */
|
||||
int detectMultiScale( const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size());
|
||||
int detectMultiScale( const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4);
|
||||
|
||||
/* Finds only the largest object. Special mode if training is required.*/
|
||||
bool findLargestObject;
|
||||
|
||||
/* Draws rectangles in input image */
|
||||
bool visualizeInPlace;
|
||||
|
||||
Size getClassifierSize() const;
|
||||
};
|
||||
|
||||
.. note::
|
||||
|
||||
* A cascade classifier example can be found at opencv_source_code/samples/gpu/cascadeclassifier.cpp
|
||||
* A Nvidea API specific cascade classifier example can be found at opencv_source_code/samples/gpu/cascadeclassifier_nvidia_api.cpp
|
||||
|
||||
|
||||
|
||||
cuda::CascadeClassifier_CUDA::CascadeClassifier_CUDA
|
||||
----------------------------------------------------
|
||||
Loads the classifier from a file. Cascade type is detected automatically by constructor parameter.
|
||||
|
||||
.. ocv:function:: cuda::CascadeClassifier_CUDA::CascadeClassifier_CUDA(const String& filename)
|
||||
|
||||
:param filename: 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.
|
||||
|
||||
|
||||
|
||||
cuda::CascadeClassifier_CUDA::empty
|
||||
-----------------------------------
|
||||
Checks whether the classifier is loaded or not.
|
||||
|
||||
.. ocv:function:: bool cuda::CascadeClassifier_CUDA::empty() const
|
||||
|
||||
|
||||
|
||||
cuda::CascadeClassifier_CUDA::load
|
||||
----------------------------------
|
||||
Loads the classifier from a file. The previous content is destroyed.
|
||||
|
||||
.. ocv:function:: bool cuda::CascadeClassifier_CUDA::load(const String& filename)
|
||||
|
||||
:param filename: 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.
|
||||
|
||||
|
||||
|
||||
cuda::CascadeClassifier_CUDA::release
|
||||
-------------------------------------
|
||||
Destroys the loaded classifier.
|
||||
|
||||
.. ocv:function:: void cuda::CascadeClassifier_CUDA::release()
|
||||
|
||||
|
||||
|
||||
cuda::CascadeClassifier_CUDA::detectMultiScale
|
||||
----------------------------------------------
|
||||
Detects objects of different sizes in the input image.
|
||||
|
||||
.. ocv:function:: int cuda::CascadeClassifier_CUDA::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size())
|
||||
|
||||
.. ocv:function:: int cuda::CascadeClassifier_CUDA::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4)
|
||||
|
||||
:param image: Matrix of type ``CV_8U`` containing an image where objects should be detected.
|
||||
|
||||
:param objectsBuf: Buffer to store detected objects (rectangles). If it is empty, it is allocated with the default size. If not empty, the function searches not more than N objects, where ``N = sizeof(objectsBufer's data)/sizeof(cv::Rect)``.
|
||||
|
||||
:param maxObjectSize: Maximum possible object size. Objects larger than that are ignored. Used for second signature and supported only for LBP cascades.
|
||||
|
||||
:param scaleFactor: Parameter specifying how much the image size is reduced at each image scale.
|
||||
|
||||
:param minNeighbors: Parameter specifying how many neighbors each candidate rectangle should have to retain it.
|
||||
|
||||
:param minSize: Minimum possible object size. Objects smaller than that are ignored.
|
||||
|
||||
The detected objects are returned as a list of rectangles.
|
||||
|
||||
The function returns the number of detected objects, so you can retrieve them as in the following example: ::
|
||||
|
||||
cuda::CascadeClassifier_CUDA cascade_gpu(...);
|
||||
|
||||
Mat image_cpu = imread(...)
|
||||
GpuMat image_gpu(image_cpu);
|
||||
|
||||
GpuMat objbuf;
|
||||
int detections_number = cascade_gpu.detectMultiScale( image_gpu,
|
||||
objbuf, 1.2, minNeighbors);
|
||||
|
||||
Mat obj_host;
|
||||
// download only detected number of rectangles
|
||||
objbuf.colRange(0, detections_number).download(obj_host);
|
||||
|
||||
Rect* faces = obj_host.ptr<Rect>();
|
||||
for(int i = 0; i < detections_num; ++i)
|
||||
cv::rectangle(image_cpu, faces[i], Scalar(255));
|
||||
|
||||
imshow("Faces", image_cpu);
|
||||
|
||||
|
||||
.. seealso:: :ocv:func:`CascadeClassifier::detectMultiScale`
|
||||
|
||||
|
||||
|
||||
.. [Dalal2005] Navneet Dalal and Bill Triggs. *Histogram of oriented gradients for human detection*. 2005.
|
||||
Reference in New Issue
Block a user