OpenCV reference manual (C++ part only for now) is now produced directly from RST, not from TeX.
This commit is contained in:
903
modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst
Normal file
903
modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst
Normal file
@@ -0,0 +1,903 @@
|
||||
Camera Calibration and 3d Reconstruction
|
||||
========================================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoBM_GPU
|
||||
|
||||
.. _gpu::StereoBM_GPU:
|
||||
|
||||
gpu::StereoBM_GPU
|
||||
-----------------
|
||||
|
||||
`id=0.818546624063 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoBM_GPU>`__
|
||||
|
||||
.. ctype:: gpu::StereoBM_GPU
|
||||
|
||||
|
||||
|
||||
The class for computing stereo correspondence using block matching algorithm.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class StereoBM_GPU
|
||||
{
|
||||
public:
|
||||
enum { BASIC_PRESET = 0, PREFILTER_XSOBEL = 1 };
|
||||
|
||||
enum { DEFAULT_NDISP = 64, DEFAULT_WINSZ = 19 };
|
||||
|
||||
StereoBM_GPU();
|
||||
StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP,
|
||||
int winSize = DEFAULT_WINSZ);
|
||||
|
||||
void operator() (const GpuMat& left, const GpuMat& right,
|
||||
GpuMat& disparity);
|
||||
void operator() (const GpuMat& left, const GpuMat& right,
|
||||
GpuMat& disparity, const Stream & stream);
|
||||
|
||||
static bool checkIfGpuCallReasonable();
|
||||
|
||||
int preset;
|
||||
int ndisp;
|
||||
int winSize;
|
||||
|
||||
float avergeTexThreshold;
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
This class computes the disparity map using block matching algorithm. The class also performs pre- and post- filtering steps: sobel prefiltering (if PREFILTER
|
||||
_
|
||||
XSOBEL flag is set) and low textureness filtering (if averageTexThreshols
|
||||
:math:`>`
|
||||
0). If
|
||||
``avergeTexThreshold = 0``
|
||||
low textureness filtering is disabled, otherwise disparity is set to 0 in each point
|
||||
``(x, y)``
|
||||
where for left image
|
||||
:math:`\sum HorizontalGradiensInWindow(x, y, winSize) < (winSize \cdot winSize) \cdot avergeTexThreshold`
|
||||
i.e. input left image is low textured.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::StereoBM_GPU::StereoBM_GPU
|
||||
|
||||
.. _cv::gpu::StereoBM_GPU::StereoBM_GPU:
|
||||
|
||||
cv::gpu::StereoBM_GPU::StereoBM_GPU
|
||||
-----------------------------------
|
||||
|
||||
`id=0.487412502312 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3AStereoBM_GPU%3A%3AStereoBM_GPU>`__
|
||||
|
||||
|
||||
_
|
||||
|
||||
|
||||
.. cfunction:: StereoBM_GPU::StereoBM_GPU()
|
||||
|
||||
|
||||
|
||||
.. cfunction:: StereoBM_GPU::StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ)
|
||||
|
||||
StereoBMGPU constructors.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param preset: Preset:
|
||||
|
||||
|
||||
|
||||
|
||||
* **BASIC_PRESET** Without preprocessing.
|
||||
|
||||
|
||||
* **PREFILTER_XSOBEL** Sobel prefilter.
|
||||
|
||||
|
||||
|
||||
|
||||
:param ndisparities: Number of disparities. Must be a multiple of 8 and less or equal then 256.
|
||||
|
||||
|
||||
:param winSize: Block size.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::StereoBM_GPU::operator ()
|
||||
|
||||
.. _cv::gpu::StereoBM_GPU::operator ():
|
||||
|
||||
cv::gpu::StereoBM_GPU::operator ()
|
||||
----------------------------------
|
||||
|
||||
`id=0.568109898904 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3AStereoBM_GPU%3A%3Aoperator%20%28%29>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoBM_GPU::operator() (const GpuMat\& left, const GpuMat\& right, GpuMat\& disparity)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoBM_GPU::operator() (const GpuMat\& left, const GpuMat\& right, GpuMat\& disparity, const Stream\& stream)
|
||||
|
||||
The stereo correspondence operator. Finds the disparity for the specified rectified stereo pair.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param left: Left image; supports only ``CV_8UC1`` type.
|
||||
|
||||
|
||||
:param right: Right image with the same size and the same type as the left one.
|
||||
|
||||
|
||||
:param disparity: Output disparity map. It will be ``CV_8UC1`` image with the same size as the input images.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable
|
||||
|
||||
.. _cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable:
|
||||
|
||||
cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable
|
||||
-----------------------------------------------
|
||||
|
||||
`id=0.0777071732975 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3AStereoBM_GPU%3A%3AcheckIfGpuCallReasonable>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: bool StereoBM_GPU::checkIfGpuCallReasonable()
|
||||
|
||||
Some heuristics that tries to estmate if the current GPU will be faster then CPU in this algorithm. It queries current active device.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoBeliefPropagation
|
||||
|
||||
.. _gpu::StereoBeliefPropagation:
|
||||
|
||||
gpu::StereoBeliefPropagation
|
||||
----------------------------
|
||||
|
||||
`id=0.0927694778121 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoBeliefPropagation>`__
|
||||
|
||||
.. ctype:: gpu::StereoBeliefPropagation
|
||||
|
||||
|
||||
|
||||
The class for computing stereo correspondence using belief propagation algorithm.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class StereoBeliefPropagation
|
||||
{
|
||||
public:
|
||||
enum { DEFAULT_NDISP = 64 };
|
||||
enum { DEFAULT_ITERS = 5 };
|
||||
enum { DEFAULT_LEVELS = 5 };
|
||||
|
||||
static void estimateRecommendedParams(int width, int height,
|
||||
int& ndisp, int& iters, int& levels);
|
||||
|
||||
explicit StereoBeliefPropagation(int ndisp = DEFAULT_NDISP,
|
||||
int iters = DEFAULT_ITERS,
|
||||
int levels = DEFAULT_LEVELS,
|
||||
int msg_type = CV_32F);
|
||||
StereoBeliefPropagation(int ndisp, int iters, int levels,
|
||||
float max_data_term, float data_weight,
|
||||
float max_disc_term, float disc_single_jump,
|
||||
int msg_type = CV_32F);
|
||||
|
||||
void operator()(const GpuMat& left, const GpuMat& right,
|
||||
GpuMat& disparity);
|
||||
void operator()(const GpuMat& left, const GpuMat& right,
|
||||
GpuMat& disparity, Stream& stream);
|
||||
void operator()(const GpuMat& data, GpuMat& disparity);
|
||||
void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream);
|
||||
|
||||
int ndisp;
|
||||
|
||||
int iters;
|
||||
int levels;
|
||||
|
||||
float max_data_term;
|
||||
float data_weight;
|
||||
float max_disc_term;
|
||||
float disc_single_jump;
|
||||
|
||||
int msg_type;
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
The class implements Pedro F. Felzenszwalb algorithm
|
||||
felzenszwalb_bp
|
||||
. It can compute own data cost (using truncated linear model) or use user-provided data cost.
|
||||
|
||||
**Please note:**
|
||||
``StereoBeliefPropagation``
|
||||
requires a lot of memory:
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
width \_ step \cdot height \cdot ndisp \cdot 4 \cdot (1 + 0.25)
|
||||
|
||||
|
||||
for message storage and
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
width \_ step \cdot height \cdot ndisp \cdot (1 + 0.25 + 0.0625 + \dotsm + \frac{1}{4^{levels}}
|
||||
|
||||
|
||||
for data cost storage.
|
||||
``width_step``
|
||||
is the number of bytes in a line including the padding.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoBeliefPropagation::StereoBeliefPropagation
|
||||
|
||||
|
||||
cv::gpu::StereoBeliefPropagation::StereoBeliefPropagation
|
||||
---------------------------------------------------------
|
||||
|
||||
`id=0.271407166254 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoBeliefPropagation%3A%3AStereoBeliefPropagation>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: StereoBeliefPropagation::StereoBeliefPropagation( int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: StereoBeliefPropagation::StereoBeliefPropagation( int ndisp, int iters, int levels, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int msg_type = CV_32F)
|
||||
|
||||
StereoBeliefPropagation constructors.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param ndisp: Number of disparities.
|
||||
|
||||
|
||||
:param iters: Number of BP iterations on each level.
|
||||
|
||||
|
||||
:param levels: Number of levels.
|
||||
|
||||
|
||||
:param max_data_term: Threshold for data cost truncation.
|
||||
|
||||
|
||||
:param data_weight: Data weight.
|
||||
|
||||
|
||||
:param max_disc_term: Threshold for discontinuity truncation.
|
||||
|
||||
|
||||
:param disc_single_jump: Discontinuity single jump.
|
||||
|
||||
|
||||
:param msg_type: Type for messages. Supports ``CV_16SC1`` and ``CV_32FC1`` .
|
||||
|
||||
|
||||
|
||||
``StereoBeliefPropagation``
|
||||
uses truncated linear model for the data cost and discontinuity term:
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
DataCost = data \_ weight \cdot \min ( \lvert I_2-I_1 \rvert , max \_ data \_ term)
|
||||
|
||||
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
DiscTerm = \min (disc \_ single \_ jump \cdot \lvert f_1-f_2 \rvert , max \_ disc \_ term)
|
||||
|
||||
|
||||
For more details please see
|
||||
felzenszwalb_bp
|
||||
.
|
||||
|
||||
By default
|
||||
``StereoBeliefPropagation``
|
||||
uses floating-point arithmetics and
|
||||
``CV_32FC1``
|
||||
type for messages. But also it can use fixed-point arithmetics and
|
||||
``CV_16SC1``
|
||||
type for messages for better perfomance. To avoid overflow in this case, the parameters must satisfy
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
10 \cdot 2^{levels-1} \cdot max \_ data \_ term < SHRT \_ MAX
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoBeliefPropagation::estimateRecommendedParams
|
||||
|
||||
|
||||
cv::gpu::StereoBeliefPropagation::estimateRecommendedParams
|
||||
-----------------------------------------------------------
|
||||
|
||||
`id=0.673949423374 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoBeliefPropagation%3A%3AestimateRecommendedParams>`__
|
||||
|
||||
|
||||
````
|
||||
````
|
||||
````
|
||||
````
|
||||
````
|
||||
|
||||
|
||||
.. cfunction:: void StereoBeliefPropagation::estimateRecommendedParams( int width, int height, int\& ndisp, int\& iters, int\& levels)
|
||||
|
||||
Some heuristics that tries to compute recommended parameters (ndisp, itersand levels) for specified image size (widthand height).
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoBeliefPropagation::operator ()
|
||||
|
||||
|
||||
cv::gpu::StereoBeliefPropagation::operator ()
|
||||
---------------------------------------------
|
||||
|
||||
`id=0.719591752468 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoBeliefPropagation%3A%3Aoperator%20%28%29>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoBeliefPropagation::operator()( const GpuMat\& left, const GpuMat\& right, GpuMat\& disparity)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoBeliefPropagation::operator()( const GpuMat\& left, const GpuMat\& right, GpuMat\& disparity, Stream\& stream)
|
||||
|
||||
The stereo correspondence operator. Finds the disparity for the specified rectified stereo pair or data cost.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param left: Left image; supports ``CV_8UC1`` , ``CV_8UC3`` and ``CV_8UC4`` types.
|
||||
|
||||
|
||||
:param right: Right image with the same size and the same type as the left one.
|
||||
|
||||
|
||||
:param disparity: Output disparity map. If ``disparity`` is empty output type will be ``CV_16SC1`` , otherwise output type will be ``disparity.type()`` .
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoBeliefPropagation::operator()( const GpuMat\& data, GpuMat\& disparity)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoBeliefPropagation::operator()( const GpuMat\& data, GpuMat\& disparity, Stream\& stream)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **data** The user specified data cost. It must have ``msg_type`` type and :math:`\texttt{imgRows} \cdot \texttt{ndisp} \times \texttt{imgCols}` size.
|
||||
|
||||
|
||||
* **disparity** Output disparity map. If ``disparity`` is empty output type will be ``CV_16SC1`` , otherwise output type will be ``disparity.type()`` .
|
||||
|
||||
|
||||
* **stream** Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoConstantSpaceBP
|
||||
|
||||
.. _gpu::StereoConstantSpaceBP:
|
||||
|
||||
gpu::StereoConstantSpaceBP
|
||||
--------------------------
|
||||
|
||||
`id=0.357913399086 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoConstantSpaceBP>`__
|
||||
|
||||
.. ctype:: gpu::StereoConstantSpaceBP
|
||||
|
||||
|
||||
|
||||
The class for computing stereo correspondence using constant space belief propagation algorithm.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class StereoConstantSpaceBP
|
||||
{
|
||||
public:
|
||||
enum { DEFAULT_NDISP = 128 };
|
||||
enum { DEFAULT_ITERS = 8 };
|
||||
enum { DEFAULT_LEVELS = 4 };
|
||||
enum { DEFAULT_NR_PLANE = 4 };
|
||||
|
||||
static void estimateRecommendedParams(int width, int height,
|
||||
int& ndisp, int& iters, int& levels, int& nr_plane);
|
||||
|
||||
explicit StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP,
|
||||
int iters = DEFAULT_ITERS,
|
||||
int levels = DEFAULT_LEVELS,
|
||||
int nr_plane = DEFAULT_NR_PLANE,
|
||||
int msg_type = CV_32F);
|
||||
StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane,
|
||||
float max_data_term, float data_weight,
|
||||
float max_disc_term, float disc_single_jump,
|
||||
int min_disp_th = 0,
|
||||
int msg_type = CV_32F);
|
||||
|
||||
void operator()(const GpuMat& left, const GpuMat& right,
|
||||
GpuMat& disparity);
|
||||
void operator()(const GpuMat& left, const GpuMat& right,
|
||||
GpuMat& disparity, Stream& stream);
|
||||
|
||||
int ndisp;
|
||||
|
||||
int iters;
|
||||
int levels;
|
||||
|
||||
int nr_plane;
|
||||
|
||||
float max_data_term;
|
||||
float data_weight;
|
||||
float max_disc_term;
|
||||
float disc_single_jump;
|
||||
|
||||
int min_disp_th;
|
||||
|
||||
int msg_type;
|
||||
|
||||
bool use_local_init_data_cost;
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
The class implements Q. Yang algorithm
|
||||
qx_csbp
|
||||
.
|
||||
``StereoConstantSpaceBP``
|
||||
supports both local minimum and global minimum data cost initialization algortihms. For more details please see the paper. By default local algorithm is used, and to enable global algorithm set
|
||||
``use_local_init_data_cost``
|
||||
to false.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoConstantSpaceBP::StereoConstantSpaceBP
|
||||
|
||||
|
||||
cv::gpu::StereoConstantSpaceBP::StereoConstantSpaceBP
|
||||
-----------------------------------------------------
|
||||
|
||||
`id=0.540144508025 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoConstantSpaceBP%3A%3AStereoConstantSpaceBP>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int nr_plane = DEFAULT_NR_PLANE, int msg_type = CV_32F)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int min_disp_th = 0, int msg_type = CV_32F)
|
||||
|
||||
StereoConstantSpaceBP constructors.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param ndisp: Number of disparities.
|
||||
|
||||
|
||||
:param iters: Number of BP iterations on each level.
|
||||
|
||||
|
||||
:param levels: Number of levels.
|
||||
|
||||
|
||||
:param nr_plane: Number of disparity levels on the first level
|
||||
|
||||
|
||||
:param max_data_term: Truncation of data cost.
|
||||
|
||||
|
||||
:param data_weight: Data weight.
|
||||
|
||||
|
||||
:param max_disc_term: Truncation of discontinuity.
|
||||
|
||||
|
||||
:param disc_single_jump: Discontinuity single jump.
|
||||
|
||||
|
||||
:param min_disp_th: Minimal disparity threshold.
|
||||
|
||||
|
||||
:param msg_type: Type for messages. Supports ``CV_16SC1`` and ``CV_32FC1`` .
|
||||
|
||||
|
||||
|
||||
``StereoConstantSpaceBP``
|
||||
uses truncated linear model for the data cost and discontinuity term:
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
DataCost = data \_ weight \cdot \min ( \lvert I_2-I_1 \rvert , max \_ data \_ term)
|
||||
|
||||
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
DiscTerm = \min (disc \_ single \_ jump \cdot \lvert f_1-f_2 \rvert , max \_ disc \_ term)
|
||||
|
||||
|
||||
For more details please see
|
||||
qx_csbp
|
||||
.
|
||||
|
||||
By default
|
||||
``StereoConstantSpaceBP``
|
||||
uses floating-point arithmetics and
|
||||
``CV_32FC1``
|
||||
type for messages. But also it can use fixed-point arithmetics and
|
||||
``CV_16SC1``
|
||||
type for messages for better perfomance. To avoid overflow in this case, the parameters must satisfy
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
10 \cdot 2^{levels-1} \cdot max \_ data \_ term < SHRT \_ MAX
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoConstantSpaceBP::estimateRecommendedParams
|
||||
|
||||
|
||||
cv::gpu::StereoConstantSpaceBP::estimateRecommendedParams
|
||||
---------------------------------------------------------
|
||||
|
||||
`id=0.693436585596 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoConstantSpaceBP%3A%3AestimateRecommendedParams>`__
|
||||
|
||||
|
||||
````
|
||||
````
|
||||
````
|
||||
``_``
|
||||
````
|
||||
````
|
||||
|
||||
|
||||
.. cfunction:: void StereoConstantSpaceBP::estimateRecommendedParams( int width, int height, int\& ndisp, int\& iters, int\& levels, int\& nr_plane)
|
||||
|
||||
Some heuristics that tries to compute parameters (ndisp, iters, levelsand nrplane) for specified image size (widthand height).
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StereoConstantSpaceBP::operator ()
|
||||
|
||||
|
||||
cv::gpu::StereoConstantSpaceBP::operator ()
|
||||
-------------------------------------------
|
||||
|
||||
`id=0.0775494401011 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStereoConstantSpaceBP%3A%3Aoperator%20%28%29>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoConstantSpaceBP::operator()( const GpuMat\& left, const GpuMat\& right, GpuMat\& disparity)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void StereoConstantSpaceBP::operator()( const GpuMat\& left, const GpuMat\& right, GpuMat\& disparity, Stream\& stream)
|
||||
|
||||
The stereo correspondence operator. Finds the disparity for the specified rectified stereo pair.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param left: Left image; supports ``CV_8UC1`` , ``CV_8UC3`` and ``CV_8UC4`` types.
|
||||
|
||||
|
||||
:param right: Right image with the same size and the same type as the left one.
|
||||
|
||||
|
||||
:param disparity: Output disparity map. If ``disparity`` is empty output type will be ``CV_16SC1`` , otherwise output type will be ``disparity.type()`` .
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DisparityBilateralFilter
|
||||
|
||||
.. _gpu::DisparityBilateralFilter:
|
||||
|
||||
gpu::DisparityBilateralFilter
|
||||
-----------------------------
|
||||
|
||||
`id=0.649410057275 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADisparityBilateralFilter>`__
|
||||
|
||||
.. ctype:: gpu::DisparityBilateralFilter
|
||||
|
||||
|
||||
|
||||
The class for disparity map refinement using joint bilateral filtering.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS DisparityBilateralFilter
|
||||
{
|
||||
public:
|
||||
enum { DEFAULT_NDISP = 64 };
|
||||
enum { DEFAULT_RADIUS = 3 };
|
||||
enum { DEFAULT_ITERS = 1 };
|
||||
|
||||
explicit DisparityBilateralFilter(int ndisp = DEFAULT_NDISP,
|
||||
int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS);
|
||||
|
||||
DisparityBilateralFilter(int ndisp, int radius, int iters,
|
||||
float edge_threshold, float max_disc_threshold,
|
||||
float sigma_range);
|
||||
|
||||
void operator()(const GpuMat& disparity, const GpuMat& image,
|
||||
GpuMat& dst);
|
||||
void operator()(const GpuMat& disparity, const GpuMat& image,
|
||||
GpuMat& dst, Stream& stream);
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
The class implements Q. Yang algorithm
|
||||
qx_csbp
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DisparityBilateralFilter::DisparityBilateralFilter
|
||||
|
||||
|
||||
cv::gpu::DisparityBilateralFilter::DisparityBilateralFilter
|
||||
-----------------------------------------------------------
|
||||
|
||||
`id=0.896263433112 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADisparityBilateralFilter%3A%3ADisparityBilateralFilter>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: DisparityBilateralFilter::DisparityBilateralFilter( int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: DisparityBilateralFilter::DisparityBilateralFilter( int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range)
|
||||
|
||||
DisparityBilateralFilter constructors.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param ndisp: Number of disparities.
|
||||
|
||||
|
||||
:param radius: Filter radius.
|
||||
|
||||
|
||||
:param iters: Number of iterations.
|
||||
|
||||
|
||||
:param edge_threshold: Threshold for edges.
|
||||
|
||||
|
||||
:param max_disc_threshold: Constant to reject outliers.
|
||||
|
||||
|
||||
:param sigma_range: Filter range.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DisparityBilateralFilter::operator ()
|
||||
|
||||
|
||||
cv::gpu::DisparityBilateralFilter::operator ()
|
||||
----------------------------------------------
|
||||
|
||||
`id=0.42982970504 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADisparityBilateralFilter%3A%3Aoperator%20%28%29>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void DisparityBilateralFilter::operator()( const GpuMat\& disparity, const GpuMat\& image, GpuMat\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void DisparityBilateralFilter::operator()( const GpuMat\& disparity, const GpuMat\& image, GpuMat\& dst, Stream\& stream)
|
||||
|
||||
Refines disparity map using joint bilateral filtering.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param disparity: Input disparity map; supports ``CV_8UC1`` and ``CV_16SC1`` types.
|
||||
|
||||
|
||||
:param image: Input image; supports ``CV_8UC1`` and ``CV_8UC3`` types.
|
||||
|
||||
|
||||
:param dst: Destination disparity map; will have the same size and type as ``disparity`` .
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::drawColorDisp
|
||||
|
||||
|
||||
cv::gpu::drawColorDisp
|
||||
----------------------
|
||||
|
||||
`id=0.876300277953 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AdrawColorDisp>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void drawColorDisp(const GpuMat\& src_disp, GpuMat\& dst_disp, int ndisp)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void drawColorDisp(const GpuMat\& src_disp, GpuMat\& dst_disp, int ndisp, const Stream\& stream)
|
||||
|
||||
Does coloring of disparity image.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src_disp: Source disparity image. Supports ``CV_8UC1`` and ``CV_16SC1`` types.
|
||||
|
||||
|
||||
:param dst_disp: Output disparity image. Will have the same size as ``src_disp`` and ``CV_8UC4`` type in ``BGRA`` format (alpha = 255).
|
||||
|
||||
|
||||
:param ndisp: Number of disparities.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
This function converts
|
||||
:math:`[0..ndisp)`
|
||||
interval to
|
||||
:math:`[0..240, 1, 1]`
|
||||
in
|
||||
``HSV``
|
||||
color space, than convert
|
||||
``HSV``
|
||||
color space to
|
||||
``RGB``
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::reprojectImageTo3D
|
||||
|
||||
|
||||
cv::gpu::reprojectImageTo3D
|
||||
---------------------------
|
||||
|
||||
`id=0.230278526904 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AreprojectImageTo3D>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void reprojectImageTo3D(const GpuMat\& disp, GpuMat\& xyzw, const Mat\& Q)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void reprojectImageTo3D(const GpuMat\& disp, GpuMat\& xyzw, const Mat\& Q, const Stream\& stream)
|
||||
|
||||
Reprojects disparity image to 3D space.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param disp: Input disparity image; supports ``CV_8U`` and ``CV_16S`` types.
|
||||
|
||||
|
||||
:param xyzw: Output 4-channel floating-point image of the same size as ``disp`` . Each element of ``xyzw(x,y)`` will contain the 3D coordinates ``(x,y,z,1)`` of the point ``(x,y)`` , computed from the disparity map.
|
||||
|
||||
|
||||
:param Q: :math:`4 \times 4` perspective transformation matrix that can be obtained via :ref:`StereoRectify` .
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`reprojectImageTo3D`
|
||||
.
|
||||
|
||||
|
597
modules/gpu/doc/data_structures.rst
Normal file
597
modules/gpu/doc/data_structures.rst
Normal file
@@ -0,0 +1,597 @@
|
||||
Data Structures
|
||||
===============
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DevMem2D_
|
||||
|
||||
.. _gpu::DevMem2D_:
|
||||
|
||||
gpu::DevMem2D_
|
||||
--------------
|
||||
|
||||
`id=0.542572017346 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADevMem2D_>`__
|
||||
|
||||
.. ctype:: gpu::DevMem2D_
|
||||
|
||||
|
||||
|
||||
This is a simple lightweight class that encapsulate pitched memory on GPU. It is intended to pass to nvcc-compiled code, i.e. CUDA kernels. So it is used internally by OpenCV and by users writes own device code. Its members can be called both from host and from device code.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
template <typename T> struct DevMem2D_
|
||||
{
|
||||
int cols;
|
||||
int rows;
|
||||
T* data;
|
||||
size_t step;
|
||||
|
||||
DevMem2D_() : cols(0), rows(0), data(0), step(0){};
|
||||
DevMem2D_(int rows_, int cols_, T *data_, size_t step_);
|
||||
|
||||
template <typename U>
|
||||
explicit DevMem2D_(const DevMem2D_<U>& d);
|
||||
|
||||
typedef T elem_type;
|
||||
enum { elem_size = sizeof(elem_type) };
|
||||
|
||||
__CV_GPU_HOST_DEVICE__ size_t elemSize() const;
|
||||
|
||||
/* returns pointer to the beggining of given image row */
|
||||
__CV_GPU_HOST_DEVICE__ T* ptr(int y = 0);
|
||||
__CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const;
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::PtrStep_
|
||||
|
||||
.. _gpu::PtrStep_:
|
||||
|
||||
gpu::PtrStep_
|
||||
-------------
|
||||
|
||||
`id=0.130599760293 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3APtrStep_>`__
|
||||
|
||||
.. ctype:: gpu::PtrStep_
|
||||
|
||||
|
||||
|
||||
This is structure is similar to DevMem2D
|
||||
_
|
||||
but contains only pointer and row step. Width and height fields are excluded due to performance reasons. The structure is for internal use or for users who write own device code.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
template<typename T> struct PtrStep_
|
||||
{
|
||||
T* data;
|
||||
size_t step;
|
||||
|
||||
PtrStep_();
|
||||
PtrStep_(const DevMem2D_<T>& mem);
|
||||
|
||||
typedef T elem_type;
|
||||
enum { elem_size = sizeof(elem_type) };
|
||||
|
||||
__CV_GPU_HOST_DEVICE__ size_t elemSize() const;
|
||||
__CV_GPU_HOST_DEVICE__ T* ptr(int y = 0);
|
||||
__CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::PtrElemStrp_
|
||||
|
||||
.. _gpu::PtrElemStrp_:
|
||||
|
||||
gpu::PtrElemStrp_
|
||||
-----------------
|
||||
|
||||
`id=0.837109179392 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3APtrElemStrp_>`__
|
||||
|
||||
.. ctype:: gpu::PtrElemStrp_
|
||||
|
||||
|
||||
|
||||
This is structure is similar to DevMem2D
|
||||
_
|
||||
but contains only pointer and row step in elements. Width and height fields are excluded due to performance reasons. This class is can only be constructed if sizeof(T) is a multiple of 256. The structure is for internal use or for users who write own device code.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
template<typename T> struct PtrElemStep_ : public PtrStep_<T>
|
||||
{
|
||||
PtrElemStep_(const DevMem2D_<T>& mem);
|
||||
__CV_GPU_HOST_DEVICE__ T* ptr(int y = 0);
|
||||
__CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const;
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::GpuMat
|
||||
|
||||
.. _gpu::GpuMat:
|
||||
|
||||
gpu::GpuMat
|
||||
-----------
|
||||
|
||||
`id=0.816128758115 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AGpuMat>`__
|
||||
|
||||
.. ctype:: gpu::GpuMat
|
||||
|
||||
|
||||
|
||||
The base storage class for GPU memory with reference counting. Its interface is almost
|
||||
:func:`Mat`
|
||||
interface with some limitations, so using it won't be a problem. The limitations are no arbitrary dimensions support (only 2D), no functions that returns references to its data (because references on GPU are not valid for CPU), no expression templates technique support. Because of last limitation please take care with overloaded matrix operators - they cause memory allocations. The GpuMat class is convertible to
|
||||
and
|
||||
so it can be passed to directly to kernel.
|
||||
|
||||
|
||||
|
||||
|
||||
**Please note:**
|
||||
In contrast with
|
||||
:func:`Mat`
|
||||
, In most cases
|
||||
``GpuMat::isContinuous() == false``
|
||||
, i.e. rows are aligned to size depending on hardware. Also single row GpuMat is always a continuous matrix.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS GpuMat
|
||||
{
|
||||
public:
|
||||
//! default constructor
|
||||
GpuMat();
|
||||
|
||||
GpuMat(int rows, int cols, int type);
|
||||
GpuMat(Size size, int type);
|
||||
|
||||
.....
|
||||
|
||||
//! builds GpuMat from Mat. Perfom blocking upload to device.
|
||||
explicit GpuMat (const Mat& m);
|
||||
|
||||
//! returns lightweight DevMem2D_ structure for passing
|
||||
//to nvcc-compiled code. Contains size, data ptr and step.
|
||||
template <class T> operator DevMem2D_<T>() const;
|
||||
template <class T> operator PtrStep_<T>() const;
|
||||
|
||||
//! pefroms blocking upload data to GpuMat.
|
||||
void upload(const cv::Mat& m);
|
||||
void upload(const CudaMem& m, Stream& stream);
|
||||
|
||||
//! downloads data from device to host memory. Blocking calls.
|
||||
operator Mat() const;
|
||||
void download(cv::Mat& m) const;
|
||||
|
||||
//! download async
|
||||
void download(CudaMem& m, Stream& stream) const;
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
**Please note:**
|
||||
Is it a bad practice to leave static or global GpuMat variables allocated, i.e. to rely on its destructor. That is because destruction order of such variables and CUDA context is undefined and GPU memory release function returns error if CUDA context has been destroyed before.
|
||||
|
||||
|
||||
See also:
|
||||
:func:`Mat`
|
||||
|
||||
.. index:: gpu::CudaMem
|
||||
|
||||
.. _gpu::CudaMem:
|
||||
|
||||
gpu::CudaMem
|
||||
------------
|
||||
|
||||
`id=0.762477139905 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ACudaMem>`__
|
||||
|
||||
.. ctype:: gpu::CudaMem
|
||||
|
||||
|
||||
|
||||
This is a class with reference counting that wraps special memory type allocation functions from CUDA. Its interface is also
|
||||
:func:`Mat`
|
||||
-like but with additional memory type parameter:
|
||||
|
||||
|
||||
|
||||
|
||||
*
|
||||
``ALLOC_PAGE_LOCKED``
|
||||
Set page locked memory type, used commonly for fast and asynchronous upload/download data from/to GPU.
|
||||
|
||||
|
||||
|
||||
*
|
||||
``ALLOC_ZEROCOPY``
|
||||
Specifies zero copy memory allocation, i.e. with possibility to map host memory to GPU address space if supported.
|
||||
|
||||
|
||||
|
||||
*
|
||||
``ALLOC_WRITE_COMBINED``
|
||||
Sets write combined buffer which is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is better CPU cache utilization.
|
||||
|
||||
|
||||
Please note that allocation size of such memory types is usually limited. For more details please see "CUDA 2.2 Pinned Memory APIs" document or "CUDA
|
||||
_
|
||||
C Programming Guide".
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS CudaMem
|
||||
{
|
||||
public:
|
||||
enum { ALLOC_PAGE_LOCKED = 1, ALLOC_ZEROCOPY = 2,
|
||||
ALLOC_WRITE_COMBINED = 4 };
|
||||
|
||||
CudaMem(Size size, int type, int alloc_type = ALLOC_PAGE_LOCKED);
|
||||
|
||||
//! creates from cv::Mat with coping data
|
||||
explicit CudaMem(const Mat& m, int alloc_type = ALLOC_PAGE_LOCKED);
|
||||
|
||||
......
|
||||
|
||||
void create(Size size, int type, int alloc_type = ALLOC_PAGE_LOCKED);
|
||||
|
||||
//! returns matrix header with disabled ref. counting for CudaMem data.
|
||||
Mat createMatHeader() const;
|
||||
operator Mat() const;
|
||||
|
||||
//! maps host memory into device address space
|
||||
GpuMat createGpuMatHeader() const;
|
||||
operator GpuMat() const;
|
||||
|
||||
//if host memory can be mapperd to gpu address space;
|
||||
static bool canMapHostMemory();
|
||||
|
||||
int alloc_type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::CudaMem::createMatHeader
|
||||
|
||||
|
||||
cv::gpu::CudaMem::createMatHeader
|
||||
---------------------------------
|
||||
|
||||
`id=0.772787893445 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ACudaMem%3A%3AcreateMatHeader>`__
|
||||
|
||||
|
||||
:func:`Mat`
|
||||
|
||||
|
||||
.. cfunction:: Mat CudaMem::createMatHeader() const
|
||||
|
||||
|
||||
|
||||
.. cfunction:: CudaMem::operator Mat() const
|
||||
|
||||
Creates header without reference counting to CudaMem data.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::CudaMem::createGpuMatHeader
|
||||
|
||||
|
||||
cv::gpu::CudaMem::createGpuMatHeader
|
||||
------------------------------------
|
||||
|
||||
`id=0.759677323147 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ACudaMem%3A%3AcreateGpuMatHeader>`__
|
||||
|
||||
|
||||
:func:`gpu::GpuMat`
|
||||
``_``
|
||||
|
||||
|
||||
.. cfunction:: GpuMat CudaMem::createGpuMatHeader() const
|
||||
|
||||
|
||||
|
||||
.. cfunction:: CudaMem::operator GpuMat() const
|
||||
|
||||
Maps CPU memory to GPU address space and creates header without reference counting for it. This can be done only if memory was allocated with ALLOCZEROCOPYflag and if it is supported by hardware (laptops often share video and CPU memory, so address spaces can be mapped, and that eliminates extra copy).
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::CudaMem::canMapHostMemory
|
||||
|
||||
|
||||
cv::gpu::CudaMem::canMapHostMemory
|
||||
----------------------------------
|
||||
|
||||
`id=0.317724503486 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ACudaMem%3A%3AcanMapHostMemory>`__
|
||||
|
||||
|
||||
``_``
|
||||
|
||||
|
||||
.. cfunction:: static bool CudaMem::canMapHostMemory()
|
||||
|
||||
Returns true if the current hardware supports address space mapping and ALLOCZEROCOPYmemory allocation
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::Stream
|
||||
|
||||
.. _gpu::Stream:
|
||||
|
||||
gpu::Stream
|
||||
-----------
|
||||
|
||||
`id=0.153849663278 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStream>`__
|
||||
|
||||
.. ctype:: gpu::Stream
|
||||
|
||||
|
||||
|
||||
This class encapsulated queue of the asynchronous calls. Some functions have overloads with additional
|
||||
:func:`gpu::Stream`
|
||||
parameter. The overloads do initialization work (allocate output buffers, upload constants, etc.), start GPU kernel and return before results are ready. A check if all operation are complete can be performed via
|
||||
:func:`gpu::Stream::queryIfComplete()`
|
||||
. Asynchronous upload/download have to be performed from/to page-locked buffers, i.e. using
|
||||
:func:`gpu::CudaMem`
|
||||
or
|
||||
:func:`Mat`
|
||||
header that points to a region of
|
||||
:func:`gpu::CudaMem`
|
||||
.
|
||||
|
||||
**Please note the limitation**
|
||||
: currently it is not guaranteed that all will work properly if one operation will be enqueued twice with different data. Some functions use constant GPU memory and next call may update the memory before previous has been finished. But calling asynchronously different operations is safe because each operation has own constant buffer. Memory copy/upload/download/set operations to buffers hold by user are also safe.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS Stream
|
||||
{
|
||||
public:
|
||||
Stream();
|
||||
~Stream();
|
||||
|
||||
Stream(const Stream&);
|
||||
Stream& operator=(const Stream&);
|
||||
|
||||
bool queryIfComplete();
|
||||
void waitForCompletion();
|
||||
|
||||
//! downloads asynchronously.
|
||||
// Warning! cv::Mat must point to page locked memory
|
||||
(i.e. to CudaMem data or to its subMat)
|
||||
void enqueueDownload(const GpuMat& src, CudaMem& dst);
|
||||
void enqueueDownload(const GpuMat& src, Mat& dst);
|
||||
|
||||
//! uploads asynchronously.
|
||||
// Warning! cv::Mat must point to page locked memory
|
||||
(i.e. to CudaMem data or to its ROI)
|
||||
void enqueueUpload(const CudaMem& src, GpuMat& dst);
|
||||
void enqueueUpload(const Mat& src, GpuMat& dst);
|
||||
|
||||
void enqueueCopy(const GpuMat& src, GpuMat& dst);
|
||||
|
||||
void enqueueMemSet(const GpuMat& src, Scalar val);
|
||||
void enqueueMemSet(const GpuMat& src, Scalar val, const GpuMat& mask);
|
||||
|
||||
// converts matrix type, ex from float to uchar depending on type
|
||||
void enqueueConvert(const GpuMat& src, GpuMat& dst, int type,
|
||||
double a = 1, double b = 0);
|
||||
};
|
||||
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::Stream::queryIfComplete
|
||||
|
||||
|
||||
cv::gpu::Stream::queryIfComplete
|
||||
--------------------------------
|
||||
|
||||
`id=0.136699172621 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStream%3A%3AqueryIfComplete>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: bool Stream::queryIfComplete()
|
||||
|
||||
Returns true if the current stream queue is finished, otherwise false.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::Stream::waitForCompletion
|
||||
|
||||
|
||||
cv::gpu::Stream::waitForCompletion
|
||||
----------------------------------
|
||||
|
||||
`id=0.870172270785 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStream%3A%3AwaitForCompletion>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void Stream::waitForCompletion()
|
||||
|
||||
Blocks until all operations in the stream are complete.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::StreamAccessor
|
||||
|
||||
.. _gpu::StreamAccessor:
|
||||
|
||||
gpu::StreamAccessor
|
||||
-------------------
|
||||
|
||||
`id=0.312772323299 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AStreamAccessor>`__
|
||||
|
||||
.. ctype:: gpu::StreamAccessor
|
||||
|
||||
|
||||
|
||||
This class provides possibility to get
|
||||
``cudaStream_t``
|
||||
from
|
||||
:func:`gpu::Stream`
|
||||
. This class is declared in
|
||||
``stream_accessor.hpp``
|
||||
because that is only public header that depend on Cuda Runtime API. Including it will bring the dependency to your code.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
struct StreamAccessor
|
||||
{
|
||||
CV_EXPORTS static cudaStream_t getStream(const Stream& stream);
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::createContinuous
|
||||
|
||||
|
||||
cv::gpu::createContinuous
|
||||
-------------------------
|
||||
|
||||
`id=0.638242088099 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AcreateContinuous>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void createContinuous(int rows, int cols, int type, GpuMat\& m)
|
||||
|
||||
Creates continuous matrix in GPU memory.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param rows: Row count.
|
||||
|
||||
|
||||
:param cols: Column count.
|
||||
|
||||
|
||||
:param type: Type of the matrix.
|
||||
|
||||
|
||||
:param m: Destination matrix. Will be only reshaped if it has proper type and area ( ``rows`` :math:`\times` ``cols`` ).
|
||||
|
||||
|
||||
|
||||
Also the following wrappers are available:
|
||||
|
||||
|
||||
.. cfunction:: GpuMat createContinuous(int rows, int cols, int type)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void createContinuous(Size size, int type, GpuMat\& m)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: GpuMat createContinuous(Size size, int type)
|
||||
|
||||
|
||||
|
||||
Matrix is called continuous if its elements are stored continuously, i.e. wuthout gaps in the end of each row.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::ensureSizeIsEnough
|
||||
|
||||
|
||||
cv::gpu::ensureSizeIsEnough
|
||||
---------------------------
|
||||
|
||||
`id=0.0969536734629 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AensureSizeIsEnough>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void ensureSizeIsEnough(int rows, int cols, int type, GpuMat\& m)
|
||||
|
||||
Ensures that size of matrix is big enough and matrix has proper type. The function doesn't reallocate memory if the matrix has proper attributes already.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param rows: Minimum desired number of rows.
|
||||
|
||||
|
||||
:param cols: Minimum desired number of cols.
|
||||
|
||||
|
||||
:param type: Desired matrix type.
|
||||
|
||||
|
||||
:param m: Destination matrix.
|
||||
|
||||
|
||||
|
||||
Also the following wrapper is available:
|
||||
|
||||
|
||||
.. cfunction:: void ensureSizeIsEnough(Size size, int type, GpuMat\& m)
|
||||
|
||||
|
||||
|
661
modules/gpu/doc/feature_detection_and_description.rst
Normal file
661
modules/gpu/doc/feature_detection_and_description.rst
Normal file
@@ -0,0 +1,661 @@
|
||||
Feature Detection and Description
|
||||
=================================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::SURF_GPU
|
||||
|
||||
.. _gpu::SURF_GPU:
|
||||
|
||||
gpu::SURF_GPU
|
||||
-------------
|
||||
|
||||
`id=0.87802428318 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ASURF_GPU>`__
|
||||
|
||||
.. ctype:: gpu::SURF_GPU
|
||||
|
||||
|
||||
|
||||
Class for extracting Speeded Up Robust Features from an image.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class SURF_GPU : public SURFParams_GPU
|
||||
{
|
||||
public:
|
||||
//! returns the descriptor size in float's (64 or 128)
|
||||
int descriptorSize() const;
|
||||
|
||||
//! upload host keypoints to device memory
|
||||
static void uploadKeypoints(const vector<KeyPoint>& keypoints,
|
||||
GpuMat& keypointsGPU);
|
||||
//! download keypoints from device to host memory
|
||||
static void downloadKeypoints(const GpuMat& keypointsGPU,
|
||||
vector<KeyPoint>& keypoints);
|
||||
|
||||
//! download descriptors from device to host memory
|
||||
static void downloadDescriptors(const GpuMat& descriptorsGPU,
|
||||
vector<float>& descriptors);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
GpuMat& keypoints);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
GpuMat& keypoints, GpuMat& descriptors,
|
||||
bool useProvidedKeypoints = false,
|
||||
bool calcOrientation = true);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
std::vector<KeyPoint>& keypoints);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
std::vector<KeyPoint>& keypoints, GpuMat& descriptors,
|
||||
bool useProvidedKeypoints = false,
|
||||
bool calcOrientation = true);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
std::vector<KeyPoint>& keypoints,
|
||||
std::vector<float>& descriptors,
|
||||
bool useProvidedKeypoints = false,
|
||||
bool calcOrientation = true);
|
||||
|
||||
GpuMat sum;
|
||||
GpuMat sumf;
|
||||
|
||||
GpuMat mask1;
|
||||
GpuMat maskSum;
|
||||
|
||||
GpuMat hessianBuffer;
|
||||
GpuMat maxPosBuffer;
|
||||
GpuMat featuresBuffer;
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
The class
|
||||
``SURF_GPU``
|
||||
implements Speeded Up Robust Features descriptor. There is fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option), but the descriptors can be also computed for the user-specified keypoints. Supports only 8 bit grayscale images.
|
||||
|
||||
The class
|
||||
``SURF_GPU``
|
||||
can store results to GPU and CPU memory and provides static functions to convert results between CPU and GPU version (
|
||||
``uploadKeypoints``
|
||||
,
|
||||
``downloadKeypoints``
|
||||
,
|
||||
``downloadDescriptors``
|
||||
). CPU results has the same format as
|
||||
results. GPU results are stored to
|
||||
``GpuMat``
|
||||
.
|
||||
``keypoints``
|
||||
matrix is one row matrix with
|
||||
``CV_32FC6``
|
||||
type. It contains 6 float values per feature:
|
||||
``x, y, size, response, angle, octave``
|
||||
.
|
||||
``descriptors``
|
||||
matrix is
|
||||
:math:`\texttt{nFeatures} \times \texttt{descriptorSize}`
|
||||
matrix with
|
||||
``CV_32FC1``
|
||||
type.
|
||||
|
||||
The class
|
||||
``SURF_GPU``
|
||||
uses some buffers and provides access to it. All buffers can be safely released between function calls.
|
||||
|
||||
See also:
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::BruteForceMatcher_GPU
|
||||
|
||||
.. _gpu::BruteForceMatcher_GPU:
|
||||
|
||||
gpu::BruteForceMatcher_GPU
|
||||
--------------------------
|
||||
|
||||
`id=0.776429775465 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ABruteForceMatcher_GPU>`__
|
||||
|
||||
.. ctype:: gpu::BruteForceMatcher_GPU
|
||||
|
||||
|
||||
|
||||
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches between descriptor sets.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
template<class Distance>
|
||||
class BruteForceMatcher_GPU
|
||||
{
|
||||
public:
|
||||
// Add descriptors to train descriptor collection.
|
||||
void add(const std::vector<GpuMat>& descCollection);
|
||||
|
||||
// Get train descriptors collection.
|
||||
const std::vector<GpuMat>& getTrainDescriptors() const;
|
||||
|
||||
// Clear train descriptors collection.
|
||||
void clear();
|
||||
|
||||
// Return true if there are not train descriptors in collection.
|
||||
bool empty() const;
|
||||
|
||||
// Return true if the matcher supports mask in match methods.
|
||||
bool isMaskSupported() const;
|
||||
|
||||
void matchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs,
|
||||
GpuMat& trainIdx, GpuMat& distance,
|
||||
const GpuMat& mask = GpuMat());
|
||||
|
||||
static void matchDownload(const GpuMat& trainIdx,
|
||||
const GpuMat& distance, std::vector<DMatch>& matches);
|
||||
|
||||
void match(const GpuMat& queryDescs, const GpuMat& trainDescs,
|
||||
std::vector<DMatch>& matches, const GpuMat& mask = GpuMat());
|
||||
|
||||
void makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection,
|
||||
const vector<GpuMat>& masks = std::vector<GpuMat>());
|
||||
|
||||
void matchCollection(const GpuMat& queryDescs,
|
||||
const GpuMat& trainCollection,
|
||||
GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
|
||||
const GpuMat& maskCollection);
|
||||
|
||||
static void matchDownload(const GpuMat& trainIdx, GpuMat& imgIdx,
|
||||
const GpuMat& distance, std::vector<DMatch>& matches);
|
||||
|
||||
void match(const GpuMat& queryDescs, std::vector<DMatch>& matches,
|
||||
const std::vector<GpuMat>& masks = std::vector<GpuMat>());
|
||||
|
||||
void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
|
||||
GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k,
|
||||
const GpuMat& mask = GpuMat());
|
||||
|
||||
static void knnMatchDownload(const GpuMat& trainIdx,
|
||||
const GpuMat& distance, std::vector< std::vector<DMatch> >& matches,
|
||||
bool compactResult = false);
|
||||
|
||||
void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
|
||||
std::vector< std::vector<DMatch> >& matches, int k,
|
||||
const GpuMat& mask = GpuMat(), bool compactResult = false);
|
||||
|
||||
void knnMatch(const GpuMat& queryDescs,
|
||||
std::vector< std::vector<DMatch> >& matches, int knn,
|
||||
const std::vector<GpuMat>& masks = std::vector<GpuMat>(),
|
||||
bool compactResult = false );
|
||||
|
||||
void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
|
||||
GpuMat& trainIdx, GpuMat& nMatches, GpuMat& distance,
|
||||
float maxDistance, const GpuMat& mask = GpuMat());
|
||||
|
||||
static void radiusMatchDownload(const GpuMat& trainIdx,
|
||||
const GpuMat& nMatches, const GpuMat& distance,
|
||||
std::vector< std::vector<DMatch> >& matches,
|
||||
bool compactResult = false);
|
||||
|
||||
void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
|
||||
std::vector< std::vector<DMatch> >& matches, float maxDistance,
|
||||
const GpuMat& mask = GpuMat(), bool compactResult = false);
|
||||
|
||||
void radiusMatch(const GpuMat& queryDescs,
|
||||
std::vector< std::vector<DMatch> >& matches, float maxDistance,
|
||||
const std::vector<GpuMat>& masks = std::vector<GpuMat>(),
|
||||
bool compactResult = false);
|
||||
|
||||
private:
|
||||
std::vector<GpuMat> trainDescCollection;
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
The class
|
||||
``BruteForceMatcher_GPU``
|
||||
has the similar interface to class
|
||||
. It has two groups of match methods: for matching descriptors of one image with other image or with image set. Also all functions have alternative: save results to GPU memory or to CPU memory.
|
||||
|
||||
``Distance``
|
||||
template parameter is kept for CPU/GPU interfaces similarity.
|
||||
``BruteForceMatcher_GPU``
|
||||
supports only
|
||||
``L1<float>``
|
||||
and
|
||||
``L2<float>``
|
||||
distance types.
|
||||
|
||||
See also:
|
||||
,
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::match
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::match:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::match
|
||||
-------------------------------------
|
||||
|
||||
`id=0.164151048457 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3Amatch>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void match(const GpuMat\& queryDescs, const GpuMat\& trainDescs, std::vector<DMatch>\& matches, const GpuMat\& mask = GpuMat())
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void match(const GpuMat\& queryDescs, std::vector<DMatch>\& matches, const std::vector<GpuMat>\& masks = std::vector<GpuMat>())
|
||||
|
||||
Finds the best match for each descriptor from a query set with train descriptors.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`DescriptorMatcher::match`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::matchSingle
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::matchSingle:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::matchSingle
|
||||
-------------------------------------------
|
||||
|
||||
`id=0.230978706047 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AmatchSingle>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void matchSingle(const GpuMat\& queryDescs, const GpuMat\& trainDescs, GpuMat\& trainIdx, GpuMat\& distance, const GpuMat\& mask = GpuMat())
|
||||
|
||||
Finds the best match for each query descriptor. Results will be stored to GPU memory.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{Query set of descriptors.}
|
||||
{Train set of descriptors. This will not be added to train descriptors collection stored in class object.}
|
||||
{One row
|
||||
``CV_32SC1``
|
||||
matrix. Will contain the best train index for each query. If some query descriptors are masked out in
|
||||
``mask``
|
||||
it will contain -1.}
|
||||
{One row
|
||||
``CV_32FC1``
|
||||
matrix. Will contain the best distance for each query. If some query descriptors are masked out in
|
||||
``mask``
|
||||
it will contain
|
||||
``FLT_MAX``
|
||||
.}
|
||||
|
||||
:param mask: Mask specifying permissible matches between input query and train matrices of descriptors.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::matchCollection
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::matchCollection:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::matchCollection
|
||||
-----------------------------------------------
|
||||
|
||||
`id=0.934341769456 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AmatchCollection>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void matchCollection(const GpuMat\& queryDescs, const GpuMat\& trainCollection, GpuMat\& trainIdx, GpuMat\& imgIdx, GpuMat\& distance, const GpuMat\& maskCollection)
|
||||
|
||||
Find the best match for each query descriptor from train collection. Results will be stored to GPU memory.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{Query set of descriptors.}
|
||||
{
|
||||
``GpuMat``
|
||||
containing train collection. It can be obtained from train descriptors collection that was set using
|
||||
``add``
|
||||
method by
|
||||
. Or it can contain user defined collection. It must be one row matrix, each element is a
|
||||
``DevMem2D``
|
||||
that points to one train descriptors matrix.}
|
||||
{One row
|
||||
``CV_32SC1``
|
||||
matrix. Will contain the best train index for each query. If some query descriptors are masked out in
|
||||
``maskCollection``
|
||||
it will contain -1.}
|
||||
{One row
|
||||
``CV_32SC1``
|
||||
matrix. Will contain image train index for each query. If some query descriptors are masked out in
|
||||
``maskCollection``
|
||||
it will contain -1.}
|
||||
{One row
|
||||
``CV_32FC1``
|
||||
matrix. Will contain the best distance for each query. If some query descriptors are masked out in
|
||||
``maskCollection``
|
||||
it will contain
|
||||
``FLT_MAX``
|
||||
.}
|
||||
|
||||
:param maskCollection: ``GpuMat`` containing set of masks. It can be obtained from ``std::vector<GpuMat>`` by . Or it can contain user defined mask set. It must be empty matrix or one row matrix, each element is a ``PtrStep`` that points to one mask.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::makeGpuCollection
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::makeGpuCollection:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::makeGpuCollection
|
||||
-------------------------------------------------
|
||||
|
||||
`id=0.285830043662 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AmakeGpuCollection>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void makeGpuCollection(GpuMat\& trainCollection, GpuMat\& maskCollection, const vector<GpuMat>\& masks = std::vector<GpuMat>())
|
||||
|
||||
Makes gpu collection of train descriptors and masks in suitable format for function.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::matchDownload
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::matchDownload:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::matchDownload
|
||||
---------------------------------------------
|
||||
|
||||
`id=0.171611509706 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AmatchDownload>`__
|
||||
|
||||
|
||||
````
|
||||
````
|
||||
````
|
||||
|
||||
|
||||
.. cfunction:: void matchDownload(const GpuMat\& trainIdx, const GpuMat\& distance, std::vector<DMatch>\& matches)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void matchDownload(const GpuMat\& trainIdx, GpuMat\& imgIdx, const GpuMat\& distance, std::vector<DMatch>\& matches)
|
||||
|
||||
Downloads trainIdx, imgIdxand distancematrices obtained via or to CPU vector with .
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::knnMatch
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::knnMatch:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::knnMatch
|
||||
----------------------------------------
|
||||
|
||||
`id=0.619005099272 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AknnMatch>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void knnMatch(const GpuMat\& queryDescs, const GpuMat\& trainDescs, std::vector< std::vector<DMatch> >\& matches, int k, const GpuMat\& mask = GpuMat(), bool compactResult = false)
|
||||
|
||||
Finds the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in distance increasing order.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void knnMatch(const GpuMat\& queryDescs, std::vector< std::vector<DMatch> >\& matches, int k, const std::vector<GpuMat>\& masks = std::vector<GpuMat>(), bool compactResult = false )
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`DescriptorMatcher::knnMatch`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::knnMatch
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::knnMatch:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::knnMatch
|
||||
----------------------------------------
|
||||
|
||||
`id=0.852761934257 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AknnMatch>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void knnMatch(const GpuMat\& queryDescs, const GpuMat\& trainDescs, GpuMat\& trainIdx, GpuMat\& distance, GpuMat\& allDist, int k, const GpuMat\& mask = GpuMat())
|
||||
|
||||
Finds the k best matches for each descriptor from a query set with train descriptors. Found k (or less if not possible) matches are returned in distance increasing order. Results will be stored to GPU memory.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{Query set of descriptors.}
|
||||
{Train set of descriptors. This will not be added to train descriptors collection stored in class object.}
|
||||
{Matrix with
|
||||
:math:`\texttt{nQueries} \times \texttt{k}`
|
||||
size and
|
||||
``CV_32SC1``
|
||||
type.
|
||||
``trainIdx.at<int>(queryIdx, i)``
|
||||
will contain index of the i'th best trains. If some query descriptors are masked out in
|
||||
``mask``
|
||||
it will contain -1.}
|
||||
{Matrix with
|
||||
:math:`\texttt{nQuery} \times \texttt{k}`
|
||||
and
|
||||
``CV_32FC1``
|
||||
type. Will contain distance for each query and the i'th best trains. If some query descriptors are masked out in
|
||||
``mask``
|
||||
it will contain
|
||||
``FLT_MAX``
|
||||
.}
|
||||
{Buffer to store all distances between query descriptors and train descriptors. It will have
|
||||
:math:`\texttt{nQuery} \times \texttt{nTrain}`
|
||||
size and
|
||||
``CV_32FC1``
|
||||
type.
|
||||
``allDist.at<float>(queryIdx, trainIdx)``
|
||||
will contain
|
||||
``FLT_MAX``
|
||||
, if
|
||||
``trainIdx``
|
||||
is one from k best, otherwise it will contain distance between
|
||||
``queryIdx``
|
||||
and
|
||||
``trainIdx``
|
||||
descriptors.}
|
||||
|
||||
:param k: Number of the best matches will be found per each query descriptor (or less if it's not possible).
|
||||
|
||||
|
||||
:param mask: Mask specifying permissible matches between input query and train matrices of descriptors.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::knnMatchDownload
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::knnMatchDownload:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::knnMatchDownload
|
||||
------------------------------------------------
|
||||
|
||||
`id=0.735745722087 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AknnMatchDownload>`__
|
||||
|
||||
|
||||
````
|
||||
````
|
||||
````
|
||||
````
|
||||
|
||||
|
||||
.. cfunction:: void knnMatchDownload(const GpuMat\& trainIdx, const GpuMat\& distance, std::vector< std::vector<DMatch> >\& matches, bool compactResult = false)
|
||||
|
||||
Downloads trainIdxand distancematrices obtained via to CPU vector with . If compactResultis true matchesvector will not contain matches for fully masked out query descriptors.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::radiusMatch
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::radiusMatch:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::radiusMatch
|
||||
-------------------------------------------
|
||||
|
||||
`id=0.964758287221 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AradiusMatch>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void radiusMatch(const GpuMat\& queryDescs, const GpuMat\& trainDescs, std::vector< std::vector<DMatch> >\& matches, float maxDistance, const GpuMat\& mask = GpuMat(), bool compactResult = false)
|
||||
|
||||
Finds the best matches for each query descriptor which have distance less than given threshold. Found matches are returned in distance increasing order.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void radiusMatch(const GpuMat\& queryDescs, std::vector< std::vector<DMatch> >\& matches, float maxDistance, const std::vector<GpuMat>\& masks = std::vector<GpuMat>(), bool compactResult = false)
|
||||
|
||||
|
||||
|
||||
This function works only on devices with Compute Capability
|
||||
:math:`>=`
|
||||
1.1.
|
||||
|
||||
See also:
|
||||
:func:`DescriptorMatcher::radiusMatch`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::radiusMatch
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::radiusMatch:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::radiusMatch
|
||||
-------------------------------------------
|
||||
|
||||
`id=0.499772925784 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AradiusMatch>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void radiusMatch(const GpuMat\& queryDescs, const GpuMat\& trainDescs, GpuMat\& trainIdx, GpuMat\& nMatches, GpuMat\& distance, float maxDistance, const GpuMat\& mask = GpuMat())
|
||||
|
||||
Finds the best matches for each query descriptor which have distance less than given threshold. Results will be stored to GPU memory.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{Query set of descriptors.}
|
||||
{Train set of descriptors. This will not be added to train descriptors collection stored in class object.}
|
||||
{
|
||||
``trainIdx.at<int>(queryIdx, i)``
|
||||
will contain i'th train index
|
||||
``(i < min(nMatches.at<unsigned int>(0, queryIdx), trainIdx.cols)``
|
||||
. If
|
||||
``trainIdx``
|
||||
is empty, it will be created with size
|
||||
:math:`\texttt{nQuery} \times \texttt{nTrain}`
|
||||
. Or it can be allocated by user (it must have
|
||||
``nQuery``
|
||||
rows and
|
||||
``CV_32SC1``
|
||||
type). Cols can be less than
|
||||
``nTrain``
|
||||
, but it can be that matcher won't find all matches, because it haven't enough memory to store results.}
|
||||
{
|
||||
``nMatches.at<unsigned int>(0, queryIdx)``
|
||||
will contain matches count for
|
||||
``queryIdx``
|
||||
. Carefully,
|
||||
``nMatches``
|
||||
can be greater than
|
||||
``trainIdx.cols``
|
||||
- it means that matcher didn't find all matches, because it didn't have enough memory.}
|
||||
{
|
||||
``distance.at<int>(queryIdx, i)``
|
||||
will contain i'th distance
|
||||
``(i < min(nMatches.at<unsigned int>(0, queryIdx), trainIdx.cols)``
|
||||
. If
|
||||
``trainIdx``
|
||||
is empty, it will be created with size
|
||||
:math:`\texttt{nQuery} \times \texttt{nTrain}`
|
||||
. Otherwise it must be also allocated by user (it must have the same size as
|
||||
``trainIdx``
|
||||
and
|
||||
``CV_32FC1``
|
||||
type).}
|
||||
|
||||
:param maxDistance: Distance threshold.
|
||||
|
||||
|
||||
:param mask: Mask specifying permissible matches between input query and train matrices of descriptors.
|
||||
|
||||
|
||||
|
||||
In contrast to
|
||||
results are not sorted by distance increasing order.
|
||||
|
||||
This function works only on devices with Compute Capability
|
||||
:math:`>=`
|
||||
1.1.
|
||||
|
||||
|
||||
.. index:: cv::gpu::BruteForceMatcher_GPU::radiusMatchDownload
|
||||
|
||||
.. _cv::gpu::BruteForceMatcher_GPU::radiusMatchDownload:
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU::radiusMatchDownload
|
||||
---------------------------------------------------
|
||||
|
||||
`id=0.627360663551 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ABruteForceMatcher_GPU%3A%3AradiusMatchDownload>`__
|
||||
|
||||
|
||||
````
|
||||
````
|
||||
````
|
||||
````
|
||||
````
|
||||
|
||||
|
||||
.. cfunction:: void radiusMatchDownload(const GpuMat\& trainIdx, const GpuMat\& nMatches, const GpuMat\& distance, std::vector< std::vector<DMatch> >\& matches, bool compactResult = false)
|
||||
|
||||
Downloads trainIdx, nMatchesand distancematrices obtained via to CPU vector with . If compactResultis true matchesvector will not contain matches for fully masked out query descriptors.
|
||||
|
||||
|
||||
|
18
modules/gpu/doc/gpu.rst
Normal file
18
modules/gpu/doc/gpu.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
*******************************
|
||||
GPU-accelerated Computer Vision
|
||||
*******************************
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
gpu_gpu_module_introduction
|
||||
gpu_initalization_and_information
|
||||
gpu_data_structures
|
||||
gpu_operations_on_matrices
|
||||
gpu_per-element_operations.
|
||||
gpu_image_processing
|
||||
gpu_matrix_reductions
|
||||
gpu_object_detection
|
||||
gpu_feature_detection_and_description
|
||||
gpu_image_filtering
|
||||
gpu_camera_calibration_and_3d_reconstruction
|
1400
modules/gpu/doc/image_filtering.rst
Normal file
1400
modules/gpu/doc/image_filtering.rst
Normal file
File diff suppressed because it is too large
Load Diff
1254
modules/gpu/doc/image_processing.rst
Normal file
1254
modules/gpu/doc/image_processing.rst
Normal file
File diff suppressed because it is too large
Load Diff
402
modules/gpu/doc/initalization_and_information.rst
Normal file
402
modules/gpu/doc/initalization_and_information.rst
Normal file
@@ -0,0 +1,402 @@
|
||||
Initalization and Information
|
||||
=============================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::getCudaEnabledDeviceCount
|
||||
|
||||
|
||||
cv::gpu::getCudaEnabledDeviceCount
|
||||
----------------------------------
|
||||
|
||||
`id=0.541856697999 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AgetCudaEnabledDeviceCount>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int getCudaEnabledDeviceCount()
|
||||
|
||||
Returns number of CUDA-enabled devices installed. It is to be used before any other GPU functions calls. If OpenCV is compiled without GPU support this function returns 0.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::setDevice
|
||||
|
||||
|
||||
cv::gpu::setDevice
|
||||
------------------
|
||||
|
||||
`id=0.817295536445 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AsetDevice>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void setDevice(int device)
|
||||
|
||||
Sets device and initializes it for the current thread. Call of this function can be omitted, but in this case a default device will be initialized on fist GPU usage.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param device: index of GPU device in system starting with 0.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::getDevice
|
||||
|
||||
|
||||
cv::gpu::getDevice
|
||||
------------------
|
||||
|
||||
`id=0.908782607162 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AgetDevice>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int getDevice()
|
||||
|
||||
Returns the current device index, which was set by {gpu::getDevice} or initialized by default.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::GpuFeature
|
||||
|
||||
.. _gpu::GpuFeature:
|
||||
|
||||
gpu::GpuFeature
|
||||
---------------
|
||||
|
||||
`id=0.185426029041 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AGpuFeature>`__
|
||||
|
||||
.. ctype:: gpu::GpuFeature
|
||||
|
||||
|
||||
|
||||
GPU compute features.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
enum GpuFeature
|
||||
{
|
||||
COMPUTE_10, COMPUTE_11,
|
||||
COMPUTE_12, COMPUTE_13,
|
||||
COMPUTE_20, COMPUTE_21,
|
||||
ATOMICS, NATIVE_DOUBLE
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo
|
||||
|
||||
.. _gpu::DeviceInfo:
|
||||
|
||||
gpu::DeviceInfo
|
||||
---------------
|
||||
|
||||
`id=0.91098225386 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo>`__
|
||||
|
||||
.. ctype:: gpu::DeviceInfo
|
||||
|
||||
|
||||
|
||||
This class provides functionality for querying the specified GPU properties.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS DeviceInfo
|
||||
{
|
||||
public:
|
||||
DeviceInfo();
|
||||
DeviceInfo(int device_id);
|
||||
|
||||
string name() const;
|
||||
|
||||
int majorVersion() const;
|
||||
int minorVersion() const;
|
||||
|
||||
int multiProcessorCount() const;
|
||||
|
||||
size_t freeMemory() const;
|
||||
size_t totalMemory() const;
|
||||
|
||||
bool supports(GpuFeature feature) const;
|
||||
bool isCompatible() const;
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::DeviceInfo
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::DeviceInfo
|
||||
-------------------------------
|
||||
|
||||
`id=0.971366637207 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3ADeviceInfo>`__
|
||||
|
||||
|
||||
``_``
|
||||
|
||||
|
||||
.. cfunction:: DeviceInfo::DeviceInfo()
|
||||
|
||||
|
||||
|
||||
.. cfunction:: DeviceInfo::DeviceInfo(int device_id)
|
||||
|
||||
Constructs DeviceInfo object for the specified device. If deviceidparameter is missed it constructs object for the current device.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param device_id: Index of the GPU device in system starting with 0.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::name
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::name
|
||||
-------------------------
|
||||
|
||||
`id=0.472941921148 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3Aname>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: string DeviceInfo::name()
|
||||
|
||||
Returns the device name.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::majorVersion
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::majorVersion
|
||||
---------------------------------
|
||||
|
||||
`id=0.982334984119 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3AmajorVersion>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int DeviceInfo::majorVersion()
|
||||
|
||||
Returns the major compute capability version.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::minorVersion
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::minorVersion
|
||||
---------------------------------
|
||||
|
||||
`id=0.309433581176 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3AminorVersion>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int DeviceInfo::minorVersion()
|
||||
|
||||
Returns the minor compute capability version.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::multiProcessorCount
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::multiProcessorCount
|
||||
----------------------------------------
|
||||
|
||||
`id=0.417609601388 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3AmultiProcessorCount>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int DeviceInfo::multiProcessorCount()
|
||||
|
||||
Returns the number of streaming multiprocessors.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::freeMemory
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::freeMemory
|
||||
-------------------------------
|
||||
|
||||
`id=0.961189453269 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3AfreeMemory>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: size_t DeviceInfo::freeMemory()
|
||||
|
||||
Returns the amount of free memory in bytes.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::totalMemory
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::totalMemory
|
||||
--------------------------------
|
||||
|
||||
`id=0.884488673579 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3AtotalMemory>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: size_t DeviceInfo::totalMemory()
|
||||
|
||||
Returns the amount of total memory in bytes.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::supports
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::supports
|
||||
-----------------------------
|
||||
|
||||
`id=0.141435828088 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3Asupports>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: bool DeviceInfo::supports(GpuFeature feature)
|
||||
|
||||
Returns true if the device has the given GPU feature, otherwise false.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param feature: Feature to be checked. See .
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::DeviceInfo::isCompatible
|
||||
|
||||
|
||||
cv::gpu::DeviceInfo::isCompatible
|
||||
---------------------------------
|
||||
|
||||
`id=0.564690282768 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ADeviceInfo%3A%3AisCompatible>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: bool DeviceInfo::isCompatible()
|
||||
|
||||
Returns true if the GPU module can be run on the specified device, otherwise false.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::TargetArchs
|
||||
|
||||
.. _gpu::TargetArchs:
|
||||
|
||||
gpu::TargetArchs
|
||||
----------------
|
||||
|
||||
`id=0.200853353999 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ATargetArchs>`__
|
||||
|
||||
.. ctype:: gpu::TargetArchs
|
||||
|
||||
|
||||
|
||||
This class provides functionality (as set of static methods) for checking which NVIDIA card architectures the GPU module was built for.
|
||||
|
||||
bigskip
|
||||
The following method checks whether the module was built with the support of the given feature:
|
||||
|
||||
|
||||
.. cfunction:: static bool builtWith(GpuFeature feature)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param feature: Feature to be checked. See .
|
||||
|
||||
|
||||
|
||||
There are a set of methods for checking whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
|
||||
|
||||
|
||||
.. cfunction:: static bool has(int major, int minor)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static bool hasPtx(int major, int minor)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static bool hasBin(int major, int minor)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static bool hasEqualOrLessPtx(int major, int minor)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static bool hasEqualOrGreater(int major, int minor)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static bool hasEqualOrGreaterPtx(int major, int minor)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static bool hasEqualOrGreaterBin(int major, int minor)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **major** Major compute capability version.
|
||||
|
||||
|
||||
* **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".
|
||||
|
122
modules/gpu/doc/introduction.rst
Normal file
122
modules/gpu/doc/introduction.rst
Normal file
@@ -0,0 +1,122 @@
|
||||
GPU module introduction
|
||||
=======================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
General information
|
||||
-------------------
|
||||
|
||||
|
||||
The OpenCV GPU module is a set of classes and functions to utilize GPU computational capabilities. It is implemented using NVidia CUDA Runtime API, so only the NVidia GPUs are supported. It includes utility functions, low-level vision primitives as well as high-level algorithms. The utility functions and low-level primitives provide a powerful infrastructure for developing fast vision algorithms taking advantage of GPU. Whereas the high-level functionality includes some state-of-the-art algorithms (such as stereo correspondence, face and people detectors etc.), ready to be used by the application developers.
|
||||
|
||||
The GPU module is designed as host-level API, i.e. if a user has pre-compiled OpenCV GPU binaries, it is not necessary to have Cuda Toolkit installed or write any extra code to make use of the GPU.
|
||||
|
||||
The GPU module depends on the Cuda Toolkit and NVidia Performance Primitives library (NPP). Make sure you have the latest versions of those. The two libraries can be downloaded from NVidia site for all supported platforms. To compile OpenCV GPU module you will need a compiler compatible with Cuda Runtime Toolkit.
|
||||
|
||||
OpenCV GPU module is designed for ease of use and does not require any knowledge of Cuda. Though, such a knowledge will certainly be useful in non-trivial cases, or when you want to get the highest performance. It is helpful to have understanding of the costs of various operations, what the GPU does, what are the preferred data formats etc. The GPU module is an effective instrument for quick implementation of GPU-accelerated computer vision algorithms. However, if you 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 GPU module will be built. Otherwise, the module will still be built, but at runtime all functions from the module will throw
|
||||
:func:`Exception`
|
||||
with
|
||||
``CV_GpuNotSupported``
|
||||
error code, except for
|
||||
:func:`gpu::getCudaEnabledDeviceCount()`
|
||||
. The latter function will return zero GPU count in this case. Building OpenCV without CUDA support does not perform device code compilation, so it does not require Cuda Toolkit installed. Therefore, using
|
||||
:func:`gpu::getCudaEnabledDeviceCount()`
|
||||
function it is possible to implement a high-level algorithm that will detect GPU presence at runtime and choose the appropriate implementation (CPU or GPU) accordingly.
|
||||
|
||||
|
||||
Compilation for different NVidia platforms.
|
||||
-------------------------------------------
|
||||
|
||||
|
||||
NVidia compiler allows 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, which is defined entirely by the set of capabilities, or features. Depending on the virtual platform chosen, some of the instructions will be emulated or disabled, even if the real hardware supports all the features.
|
||||
|
||||
On first call, the PTX code is compiled to binary code for the particular GPU using JIT compiler. When the target GPU has lower "compute capability" (CC) than the PTX code, JIT fails.
|
||||
|
||||
By default, the OpenCV GPU 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)
|
||||
|
||||
|
||||
That means 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 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 will throw
|
||||
:func:`Exception`
|
||||
. For platforms where JIT compilation is performed first run will be slow.
|
||||
|
||||
If you happen to have GPU with CC 1.0, the GPU module can still be compiled on it and most of the functions will run just fine on such card. Simply add "1.0" to the list of binaries, for example,
|
||||
``CUDA_ARCH_BIN="1.0 1.3 2.0"``
|
||||
. The functions that can not be run on CC 1.0 GPUs will throw an exception.
|
||||
|
||||
You can always determine at runtime whether OpenCV GPU built binaries (or PTX code) are compatible with your GPU. The function
|
||||
:func:`gpu::DeviceInfo::isCompatible`
|
||||
return the compatibility status (true/false).
|
||||
|
||||
|
||||
|
||||
Threading and multi-threading.
|
||||
------------------------------
|
||||
|
||||
|
||||
OpenCV GPU module follows Cuda Runtime API conventions regarding the multi-threaded programming. That is, on first the API call a Cuda context is created implicitly, attached to the current CPU thread and then is used as the thread's "current" context. All further operations, such as memory allocation, GPU code compilation, will be associated with the context and the thread. Because any other thread is not attached to the context, memory (and other resources) allocated in the first thread can not be accessed by the other thread. Instead, for this other thread Cuda will create another context associated with it. In short, by default different threads do not share resources.
|
||||
|
||||
But such limitation can be removed using Cuda Driver API (version 3.1 or later). User can retrieve context reference for one thread, attach it to another thread and make it "current" for that thread. Then the threads can share memory and other resources. It is also possible to create a context explicitly before calling any GPU code and attach it to all the threads that you want to share the resources.
|
||||
|
||||
Also it is possible to create context explicitly using Cuda Driver API, attach and make "current" for all necessary threads. Cuda Runtime API (and OpenCV functions respectively) will pick up it.
|
||||
|
||||
|
||||
Multi-GPU
|
||||
---------
|
||||
|
||||
|
||||
In the current version each of the OpenCV GPU algorithms can use only a single GPU. So, to utilize multiple GPUs, user has to manually distribute the work between the GPUs. Here are the two ways of utilizing multiple GPUs:
|
||||
|
||||
|
||||
|
||||
|
||||
*
|
||||
If you only use synchronous functions, first, create several CPU threads (one per each GPU) and from within each thread create CUDA context for the corresponding GPU using
|
||||
:func:`gpu::setDevice()`
|
||||
or Driver API. That's it. Now each of the threads will use the associated GPU.
|
||||
|
||||
|
||||
*
|
||||
In case of asynchronous functions, it is possible to create several Cuda contexts associated with different GPUs but attached to one CPU thread. This can be done only by Driver API. Within the thread you can switch from one GPU to another by making the corresponding context "current". With non-blocking GPU calls managing algorithm is clear.
|
||||
|
||||
|
||||
While developing algorithms for multiple GPUs a data passing overhead have to be taken into consideration. For primitive functions and for small images it can be significant and eliminate all the advantages of having multiple GPUs. But for high level algorithms Multi-GPU acceleration may be suitable. For example, Stereo Block Matching algorithm has been successfully parallelized using the following algorithm:
|
||||
|
||||
|
||||
|
||||
|
||||
*
|
||||
Each image of the stereo pair is split into two horizontal overlapping stripes.
|
||||
|
||||
|
||||
*
|
||||
Each pair of stripes (from the left and the right images) has been processed on a separate Fermi GPU
|
||||
|
||||
|
||||
*
|
||||
The results are merged into the single disparity map.
|
||||
|
||||
|
||||
With this scheme dual GPU gave 180
|
||||
%
|
||||
performance increase comparing to the single Fermi GPU. The source code of the example is available at
|
||||
https://code.ros.org/svn/opencv/trunk/opencv/examples/gpu/
|
366
modules/gpu/doc/matrix_reductions.rst
Normal file
366
modules/gpu/doc/matrix_reductions.rst
Normal file
@@ -0,0 +1,366 @@
|
||||
Matrix Reductions
|
||||
=================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::meanStdDev
|
||||
|
||||
|
||||
cv::gpu::meanStdDev
|
||||
-------------------
|
||||
|
||||
`id=0.607789005794 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AmeanStdDev>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void meanStdDev(const GpuMat\& mtx, Scalar\& mean, Scalar\& stddev)
|
||||
|
||||
Computes mean value and standard deviation of matrix elements.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param mtx: Source matrix. ``CV_8UC1`` matrices are supported for now.
|
||||
|
||||
|
||||
:param mean: Mean value.
|
||||
|
||||
|
||||
:param stddev: Standard deviation value.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`meanStdDev`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::norm
|
||||
|
||||
|
||||
cv::gpu::norm
|
||||
-------------
|
||||
|
||||
`id=0.423726153071 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Anorm>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: double norm(const GpuMat\& src, int normType=NORM_L2)
|
||||
|
||||
Returns norm of matrix (or of two matrices difference).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source matrix. Any matrices except 64F are supported.
|
||||
|
||||
|
||||
:param normType: Norm type. ``NORM_L1`` , ``NORM_L2`` and ``NORM_INF`` are supported for now.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: double norm(const GpuMat\& src, int normType, GpuMat\& buf)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **src** Source matrix. Any matrices except 64F are supported.
|
||||
|
||||
|
||||
* **normType** Norm type. ``NORM_L1`` , ``NORM_L2`` and ``NORM_INF`` are supported for now.
|
||||
|
||||
|
||||
* **buf** Optional buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: double norm(const GpuMat\& src1, const GpuMat\& src2,
|
||||
int normType=NORM_L2)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **src1** First source matrix. ``CV_8UC1`` matrices are supported for now.
|
||||
|
||||
|
||||
* **src2** Second source matrix. Must have the same size and type as ``src1``
|
||||
|
||||
.
|
||||
|
||||
* **normType** Norm type. ``NORM_L1`` , ``NORM_L2`` and ``NORM_INF`` are supported for now.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`norm`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::sum
|
||||
|
||||
|
||||
cv::gpu::sum
|
||||
------------
|
||||
|
||||
`id=0.979123982078 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Asum>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: Scalar sum(const GpuMat\& src)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: Scalar sum(const GpuMat\& src, GpuMat\& buf)
|
||||
|
||||
Returns sum of matrix elements.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source image of any depth except ``CV_64F`` .
|
||||
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`sum`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::absSum
|
||||
|
||||
|
||||
cv::gpu::absSum
|
||||
---------------
|
||||
|
||||
`id=0.607738316178 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AabsSum>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: Scalar absSum(const GpuMat\& src)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: Scalar absSum(const GpuMat\& src, GpuMat\& buf)
|
||||
|
||||
Returns sum of matrix elements absolute values.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source image of any depth except ``CV_64F`` .
|
||||
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::sqrSum
|
||||
|
||||
|
||||
cv::gpu::sqrSum
|
||||
---------------
|
||||
|
||||
`id=0.470934615291 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AsqrSum>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: Scalar sqrSum(const GpuMat\& src)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: Scalar sqrSum(const GpuMat\& src, GpuMat\& buf)
|
||||
|
||||
Returns squared sum of matrix elements.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source image of any depth except ``CV_64F`` .
|
||||
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::minMax
|
||||
|
||||
|
||||
cv::gpu::minMax
|
||||
---------------
|
||||
|
||||
`id=0.0207742957447 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AminMax>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void minMax(const GpuMat\& src, double* minVal,
|
||||
double* maxVal=0, const GpuMat\& mask=GpuMat())
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void minMax(const GpuMat\& src, double* minVal, double* maxVal,
|
||||
const GpuMat\& mask, GpuMat\& buf)
|
||||
|
||||
Finds global minimum and maximum matrix elements and returns their values.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Single-channel source image.
|
||||
|
||||
|
||||
:param minVal: Pointer to returned minimum value. ``NULL`` if not required.
|
||||
|
||||
|
||||
:param maxVal: Pointer to returned maximum value. ``NULL`` if not required.
|
||||
|
||||
|
||||
:param mask: Optional mask to select a sub-matrix.
|
||||
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
|
||||
Function doesn't work with
|
||||
``CV_64F``
|
||||
images on GPU with compute capability
|
||||
:math:`<`
|
||||
1.3.
|
||||
See also:
|
||||
:func:`minMaxLoc`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::minMaxLoc
|
||||
|
||||
|
||||
cv::gpu::minMaxLoc
|
||||
------------------
|
||||
|
||||
`id=0.985111829483 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AminMaxLoc>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void minMaxLoc(const GpuMat\& src, double\* minVal, double* maxVal=0,
|
||||
Point* minLoc=0, Point* maxLoc=0,
|
||||
const GpuMat\& mask=GpuMat())
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void minMaxLoc(const GpuMat\& src, double* minVal, double* maxVal,
|
||||
Point* minLoc, Point* maxLoc, const GpuMat\& mask,
|
||||
GpuMat\& valbuf, GpuMat\& locbuf)
|
||||
|
||||
Finds global minimum and maximum matrix elements and returns their values with locations.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Single-channel source image.
|
||||
|
||||
|
||||
:param minVal: Pointer to returned minimum value. ``NULL`` if not required.
|
||||
|
||||
|
||||
:param maxVal: Pointer to returned maximum value. ``NULL`` if not required.
|
||||
|
||||
|
||||
:param minValLoc: Pointer to returned minimum location. ``NULL`` if not required.
|
||||
|
||||
|
||||
:param maxValLoc: Pointer to returned maximum location. ``NULL`` if not required.
|
||||
|
||||
|
||||
:param mask: Optional mask to select a sub-matrix.
|
||||
|
||||
|
||||
:param valbuf: Optional values buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
:param locbuf: Optional locations buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
|
||||
Function doesn't work with
|
||||
``CV_64F``
|
||||
images on GPU with compute capability
|
||||
:math:`<`
|
||||
1.3.
|
||||
See also:
|
||||
:func:`minMaxLoc`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::countNonZero
|
||||
|
||||
|
||||
cv::gpu::countNonZero
|
||||
---------------------
|
||||
|
||||
`id=0.904273321304 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AcountNonZero>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int countNonZero(const GpuMat\& src)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int countNonZero(const GpuMat\& src, GpuMat\& buf)
|
||||
|
||||
Counts non-zero matrix elements.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Single-channel source image.
|
||||
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It's resized automatically.
|
||||
|
||||
|
||||
|
||||
Function doesn't work with
|
575
modules/gpu/doc/object_detection.rst
Normal file
575
modules/gpu/doc/object_detection.rst
Normal file
@@ -0,0 +1,575 @@
|
||||
Object Detection
|
||||
================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor
|
||||
|
||||
.. _gpu::HOGDescriptor:
|
||||
|
||||
gpu::HOGDescriptor
|
||||
------------------
|
||||
|
||||
`id=0.263285034412 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor>`__
|
||||
|
||||
.. ctype:: gpu::HOGDescriptor
|
||||
|
||||
|
||||
|
||||
Histogram of Oriented Gradients
|
||||
dalal_hog
|
||||
descriptor and 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 CPU HOG descriptor and detector analogues as much as possible.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::HOGDescriptor
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::HOGDescriptor
|
||||
-------------------------------------
|
||||
|
||||
`id=0.377426649644 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AHOGDescriptor>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: 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)
|
||||
|
||||
Creates HOG descriptor and detector.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param win_size: Detection window size. Must be aligned to block size and block stride.
|
||||
|
||||
|
||||
:param block_size: Block size in pixels. Must be aligned to cell size. Only (16,16) is supported for now.
|
||||
|
||||
|
||||
:param block_stride: Block stride. 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 is supported for now.
|
||||
|
||||
|
||||
:param win_sigma: Gaussian smoothing window parameter.
|
||||
|
||||
|
||||
:param threshold_L2Hys: L2-Hys normalization method shrinkage.
|
||||
|
||||
|
||||
:param gamma_correction: Do gamma correction preprocessing or not.
|
||||
|
||||
|
||||
:param nlevels: Maximum number of detection window increases.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::getDescriptorSize
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::getDescriptorSize
|
||||
-----------------------------------------
|
||||
|
||||
`id=0.25703536307 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AgetDescriptorSize>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: size_t HOGDescriptor::getDescriptorSize() const
|
||||
|
||||
Returns number of coefficients required for the classification.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::getBlockHistogramSize
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::getBlockHistogramSize
|
||||
---------------------------------------------
|
||||
|
||||
`id=0.91431196569 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AgetBlockHistogramSize>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: size_t HOGDescriptor::getBlockHistogramSize() const
|
||||
|
||||
Returns block histogram size.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::setSVMDetector
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::setSVMDetector
|
||||
--------------------------------------
|
||||
|
||||
`id=0.719708439759 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AsetSVMDetector>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void HOGDescriptor::setSVMDetector(const vector<float>\& detector)
|
||||
|
||||
Sets coefficients for the linear SVM classifier.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::getDefaultPeopleDetector
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::getDefaultPeopleDetector
|
||||
------------------------------------------------
|
||||
|
||||
`id=0.941470897866 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AgetDefaultPeopleDetector>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static vector<float> HOGDescriptor::getDefaultPeopleDetector()
|
||||
|
||||
Returns coefficients of the classifier trained for people detection (for default window size).
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::getPeopleDetector48x96
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::getPeopleDetector48x96
|
||||
----------------------------------------------
|
||||
|
||||
`id=0.600273723778 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AgetPeopleDetector48x96>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static vector<float> HOGDescriptor::getPeopleDetector48x96()
|
||||
|
||||
Returns coefficients of the classifier trained for people detection (for 48x96 windows).
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::getPeopleDetector64x128
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::getPeopleDetector64x128
|
||||
-----------------------------------------------
|
||||
|
||||
`id=0.583356812364 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AgetPeopleDetector64x128>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: static vector<float> HOGDescriptor::getPeopleDetector64x128()
|
||||
|
||||
Returns coefficients of the classifier trained for people detection (for 64x128 windows).
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::detect
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::detect
|
||||
------------------------------
|
||||
|
||||
`id=0.0364241115122 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3Adetect>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void HOGDescriptor::detect(const GpuMat\& img,
|
||||
vector<Point>\& found_locations, double hit_threshold=0,
|
||||
Size win_stride=Size(), Size padding=Size())
|
||||
|
||||
Perfroms object detection without multiscale window.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param img: Source image. ``CV_8UC1`` and ``CV_8UC4`` types are supported for now.
|
||||
|
||||
|
||||
:param found_locations: Will contain left-top corner points of detected objects boundaries.
|
||||
|
||||
|
||||
:param hit_threshold: Threshold for the distance between features and SVM classifying plane. Usually it's 0 and should be specfied in the detector coefficients (as the last free coefficient), but if the free coefficient is omitted (it's allowed) you can specify it manually here.
|
||||
|
||||
|
||||
:param win_stride: Window stride. Must be a multiple of block stride.
|
||||
|
||||
|
||||
:param padding: Mock parameter to keep CPU interface compatibility. Must be (0,0).
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::detectMultiScale
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::detectMultiScale
|
||||
----------------------------------------
|
||||
|
||||
`id=0.125190830083 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AdetectMultiScale>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void 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)
|
||||
|
||||
Perfroms object detection with multiscale window.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param img: Source image. See :func:`gpu::HOGDescriptor::detect` for type limitations.
|
||||
|
||||
|
||||
:param found_locations: Will contain detected objects boundaries.
|
||||
|
||||
|
||||
:param hit_threshold: The threshold for the distance between features and SVM classifying plane. See :func:`gpu::HOGDescriptor::detect` for details.
|
||||
|
||||
|
||||
:param win_stride: Window stride. Must be a multiple of block stride.
|
||||
|
||||
|
||||
:param padding: Mock parameter to keep CPU interface compatibility. Must be (0,0).
|
||||
|
||||
|
||||
:param scale0: Coefficient of the detection window increase.
|
||||
|
||||
|
||||
:param group_threshold: After detection some objects could be covered by many rectangles. This coefficient regulates similarity threshold. 0 means don't perform grouping.
|
||||
See :func:`groupRectangles` .
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::HOGDescriptor::getDescriptors
|
||||
|
||||
|
||||
cv::gpu::HOGDescriptor::getDescriptors
|
||||
--------------------------------------
|
||||
|
||||
`id=0.128234884479 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AHOGDescriptor%3A%3AgetDescriptors>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void HOGDescriptor::getDescriptors(const GpuMat\& img,
|
||||
Size win_stride, GpuMat\& descriptors,
|
||||
int descr_format=DESCR_FORMAT_COL_BY_COL)
|
||||
|
||||
Returns block descriptors computed for the whole image. It's mainly used for classifier learning purposes.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param img: Source image. See :func:`gpu::HOGDescriptor::detect` for type limitations.
|
||||
|
||||
|
||||
:param win_stride: Window stride. 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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::CascadeClassifier_GPU
|
||||
|
||||
.. _gpu::CascadeClassifier_GPU:
|
||||
|
||||
gpu::CascadeClassifier_GPU
|
||||
--------------------------
|
||||
|
||||
`id=0.362290729184 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ACascadeClassifier_GPU>`__
|
||||
|
||||
.. ctype:: gpu::CascadeClassifier_GPU
|
||||
|
||||
|
||||
|
||||
The cascade classifier class for object detection.
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS CascadeClassifier_GPU
|
||||
{
|
||||
public:
|
||||
CascadeClassifier_GPU();
|
||||
CascadeClassifier_GPU(const string& filename);
|
||||
~CascadeClassifier_GPU();
|
||||
|
||||
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());
|
||||
|
||||
/* Finds only the largest object. Special mode for need to training*/
|
||||
bool findLargestObject;
|
||||
|
||||
/* Draws rectangles in input image */
|
||||
bool visualizeInPlace;
|
||||
|
||||
Size getClassifierSize() const;
|
||||
};
|
||||
|
||||
|
||||
..
|
||||
|
||||
|
||||
.. index:: cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU
|
||||
|
||||
.. _cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU:
|
||||
|
||||
cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU
|
||||
-----------------------------------------------------
|
||||
|
||||
`id=0.502164537388 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ACascadeClassifier_GPU%3A%3ACascadeClassifier_GPU>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: cv::CascadeClassifier_GPU(const string\& filename)
|
||||
|
||||
Loads the classifier from file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param filename: Name of file from which classifier will be load. Only old haar classifier (trained by haartraining application) and NVidia's nvbin are supported.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::CascadeClassifier_GPU::empty
|
||||
|
||||
.. _cv::gpu::CascadeClassifier_GPU::empty:
|
||||
|
||||
cv::gpu::CascadeClassifier_GPU::empty
|
||||
-------------------------------------
|
||||
|
||||
`id=0.00879679914574 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ACascadeClassifier_GPU%3A%3Aempty>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: bool CascadeClassifier_GPU::empty() const
|
||||
|
||||
Checks if the classifier has been loaded or not.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::CascadeClassifier_GPU::load
|
||||
|
||||
.. _cv::gpu::CascadeClassifier_GPU::load:
|
||||
|
||||
cv::gpu::CascadeClassifier_GPU::load
|
||||
------------------------------------
|
||||
|
||||
`id=0.831994730738 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ACascadeClassifier_GPU%3A%3Aload>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: bool CascadeClassifier_GPU::load(const string\& filename)
|
||||
|
||||
Loads the classifier from file. The previous content is destroyed.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param filename: Name of file from which classifier will be load. Only old haar classifier (trained by haartraining application) and NVidia's nvbin are supported.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::CascadeClassifier_GPU::release
|
||||
|
||||
.. _cv::gpu::CascadeClassifier_GPU::release:
|
||||
|
||||
cv::gpu::CascadeClassifier_GPU::release
|
||||
---------------------------------------
|
||||
|
||||
`id=0.524456582811 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ACascadeClassifier_GPU%3A%3Arelease>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void CascadeClassifier_GPU::release()
|
||||
|
||||
Destroys loaded classifier.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::CascadeClassifier_GPU::detectMultiScale
|
||||
|
||||
.. _cv::gpu::CascadeClassifier_GPU::detectMultiScale:
|
||||
|
||||
cv::gpu::CascadeClassifier_GPU::detectMultiScale
|
||||
------------------------------------------------
|
||||
|
||||
`id=0.0605957110589 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3ACascadeClassifier_GPU%3A%3AdetectMultiScale>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: int CascadeClassifier_GPU::detectMultiScale(const GpuMat\& image, GpuMat\& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size())
|
||||
|
||||
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param image: Matrix of type ``CV_8U`` containing the image in which to detect objects.
|
||||
|
||||
|
||||
:param objects: Buffer to store detected objects (rectangles). If it is empty, it will be allocated with default size. If not empty, function will search not more than N objects, where N = sizeof(objectsBufer's data)/sizeof(cv::Rect).
|
||||
|
||||
|
||||
:param scaleFactor: Specifies how much the image size is reduced at each image scale.
|
||||
|
||||
|
||||
:param minNeighbors: Specifies how many neighbors should each candidate rectangle have to retain it.
|
||||
|
||||
|
||||
:param minSize: The minimum possible object size. Objects smaller than that are ignored.
|
||||
|
||||
|
||||
|
||||
The function returns number of detected objects, so you can retrieve them as in following example:
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
|
||||
cv::gpu::CascadeClassifier_GPU 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);
|
||||
|
509
modules/gpu/doc/operations_on_matrices.rst
Normal file
509
modules/gpu/doc/operations_on_matrices.rst
Normal file
@@ -0,0 +1,509 @@
|
||||
Operations on Matrices
|
||||
======================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::transpose
|
||||
|
||||
|
||||
cv::gpu::transpose
|
||||
------------------
|
||||
|
||||
`id=0.581518039061 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Atranspose>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void transpose(const GpuMat\& src, GpuMat\& dst)
|
||||
|
||||
Transposes a matrix.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source matrix. 1, 4, 8 bytes element sizes are supported for now.
|
||||
|
||||
|
||||
:param dst: Destination matrix.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`transpose`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::flip
|
||||
|
||||
|
||||
cv::gpu::flip
|
||||
-------------
|
||||
|
||||
`id=0.29725445638 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Aflip>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void flip(const GpuMat\& a, GpuMat\& b, int flipCode)
|
||||
|
||||
Flips a 2D matrix around vertical, horizontal or both axes.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: Source matrix. Only ``CV_8UC1`` and ``CV_8UC4`` matrices are supported for now.
|
||||
|
||||
|
||||
:param b: Destination matrix.
|
||||
|
||||
|
||||
:param flipCode: Specifies how to flip the source:
|
||||
|
||||
|
||||
|
||||
* **0** Flip around x-axis.
|
||||
|
||||
|
||||
* **:math:`>`0** Flip around y-axis.
|
||||
|
||||
|
||||
* **:math:`<`0** Flip around both axes.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`flip`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::LUT
|
||||
|
||||
|
||||
cv::gpu::LUT
|
||||
------------
|
||||
|
||||
`id=0.279602538414 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ALUT>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
dst(I) = lut(src(I))
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void LUT(const GpuMat\& src, const Mat\& lut, GpuMat\& dst)
|
||||
|
||||
Transforms the source matrix into the destination matrix using given look-up table:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source matrix. ``CV_8UC1`` and ``CV_8UC3`` matrixes are supported for now.
|
||||
|
||||
|
||||
:param lut: Look-up table. Must be continuous, ``CV_8U`` depth matrix. Its area must satisfy to ``lut.rows`` :math:`\times` ``lut.cols`` = 256 condition.
|
||||
|
||||
|
||||
:param dst: Destination matrix. Will have the same depth as ``lut`` and the same number of channels as ``src`` .
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`LUT`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::merge
|
||||
|
||||
|
||||
cv::gpu::merge
|
||||
--------------
|
||||
|
||||
`id=0.568969773318 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Amerge>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void merge(const GpuMat* src, size_t n, GpuMat\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void merge(const GpuMat* src, size_t n, GpuMat\& dst,
|
||||
const Stream\& stream)
|
||||
|
||||
Makes a multi-channel matrix out of several single-channel matrices.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Pointer to array of the source matrices.
|
||||
|
||||
|
||||
:param n: Number of source matrices.
|
||||
|
||||
|
||||
:param dst: Destination matrix.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void merge(const vector$<$GpuMat$>$\& src, GpuMat\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void merge(const vector$<$GpuMat$>$\& src, GpuMat\& dst,
|
||||
const Stream\& stream)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **src** Vector of the source matrices.
|
||||
|
||||
|
||||
* **dst** Destination matrix.
|
||||
|
||||
|
||||
* **stream** Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`merge`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::split
|
||||
|
||||
|
||||
cv::gpu::split
|
||||
--------------
|
||||
|
||||
`id=0.117653518739 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Asplit>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void split(const GpuMat\& src, GpuMat* dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void split(const GpuMat\& src, GpuMat* dst, const Stream\& stream)
|
||||
|
||||
Copies each plane of a multi-channel matrix into an array.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source matrix.
|
||||
|
||||
|
||||
:param dst: Pointer to array of single-channel matrices.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void split(const GpuMat\& src, vector$<$GpuMat$>$\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void split(const GpuMat\& src, vector$<$GpuMat$>$\& dst,
|
||||
const Stream\& stream)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **src** Source matrix.
|
||||
|
||||
|
||||
* **dst** Destination vector of single-channel matrices.
|
||||
|
||||
|
||||
* **stream** Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`split`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::magnitude
|
||||
|
||||
|
||||
cv::gpu::magnitude
|
||||
------------------
|
||||
|
||||
`id=0.0879492693083 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Amagnitude>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void magnitude(const GpuMat\& x, GpuMat\& magnitude)
|
||||
|
||||
Computes magnitudes of complex matrix elements.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param x: Source complex matrix in the interleaved format ( ``CV_32FC2`` ).
|
||||
|
||||
|
||||
:param magnitude: Destination matrix of float magnitudes ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void magnitude(const GpuMat\& x, const GpuMat\& y, GpuMat\& magnitude)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void magnitude(const GpuMat\& x, const GpuMat\& y, GpuMat\& magnitude,
|
||||
const Stream\& stream)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **x** Source matrix, containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
* **y** Source matrix, containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
* **magnitude** Destination matrix of float magnitudes ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
* **stream** Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`magnitude`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::magnitudeSqr
|
||||
|
||||
|
||||
cv::gpu::magnitudeSqr
|
||||
---------------------
|
||||
|
||||
`id=0.0350196817871 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AmagnitudeSqr>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void magnitudeSqr(const GpuMat\& x, GpuMat\& magnitude)
|
||||
|
||||
Computes squared magnitudes of complex matrix elements.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param x: Source complex matrix in the interleaved format ( ``CV_32FC2`` ).
|
||||
|
||||
|
||||
:param magnitude: Destination matrix of float magnitude squares ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void magnitudeSqr(const GpuMat\& x, const GpuMat\& y, GpuMat\& magnitude)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void magnitudeSqr(const GpuMat\& x, const GpuMat\& y, GpuMat\& magnitude,
|
||||
const Stream\& stream)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **x** Source matrix, containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
* **y** Source matrix, containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
* **magnitude** Destination matrix of float magnitude squares ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
* **stream** Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::phase
|
||||
|
||||
|
||||
cv::gpu::phase
|
||||
--------------
|
||||
|
||||
`id=0.274224468378 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Aphase>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void phase(const GpuMat\& x, const GpuMat\& y, GpuMat\& angle,
|
||||
bool angleInDegrees=false)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void phase(const GpuMat\& x, const GpuMat\& y, GpuMat\& angle,
|
||||
bool angleInDegrees, const Stream\& stream)
|
||||
|
||||
Computes polar angles of complex matrix elements.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param x: Source matrix, containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param y: Source matrix, containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param angle: Destionation matrix of angles ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param angleInDegress: Flag which indicates angles must be evaluated in degress.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`phase`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::cartToPolar
|
||||
|
||||
|
||||
cv::gpu::cartToPolar
|
||||
--------------------
|
||||
|
||||
`id=0.813292348151 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3AcartToPolar>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void cartToPolar(const GpuMat\& x, const GpuMat\& y, GpuMat\& magnitude,
|
||||
GpuMat\& angle, bool angleInDegrees=false)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void cartToPolar(const GpuMat\& x, const GpuMat\& y, GpuMat\& magnitude,
|
||||
GpuMat\& angle, bool angleInDegrees, const Stream\& stream)
|
||||
|
||||
Converts Cartesian coordinates into polar.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param x: Source matrix, containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param y: Source matrix, containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param magnitude: Destination matrix of float magnituds ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param angle: Destionation matrix of angles ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param angleInDegress: Flag which indicates angles must be evaluated in degress.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`cartToPolar`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::polarToCart
|
||||
|
||||
|
||||
cv::gpu::polarToCart
|
||||
--------------------
|
||||
|
||||
`id=0.108746506092 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3ApolarToCart>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void polarToCart(const GpuMat\& magnitude, const GpuMat\& angle,
|
||||
GpuMat\& x, GpuMat\& y, bool angleInDegrees=false)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void polarToCart(const GpuMat\& magnitude, const GpuMat\& angle,
|
||||
GpuMat\& x, GpuMat\& y, bool angleInDegrees,
|
||||
const Stream\& stream)
|
||||
|
||||
Converts polar coordinates into Cartesian.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param magnitude: Source matrix, containing magnitudes ( ``CV_32FC1`` ).
|
||||
|
||||
|
||||
:param angle: Source matrix, containing angles ( ``CV_32FC1`` ).
|
||||
|
721
modules/gpu/doc/per_element_operations..rst
Normal file
721
modules/gpu/doc/per_element_operations..rst
Normal file
@@ -0,0 +1,721 @@
|
||||
Per-element Operations.
|
||||
=======================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::add
|
||||
|
||||
|
||||
cv::gpu::add
|
||||
------------
|
||||
|
||||
`id=0.387694196113 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Aadd>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void add(const GpuMat\& a, const GpuMat\& b, GpuMat\& c)
|
||||
|
||||
Computes matrix-matrix or matrix-scalar sum.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now.
|
||||
|
||||
|
||||
:param b: Second source matrix. Must have the same size and type as ``a`` .
|
||||
|
||||
|
||||
:param c: Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void add(const GpuMat\& a, const Scalar\& sc, GpuMat\& c)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
|
||||
|
||||
|
||||
* **b** Source scalar to be added to the source matrix.
|
||||
|
||||
|
||||
* **c** Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`add`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::subtract
|
||||
|
||||
|
||||
cv::gpu::subtract
|
||||
-----------------
|
||||
|
||||
`id=0.316386979537 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Asubtract>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void subtract(const GpuMat\& a, const GpuMat\& b, GpuMat\& c)
|
||||
|
||||
Subtracts matrix from another matrix (or scalar from matrix).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now.
|
||||
|
||||
|
||||
:param b: Second source matrix. Must have the same size and type as ``a`` .
|
||||
|
||||
|
||||
:param c: Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void subtract(const GpuMat\& a, const Scalar\& sc, GpuMat\& c)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
|
||||
|
||||
|
||||
* **b** Scalar to be subtracted from the source matrix elements.
|
||||
|
||||
|
||||
* **c** Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`subtract`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::multiply
|
||||
|
||||
|
||||
cv::gpu::multiply
|
||||
-----------------
|
||||
|
||||
`id=0.12843407457 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Amultiply>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void multiply(const GpuMat\& a, const GpuMat\& b, GpuMat\& c)
|
||||
|
||||
Computes per-element product of two matrices (or of matrix and scalar).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now.
|
||||
|
||||
|
||||
:param b: Second source matrix. Must have the same size and type as ``a`` .
|
||||
|
||||
|
||||
:param c: Destionation matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void multiply(const GpuMat\& a, const Scalar\& sc, GpuMat\& c)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
|
||||
|
||||
|
||||
* **b** Scalar to be multiplied by.
|
||||
|
||||
|
||||
* **c** Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`multiply`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::divide
|
||||
|
||||
|
||||
cv::gpu::divide
|
||||
---------------
|
||||
|
||||
`id=0.178699823123 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Adivide>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void divide(const GpuMat\& a, const GpuMat\& b, GpuMat\& c)
|
||||
|
||||
Performs per-element division of two matrices (or division of matrix by scalar).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now.
|
||||
|
||||
|
||||
:param b: Second source matrix. Must have the same size and type as ``a`` .
|
||||
|
||||
|
||||
:param c: Destionation matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void divide(const GpuMat\& a, const Scalar\& sc, GpuMat\& c)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **a** Source matrix. ``CV_32FC1`` and ``CV_32FC2`` matrixes are supported for now.
|
||||
|
||||
|
||||
* **b** Scalar to be divided by.
|
||||
|
||||
|
||||
* **c** Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
This function in contrast to
|
||||
:func:`divide`
|
||||
uses round-down rounding mode.
|
||||
|
||||
See also:
|
||||
:func:`divide`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::exp
|
||||
|
||||
|
||||
cv::gpu::exp
|
||||
------------
|
||||
|
||||
`id=0.0437158645609 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Aexp>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void exp(const GpuMat\& a, GpuMat\& b)
|
||||
|
||||
Computes exponent of each matrix element.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: Source matrix. ``CV_32FC1`` matrixes are supported for now.
|
||||
|
||||
|
||||
:param b: Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`exp`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::log
|
||||
|
||||
|
||||
cv::gpu::log
|
||||
------------
|
||||
|
||||
`id=0.726514219732 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Alog>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void log(const GpuMat\& a, GpuMat\& b)
|
||||
|
||||
Computes natural logarithm of absolute value of each matrix element.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: Source matrix. ``CV_32FC1`` matrixes are supported for now.
|
||||
|
||||
|
||||
:param b: Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`log`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::absdiff
|
||||
|
||||
|
||||
cv::gpu::absdiff
|
||||
----------------
|
||||
|
||||
`id=0.0449517502969 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Aabsdiff>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void absdiff(const GpuMat\& a, const GpuMat\& b, GpuMat\& c)
|
||||
|
||||
Computes per-element absolute difference of two matrices (or of matrix and scalar).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now.
|
||||
|
||||
|
||||
:param b: Second source matrix. Must have the same size and type as ``a`` .
|
||||
|
||||
|
||||
:param c: Destionation matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void absdiff(const GpuMat\& a, const Scalar\& s, GpuMat\& c)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **a** Source matrix. ``CV_32FC1`` matrixes are supported for now.
|
||||
|
||||
|
||||
* **b** Scalar to be subtracted from the source matrix elements.
|
||||
|
||||
|
||||
* **c** Destination matrix. Will have the same size and type as ``a`` .
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`absdiff`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::compare
|
||||
|
||||
|
||||
cv::gpu::compare
|
||||
----------------
|
||||
|
||||
`id=0.346307736999 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Acompare>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void compare(const GpuMat\& a, const GpuMat\& b, GpuMat\& c, int cmpop)
|
||||
|
||||
Compares elements of two matrices.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param a: First source matrix. ``CV_8UC4`` and ``CV_32FC1`` matrices are supported for now.
|
||||
|
||||
|
||||
:param b: Second source matrix. Must have the same size and type as ``a`` .
|
||||
|
||||
|
||||
:param c: Destination matrix. Will have the same size as ``a`` and be ``CV_8UC1`` type.
|
||||
|
||||
|
||||
:param cmpop: Flag specifying the relation between the elements to be checked:
|
||||
|
||||
|
||||
|
||||
* **CMP_EQ** :math:`=`
|
||||
|
||||
|
||||
* **CMP_GT** :math:`>`
|
||||
|
||||
|
||||
* **CMP_GE** :math:`\ge`
|
||||
|
||||
|
||||
* **CMP_LT** :math:`<`
|
||||
|
||||
|
||||
* **CMP_LE** :math:`\le`
|
||||
|
||||
|
||||
* **CMP_NE** :math:`\ne`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`compare`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::bitwise_not
|
||||
|
||||
.. _cv::gpu::bitwise_not:
|
||||
|
||||
cv::gpu::bitwise_not
|
||||
--------------------
|
||||
|
||||
`id=0.242780097451 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3Abitwise_not>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_not(const GpuMat\& src, GpuMat\& dst,
|
||||
const GpuMat\& mask=GpuMat())
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_not(const GpuMat\& src, GpuMat\& dst,
|
||||
const GpuMat\& mask, const Stream\& stream)
|
||||
|
||||
Performs per-element bitwise inversion.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src: Source matrix.
|
||||
|
||||
|
||||
:param dst: Destination matrix. Will have the same size and type as ``src`` .
|
||||
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::bitwise_or
|
||||
|
||||
.. _cv::gpu::bitwise_or:
|
||||
|
||||
cv::gpu::bitwise_or
|
||||
-------------------
|
||||
|
||||
`id=0.762303417062 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3Abitwise_or>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_or(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const GpuMat\& mask=GpuMat())
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_or(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const GpuMat\& mask, const Stream\& stream)
|
||||
|
||||
Performs per-element bitwise disjunction of two matrices.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
|
||||
:param src2: Second source matrix. It must have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param dst: Destination matrix. Will have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::bitwise_and
|
||||
|
||||
.. _cv::gpu::bitwise_and:
|
||||
|
||||
cv::gpu::bitwise_and
|
||||
--------------------
|
||||
|
||||
`id=0.621591376205 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3Abitwise_and>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_and(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const GpuMat\& mask=GpuMat())
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_and(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const GpuMat\& mask, const Stream\& stream)
|
||||
|
||||
Performs per-element bitwise conjunction of two matrices.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
|
||||
:param src2: Second source matrix. It must have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param dst: Destination matrix. Will have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: cv::gpu::bitwise_xor
|
||||
|
||||
.. _cv::gpu::bitwise_xor:
|
||||
|
||||
cv::gpu::bitwise_xor
|
||||
--------------------
|
||||
|
||||
`id=0.684217951074 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/cv%3A%3Agpu%3A%3Abitwise_xor>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_xor(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const GpuMat\& mask=GpuMat())
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void bitwise_xor(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const GpuMat\& mask, const Stream\& stream)
|
||||
|
||||
Performs per-element bitwise "exclusive or" of two matrices.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
|
||||
:param src2: Second source matrix. It must have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param dst: Destination matrix. Will have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::min
|
||||
|
||||
|
||||
cv::gpu::min
|
||||
------------
|
||||
|
||||
`id=0.276176266158 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Amin>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void min(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void min(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const Stream\& stream)
|
||||
|
||||
Computes per-element minimum of two matrices (or of matrix and scalar).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
|
||||
:param src2: Second source matrix.
|
||||
|
||||
|
||||
:param dst: Destination matrix. Will have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void min(const GpuMat\& src1, double src2, GpuMat\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void min(const GpuMat\& src1, double src2, GpuMat\& dst,
|
||||
const Stream\& stream)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* **src1** Source matrix.
|
||||
|
||||
|
||||
* **src2** Scalar to be compared with.
|
||||
|
||||
|
||||
* **dst** Destination matrix. Will have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
* **stream** Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
See also:
|
||||
:func:`min`
|
||||
.
|
||||
|
||||
|
||||
|
||||
.. index:: gpu::max
|
||||
|
||||
|
||||
cv::gpu::max
|
||||
------------
|
||||
|
||||
`id=0.175554622377 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/cpp/gpu/gpu%3A%3Amax>`__
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void max(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void max(const GpuMat\& src1, const GpuMat\& src2, GpuMat\& dst,
|
||||
const Stream\& stream)
|
||||
|
||||
Computes per-element maximum of two matrices (or of matrix and scalar).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
|
||||
:param src2: Second source matrix.
|
||||
|
||||
|
||||
:param dst: Destination matrix. Will have the same size and type as ``src1`` .
|
||||
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void max(const GpuMat\& src1, double src2, GpuMat\& dst)
|
||||
|
||||
|
||||
|
||||
.. cfunction:: void max(const GpuMat\& src1, double src2, GpuMat\& dst,
|
||||
const Stream\& stream)
|
||||
|
Reference in New Issue
Block a user