Commit 8d8ef596 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

introduced new RST/Sphinx domain ocv.

parent 4f3fb040
......@@ -16,7 +16,7 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
......@@ -25,7 +25,7 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks']
extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'ocv']
doctest_test_doctest_blocks = 'block'
# Add any paths that contain templates here, relative to this directory.
......
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,7 @@ Clustering
kmeans
------
.. cpp:function:: double kmeans( InputArray samples, int clusterCount, InputOutputArray labels, TermCriteria termcrit, int attempts, int flags, OutputArray centers=noArray() )
.. ocv:function:: double kmeans( InputArray samples, int clusterCount, InputOutputArray labels, TermCriteria termcrit, int attempts, int flags, OutputArray centers=noArray() )
Finds centers of clusters and groups input samples around the clusters.
......@@ -57,9 +57,9 @@ attempts to 1, initialize labels each time using a custom algorithm, pass them w
partition
-------------
.. cpp:function:: template<typename _Tp, class _EqPredicate> int
.. ocv:function:: template<typename _Tp, class _EqPredicate> int
.. cpp:function:: partition( const vector<_Tp>& vec, vector<int>& labels, _EqPredicate predicate=_EqPredicate())
.. ocv:function:: partition( const vector<_Tp>& vec, vector<int>& labels, _EqPredicate predicate=_EqPredicate())
Splits an element set into equivalency classes.
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,7 +7,7 @@ Utility and System Functions and Macros
alignPtr
------------
.. cpp:function:: template<typename _Tp> _Tp* alignPtr(_Tp* ptr, int n=sizeof(_Tp))
.. ocv:function:: template<typename _Tp> _Tp* alignPtr(_Tp* ptr, int n=sizeof(_Tp))
Aligns a pointer to the specified number of bytes.
......@@ -25,7 +25,7 @@ The function returns the aligned pointer of the same type as the input pointer:
alignSize
-------------
.. cpp:function:: size_t alignSize(size_t sz, int n)
.. ocv:function:: size_t alignSize(size_t sz, int n)
Aligns a buffer size to the specified number of bytes.
......@@ -43,7 +43,7 @@ The function returns the minimum number that is greater or equal to ``sz`` and i
allocate
------------
.. cpp:function:: template<typename _Tp> _Tp* allocate(size_t n)
.. ocv:function:: template<typename _Tp> _Tp* allocate(size_t n)
Allocates an array of elements.
......@@ -55,7 +55,7 @@ The generic function ``allocate`` allocates a buffer for the specified number of
deallocate
--------------
.. cpp:function:: template<typename _Tp> void deallocate(_Tp* ptr, size_t n)
.. ocv:function:: template<typename _Tp> void deallocate(_Tp* ptr, size_t n)
Deallocates an array of elements.
......@@ -64,8 +64,8 @@ deallocate
:param n: Number of elements in the buffer.
The generic function ``deallocate`` deallocates the buffer allocated with
:cpp:func:`allocate` . The number of elements must match the number passed to
:cpp:func:`allocate` .
:ocv:func:`allocate` . The number of elements must match the number passed to
:ocv:func:`allocate` .
.. index:: CV_Assert
......@@ -73,7 +73,7 @@ The generic function ``deallocate`` deallocates the buffer allocated with
CV_Assert
---------
.. cpp:function:: CV_Assert(expr)
.. ocv:function:: CV_Assert(expr)
Checks a condition at runtime. ::
......@@ -84,17 +84,17 @@ CV_Assert
:param expr: Expression to check.
The macros ``CV_Assert`` and ``CV_DbgAssert`` evaluate the specified expression. If it is 0, the macros raise an error (see
:cpp:func:`error` ). The macro ``CV_Assert`` checks the condition in both Debug and Release configurations, while ``CV_DbgAssert`` is only retained in the Debug configuration.
:ocv:func:`error` ). The macro ``CV_Assert`` checks the condition in both Debug and Release configurations, while ``CV_DbgAssert`` is only retained in the Debug configuration.
.. index:: error
error
---------
.. cpp:function:: void error( const Exception& exc )
.. ocv:function:: void error( const Exception& exc )
.. cpp:function:: #define CV_Error( code, msg ) <...>
.. ocv:function:: #define CV_Error( code, msg ) <...>
.. cpp:function:: #define CV_Error_( code, args ) <...>
.. ocv:function:: #define CV_Error_( code, args ) <...>
Signals an error and raises an exception.
......@@ -148,13 +148,13 @@ Exception class passed to error ::
};
The class ``Exception`` encapsulates all or almost all the necessary information about the error happened in the program. The exception is usually constructed and thrown implicitly via ``CV_Error`` and ``CV_Error_`` macros. See
:cpp:func:`error` .
:ocv:func:`error` .
.. index:: fastMalloc
fastMalloc
--------------
.. cpp:function:: void* fastMalloc(size_t size)
.. ocv:function:: void* fastMalloc(size_t size)
Allocates an aligned memory buffer.
......@@ -166,74 +166,74 @@ The function allocates the buffer of the specified size and returns it. When the
fastFree
------------
.. cpp:function:: void fastFree(void* ptr)
.. ocv:function:: void fastFree(void* ptr)
Deallocates a memory buffer.
:param ptr: Pointer to the allocated buffer.
The function deallocates the buffer allocated with
:cpp:func:`fastMalloc` .
:ocv:func:`fastMalloc` .
If NULL pointer is passed, the function does nothing.
.. index:: format
format
----------
.. cpp:function:: string format( const char* fmt, ... )
.. ocv:function:: string format( const char* fmt, ... )
Returns a text string formatted using the ``printf`` -like expression.
:param fmt: ``printf`` -compatible formatting specifiers.
The function acts like ``sprintf`` but forms and returns an STL string. It can be used to form an error message in the
:cpp:func:`Exception` constructor.
:ocv:func:`Exception` constructor.
.. index:: getNumThreads
getNumThreads
-----------------
.. cpp:function:: int getNumThreads()
.. ocv:function:: int getNumThreads()
Returns the number of threads used by OpenCV.
The function returns the number of threads that is used by OpenCV.
See Also:
:cpp:func:`setNumThreads`,
:cpp:func:`getThreadNum`
:ocv:func:`setNumThreads`,
:ocv:func:`getThreadNum`
.. index:: getThreadNum
getThreadNum
----------------
.. cpp:function:: int getThreadNum()
.. ocv:function:: int getThreadNum()
Returns the index of the currently executed thread.
The function returns a 0-based index of the currently executed thread. The function is only valid inside a parallel OpenMP region. When OpenCV is built without OpenMP support, the function always returns 0.
See Also:
:cpp:func:`setNumThreads`,
:cpp:func:`getNumThreads` .
:ocv:func:`setNumThreads`,
:ocv:func:`getNumThreads` .
.. index:: getTickCount
getTickCount
----------------
.. cpp:function:: int64 getTickCount()
.. ocv:function:: int64 getTickCount()
Returns the number of ticks.
The function returns the number of ticks after the certain event (for example, when the machine was turned on).
It can be used to initialize
:cpp:func:`RNG` or to measure a function execution time by reading the tick count before and after the function call. See also the tick frequency.
:ocv:func:`RNG` or to measure a function execution time by reading the tick count before and after the function call. See also the tick frequency.
.. index:: getTickFrequency
getTickFrequency
--------------------
.. cpp:function:: double getTickFrequency()
.. ocv:function:: double getTickFrequency()
Returns the number of ticks per second.
......@@ -248,7 +248,7 @@ That is, the following code computes the execution time in seconds: ::
getCPUTickCount
----------------
.. cpp:function:: int64 getCPUTickCount()
.. ocv:function:: int64 getCPUTickCount()
Returns the number of CPU ticks.
......@@ -258,7 +258,7 @@ The function returns the current number of CPU ticks on some architectures (such
setNumThreads
-----------------
.. cpp:function:: void setNumThreads(int nthreads)
.. ocv:function:: void setNumThreads(int nthreads)
Sets the number of threads used by OpenCV.
......@@ -267,14 +267,14 @@ setNumThreads
The function sets the number of threads used by OpenCV in parallel OpenMP regions. If ``nthreads=0`` , the function uses the default number of threads that is usually equal to the number of the processing cores.
See Also:
:cpp:func:`getNumThreads`,
:cpp:func:`getThreadNum`
:ocv:func:`getNumThreads`,
:ocv:func:`getThreadNum`
.. index:: setUseOptimized
setUseOptimized
-----------------
.. cpp:function:: void setUseOptimized(bool onoff)
.. ocv:function:: void setUseOptimized(bool onoff)
Enables or disables the optimized code.
......@@ -288,7 +288,7 @@ By default, the optimized code is enabled (unless you disable it in CMake). The
useOptimized
-----------------
.. cpp:function:: bool useOptimized()
.. ocv:function:: bool useOptimized()
Returns status of the optimized code use
......
......@@ -13,7 +13,7 @@ descriptor extractors inherit the
DescriptorExtractor
-------------------
.. cpp:class:: DescriptorExtractor
.. ocv:class:: DescriptorExtractor
Abstract base class for computing descriptors for image keypoints ::
......@@ -51,7 +51,7 @@ descriptors is represented as
DescriptorExtractor::compute
--------------------------------
.. cpp:function:: void DescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const
.. ocv:function:: void DescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const
Computes the descriptors for a set of keypoints detected in an image (first variant) or image set (second variant).
......@@ -61,7 +61,7 @@ DescriptorExtractor::compute
:param descriptors: Descriptors. Row i is the descriptor for keypoint i.
.. cpp:function:: void DescriptorExtractor::compute( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints, vector<Mat>& descriptors ) const
.. ocv:function:: void DescriptorExtractor::compute( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints, vector<Mat>& descriptors ) const
:param images: Image set.
......@@ -75,7 +75,7 @@ DescriptorExtractor::compute
DescriptorExtractor::read
-----------------------------
.. cpp:function:: void DescriptorExtractor::read( const FileNode& fn )
.. ocv:function:: void DescriptorExtractor::read( const FileNode& fn )
Reads the object of a descriptor extractor from a file node.
......@@ -85,7 +85,7 @@ DescriptorExtractor::read
DescriptorExtractor::write
------------------------------
.. cpp:function:: void DescriptorExtractor::write( FileStorage& fs ) const
.. ocv:function:: void DescriptorExtractor::write( FileStorage& fs ) const
Writes the object of a descriptor extractor to a file storage.
......@@ -95,7 +95,7 @@ DescriptorExtractor::write
DescriptorExtractor::create
-------------------------------
.. cpp:function:: Ptr<DescriptorExtractor> DescriptorExtractor::create( const string& descriptorExtractorType )
.. ocv:function:: Ptr<DescriptorExtractor> DescriptorExtractor::create( const string& descriptorExtractorType )
Creates a descriptor extractor by name.
......@@ -118,7 +118,7 @@ for example: ``"OpponentSIFT"`` .
SiftDescriptorExtractor
-----------------------
.. cpp:class:: SiftDescriptorExtractor
.. ocv:class:: SiftDescriptorExtractor
Wrapping class for computing descriptors by using the
:ref:`SIFT` class ::
......@@ -150,7 +150,7 @@ Wrapping class for computing descriptors by using the
SurfDescriptorExtractor
-----------------------
.. cpp:class:: SurfDescriptorExtractor
.. ocv:class:: SurfDescriptorExtractor
Wrapping class for computing descriptors by using the
:ref:`SURF` class ::
......@@ -176,7 +176,7 @@ Wrapping class for computing descriptors by using the
OrbDescriptorExtractor
---------------------------
.. cpp:class:: OrbDescriptorExtractor
.. ocv:class:: OrbDescriptorExtractor
Wrapping class for computing descriptors by using the
:ref:`ORB` class ::
......@@ -200,7 +200,7 @@ Wrapping class for computing descriptors by using the
CalonderDescriptorExtractor
---------------------------
.. cpp:class:: CalonderDescriptorExtractor
.. ocv:class:: CalonderDescriptorExtractor
Wrapping class for computing descriptors by using the
:ref:`RTreeClassifier` class ::
......@@ -226,7 +226,7 @@ Wrapping class for computing descriptors by using the
OpponentColorDescriptorExtractor
--------------------------------
.. cpp:class:: OpponentColorDescriptorExtractor
.. ocv:class:: OpponentColorDescriptorExtractor
Class adapting a descriptor extractor to compute descriptors in the Opponent Color Space
(refer to Van de Sande et al., CGIV 2008 *Color Descriptors for Object Category Recognition*).
......@@ -254,7 +254,7 @@ them into a single color descriptor. ::
BriefDescriptorExtractor
------------------------
.. cpp:class:: BriefDescriptorExtractor
.. ocv:class:: BriefDescriptorExtractor
Class for computing BRIEF descriptors described in a paper of Calonder M., Lepetit V.,
Strecha C., Fua P. *BRIEF: Binary Robust Independent Elementary Features* ,
......
......@@ -15,7 +15,7 @@ descriptor matchers inherit
DMatch
------
.. cpp:class:: DMatch
.. ocv:class:: DMatch
Class for matching keypoint descriptors: query descriptor index,
train descriptor index, train image index, and distance between descriptors ::
......@@ -108,7 +108,7 @@ with an image set. ::
DescriptorMatcher::add
--------------------------
.. cpp:function:: void add( const vector<Mat>& descriptors )
.. ocv:function:: void add( const vector<Mat>& descriptors )
Adds descriptors to train a descriptor collection. If the collection ``trainDescCollectionis`` is not empty, the new descriptors are added to existing train descriptors.
......@@ -118,7 +118,7 @@ DescriptorMatcher::add
DescriptorMatcher::getTrainDescriptors
------------------------------------------
.. cpp:function:: const vector<Mat>& getTrainDescriptors() const
.. ocv:function:: const vector<Mat>& getTrainDescriptors() const
Returns a constant link to the train descriptor collection ``trainDescCollection`` .
......@@ -126,7 +126,7 @@ DescriptorMatcher::getTrainDescriptors
DescriptorMatcher::clear
----------------------------
.. cpp:function:: void DescriptorMatcher::clear()
.. ocv:function:: void DescriptorMatcher::clear()
Clears the train descriptor collection.
......@@ -134,7 +134,7 @@ DescriptorMatcher::clear
DescriptorMatcher::empty
----------------------------
.. cpp:function:: bool DescriptorMatcher::empty() const
.. ocv:function:: bool DescriptorMatcher::empty() const
Returns true if there are no train descriptors in the collection.
......@@ -142,7 +142,7 @@ DescriptorMatcher::empty
DescriptorMatcher::isMaskSupported
--------------------------------------
.. cpp:function:: bool DescriptorMatcher::isMaskSupported()
.. ocv:function:: bool DescriptorMatcher::isMaskSupported()
Returns true if the descriptor matcher supports masking permissible matches.
......@@ -150,7 +150,7 @@ DescriptorMatcher::isMaskSupported
DescriptorMatcher::train
----------------------------
.. cpp:function:: void DescriptorMatcher::train()
.. ocv:function:: void DescriptorMatcher::train()
Trains a descriptor matcher (for example, the flann index). In all methods to match, the method ``train()`` is run every time before matching. Some descriptor matchers (for example, ``BruteForceMatcher``) have an empty implementation of this method. Other matchers really train their inner structures (for example, ``FlannBasedMatcher`` trains ``flann::Index`` ).
......@@ -158,9 +158,9 @@ DescriptorMatcher::train
DescriptorMatcher::match
----------------------------
.. cpp:function:: void DescriptorMatcher::match( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<DMatch>& matches, const Mat& mask=Mat() ) const
.. ocv:function:: void DescriptorMatcher::match( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<DMatch>& matches, const Mat& mask=Mat() ) const
.. cpp:function:: void DescriptorMatcher::match( const Mat& queryDescriptors, vector<DMatch>& matches, const vector<Mat>& masks=vector<Mat>() )
.. ocv:function:: void DescriptorMatcher::match( const Mat& queryDescriptors, vector<DMatch>& matches, const vector<Mat>& masks=vector<Mat>() )
Finds the best match for each descriptor from a query set.
......@@ -180,9 +180,9 @@ In the first variant of this method, the train descriptors are passed as an inpu
DescriptorMatcher::knnMatch
-------------------------------
.. cpp:function:: void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<vector<DMatch> >& matches, int k, const Mat& mask=Mat(), bool compactResult=false ) const
.. ocv:function:: void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<vector<DMatch> >& matches, int k, const Mat& mask=Mat(), bool compactResult=false ) const
.. cpp:function:: void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, int k, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
.. ocv:function:: void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, int k, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
Finds the k best matches for each descriptor from a query set.
......@@ -200,15 +200,15 @@ DescriptorMatcher::knnMatch
:param compactResult: Parameter that is used when the mask (or masks) is not empty. If ``compactResult`` is false, the ``matches`` vector has the same size as ``queryDescriptors`` rows. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors.
These extended variants of :cpp:func:`DescriptorMatcher::match` methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See :cpp:func:`DescriptorMatcher::match` for the details about query and train descriptors.
These extended variants of :ocv:func:`DescriptorMatcher::match` methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See :ocv:func:`DescriptorMatcher::match` for the details about query and train descriptors.
.. index:: DescriptorMatcher::radiusMatch
DescriptorMatcher::radiusMatch
----------------------------------
.. cpp:function:: void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<vector<DMatch> >& matches, float maxDistance, const Mat& mask=Mat(), bool compactResult=false ) const
.. ocv:function:: void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, const Mat& trainDescriptors, vector<vector<DMatch> >& matches, float maxDistance, const Mat& mask=Mat(), bool compactResult=false ) const
.. cpp:function:: void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, float maxDistance, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
.. ocv:function:: void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, float maxDistance, const vector<Mat>& masks=vector<Mat>(), bool compactResult=false )
For each query descriptor, finds the training descriptors not farther than the specified distance.
......@@ -232,7 +232,7 @@ For each query descriptor, the methods find such training descriptors that the d
DescriptorMatcher::clone
----------------------------
.. cpp:function:: Ptr<DescriptorMatcher> DescriptorMatcher::clone( bool emptyTrainData ) const
.. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::clone( bool emptyTrainData ) const
Clones the matcher.
......@@ -242,7 +242,7 @@ DescriptorMatcher::clone
DescriptorMatcher::create
-----------------------------
.. cpp:function:: Ptr<DescriptorMatcher> DescriptorMatcher::create( const string& descriptorMatcherType )
.. ocv:function:: Ptr<DescriptorMatcher> DescriptorMatcher::create( const string& descriptorMatcherType )
Creates a descriptor matcher of a given type with the default parameters (using default constructor).
......@@ -353,7 +353,7 @@ FlannBasedMatcher
-----------------
.. c:type:: FlannBasedMatcher
Flann-based descriptor matcher. This matcher trains :ref:`flann::Index` on a train descriptor collection and calls its nearest search methods to find the best matches. So, this matcher may be faster when matching a large train collection than the brute force matcher. ``FlannBasedMatcher`` does not support masking permissible matches of descriptor sets because :cpp:func:`flann::Index` does not support this. ::
Flann-based descriptor matcher. This matcher trains :ref:`flann::Index` on a train descriptor collection and calls its nearest search methods to find the best matches. So, this matcher may be faster when matching a large train collection than the brute force matcher. ``FlannBasedMatcher`` does not support masking permissible matches of descriptor sets because :ocv:func:`flann::Index` does not support this. ::
class FlannBasedMatcher : public DescriptorMatcher
{
......
......@@ -6,9 +6,9 @@ Drawing Function of Keypoints and Matches
drawMatches
---------------
.. cpp:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<char>& matchesMask=vector<char>(), int flags=DrawMatchesFlags::DEFAULT )
.. ocv:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<char>& matchesMask=vector<char>(), int flags=DrawMatchesFlags::DEFAULT )
.. cpp:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<vector<DMatch> >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<vector<char>>& matchesMask= vector<vector<char> >(), int flags=DrawMatchesFlags::DEFAULT )
.. ocv:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<vector<DMatch> >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<vector<char>>& matchesMask= vector<vector<char> >(), int flags=DrawMatchesFlags::DEFAULT )
Draw the found matches of keypoints from two images
......@@ -63,7 +63,7 @@ This function draws matches of keypoints from two images in the output image. Ma
drawKeypoints
-----------------
.. cpp:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImg, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT )
.. ocv:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImg, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT )
Draws keypoints.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -15,9 +15,9 @@ The GPU module depends on the CUDA Toolkit and NVIDIA Performance Primitives lib
The 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 to handle non-trivial cases or achieve the highest performance. It is helpful to understand the cost of various operations, what the GPU does, what the preferred data formats are, and so on. The GPU module is an effective instrument for quick implementation of GPU-accelerated computer vision algorithms. However, if your algorithm involves many simple operations, then, for the best possible performance, you may still need to write your own kernels to avoid extra write and read operations on the intermediate results.
To enable CUDA support, configure OpenCV using ``CMake`` with ``WITH_CUDA=ON`` . When the flag is set and if CUDA is installed, the full-featured OpenCV GPU module is built. Otherwise, the module is still built, but at runtime all functions from the module throw
:cpp:func:`Exception` with ``CV_GpuNotSupported`` error code, except for
:cpp:func:`gpu::getCudaEnabledDeviceCount()`. The latter function returns zero GPU count in this case. Building OpenCV without CUDA support does not perform device code compilation, so it does not require the CUDA Toolkit installed. Therefore, using the
:cpp:func:`gpu::getCudaEnabledDeviceCount()` function, you can implement a high-level algorithm that will detect GPU presence at runtime and choose an appropriate implementation (CPU or GPU) accordingly.
:ocv:func:`Exception` with ``CV_GpuNotSupported`` error code, except for
:ocv:func:`gpu::getCudaEnabledDeviceCount()`. The latter function returns zero GPU count in this case. Building OpenCV without CUDA support does not perform device code compilation, so it does not require the CUDA Toolkit installed. Therefore, using the
:ocv:func:`gpu::getCudaEnabledDeviceCount()` function, you can implement a high-level algorithm that will detect GPU presence at runtime and choose an appropriate implementation (CPU or GPU) accordingly.
Compilation for Different NVIDIA* Platforms
-------------------------------------------
......@@ -34,12 +34,12 @@ By default, the OpenCV GPU module includes:
PTX code for compute capabilities 1.1 and 1.3 (controlled by ``CUDA_ARCH_PTX`` in ``CMake``)
This means that for devices with CC 1.3 and 2.0 binary images are ready to run. For all newer platforms, the PTX code for 1.3 is JIT'ed to a binary image. For devices with CC 1.1 and 1.2, the PTX for 1.1 is JIT'ed. For devices with CC 1.0, no code is available and the functions throw
:cpp:func:`Exception`. For platforms where JIT compilation is performed first, the run is slow.
:ocv:func:`Exception`. For platforms where JIT compilation is performed first, the run is slow.
On a GPU with CC 1.0, you can still compile the GPU module and most of the functions will run flawlessly. To achieve this, add "1.0" to the list of binaries, for example, ``CUDA_ARCH_BIN="1.0 1.3 2.0"`` . The functions that cannot be run on CC 1.0 GPUs throw an exception.
You can always determine at runtime whether the OpenCV GPU-built binaries (or PTX code) are compatible with your GPU. The function
:cpp:func:`gpu::DeviceInfo::isCompatible` returns the compatibility status (true/false).
:ocv:func:`gpu::DeviceInfo::isCompatible` returns the compatibility status (true/false).
Threading and Multi-threading
------------------------------
......@@ -57,7 +57,7 @@ In the current version, each of the OpenCV GPU algorithms can use only a single
*
If you use only synchronous functions, create several CPU threads (one per each GPU) and from within each thread create a CUDA context for the corresponding GPU using
:cpp:func:`gpu::setDevice()` or Driver API. Each of the threads will use the associated GPU.
:ocv:func:`gpu::setDevice()` or Driver API. Each of the threads will use the associated GPU.
*
If you use asynchronous functions, you can use the Driver API to create several CUDA contexts associated with different GPUs but attached to one CPU thread. 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.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@ User Interface
createTrackbar
------------------
.. cpp:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)
.. ocv:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)
Creates a trackbar and attaches it to the specified window.
......@@ -45,7 +45,7 @@ Clicking the label of each trackbar enables editing the trackbar values manually
getTrackbarPos
------------------
.. cpp:function:: int getTrackbarPos( const string& trackbarname, const string& winname )
.. ocv:function:: int getTrackbarPos( const string& trackbarname, const string& winname )
Returns the trackbar position.
......@@ -67,7 +67,7 @@ Qt-specific details:
imshow
----------
.. cpp:function:: void imshow( const string& winname, InputArray image )
.. ocv:function:: void imshow( const string& winname, InputArray image )
Displays an image in the specified window.
......@@ -92,7 +92,7 @@ The function ``imshow`` displays an image in the specified window. If the window
namedWindow
---------------
.. cpp:function:: void namedWindow( const string& winname, int flags )
.. ocv:function:: void namedWindow( const string& winname, int flags )
Creates a window.
......@@ -132,7 +132,7 @@ Qt-specific details:
setTrackbarPos
------------------
.. cpp:function:: void setTrackbarPos( const string& trackbarname, const string& winname, int pos )
.. ocv:function:: void setTrackbarPos( const string& trackbarname, const string& winname, int pos )
Sets the trackbar position.
......@@ -156,7 +156,7 @@ Qt-specific details:
waitKey
-----------
.. cpp:function:: int waitKey(int delay=0)
.. ocv:function:: int waitKey(int delay=0)
Waits for a pressed key.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment