some more core functions documented + minor fixes and rearrangements
authorVadim Pisarevsky <no@email>
Wed, 8 Jun 2011 21:35:19 +0000 (21:35 +0000)
committerVadim Pisarevsky <no@email>
Wed, 8 Jun 2011 21:35:19 +0000 (21:35 +0000)
doc/check_docs.py
doc/check_docs_whitelist.txt
index.rst
modules/core/doc/basic_structures.rst
modules/core/doc/utility_and_system_functions_and_macros.rst
modules/core/include/opencv2/core/core.hpp
modules/core/src/matop.cpp
modules/core/src/system.cpp
modules/core/test/test_main.cpp

index 065fc5f..5bbecf3 100644 (file)
@@ -17,13 +17,13 @@ opencv_hdr_list = [
 
 opencv_module_list = [
 "core",
-"imgproc",
-"calib3d",
-"features2d",
-"video",
-"objdetect",
-"highgui",
-"ml"
+#"imgproc",
+#"calib3d",
+#"features2d",
+#"video",
+#"objdetect",
+#"highgui",
+#"ml"
 ]
 
 class RSTParser(object):
@@ -91,14 +91,15 @@ class RSTParser(object):
             if balance > 0:
                 continue
             rst_decl = self.parser.parse_func_decl_no_wrap(fdecl)
-
-            hdr_decls = self.fmap.get(rst_decl[0], [])
+            fname = rst_decl[0]
+            hdr_decls = self.fmap.get(fname, [])
             if not hdr_decls:
-                print "Documented function %s (%s) in %s:%d is not in the headers" % (fdecl, rst_decl[0], docname, lineno)
+                print "Documented function %s (%s) in %s:%d is not in the headers" % (fdecl, rst_decl[0].replace(".", "::"), docname, lineno)
                 continue
             decl_idx = 0
             for hd in hdr_decls:
                 if len(hd[3]) != len(rst_decl[3]):
+                    decl_idx += 1
                     continue
                 idx = 0
                 for a in hd[3]:
@@ -109,7 +110,7 @@ class RSTParser(object):
                     break
                 decl_idx += 1
             if decl_idx < len(hdr_decls):
-                self.fmap[rst_decl[0]] = hdr_decls[:decl_idx] + hdr_decls[decl_idx+1:]
+                self.fmap[fname] = hdr_decls[:decl_idx] + hdr_decls[decl_idx+1:]
                 continue
             print "Documented function %s in %s:%d does not have a match" % (fdecl, docname, lineno)
         df.close()
@@ -128,10 +129,10 @@ class RSTParser(object):
                 
         for d in decls:
             fname = d[0]
-            if not fname.startswith("struct") and not fname.startswith("class") and not fname.startswith("const"):
+            if not fname.startswith("struct") and not fname.startswith("class") and not fname.startswith("const"):                
                 dlist = self.fmap.get(fname, [])
                 dlist.append(d)
-                self.fmap[fname] = dlist 
+                self.fmap[fname] = dlist
     
         self.missing_docfunc_list = []
     
index 52764dd..9ddf9c3 100644 (file)
@@ -16,6 +16,8 @@
 
 cv::Mat::MSize
 cv::Mat::MStep
+cv::MatConstIterator
+cv::NAryMatIterator
 cv::Algorithm
 cv::_InputArray
 cv::_OutputArray
index bdcbf92..5b62aa3 100644 (file)
--- a/index.rst
+++ b/index.rst
@@ -10,10 +10,10 @@ Welcome to opencv documentation!
    :maxdepth: 2
 
    modules/refman.rst
-   _doc/opencv1/c/c_index.rst
-   _doc/opencv1/py/py_index.rst
-   _doc/user_guide/user_guide.rst
-   _doc/tutorials/tutorials.rst
+   doc/opencv1/c/c_index.rst
+   doc/opencv1/py/py_index.rst
+   doc/user_guide/user_guide.rst
+   doc/tutorials/tutorials.rst
 
 Indices and tables
 ==================
index 9439f49..4350615 100644 (file)
@@ -1245,8 +1245,8 @@ The method creates a full copy of the array. The original ``step[]`` are not tak
 
 Mat::copyTo
 ---------------
-.. cpp:function:: void Mat::copyTo( Mat& m ) const
-.. cpp:function:: void Mat::copyTo( Mat& m, const Mat& mask ) const
+.. cpp:function:: void Mat::copyTo( OutputArray m ) const
+.. cpp:function:: void Mat::copyTo( OutputArray m, InputArray mask ) const
 
     Copies the matrix to another one.
 
@@ -1267,7 +1267,7 @@ When the operation mask is specified, and the ``Mat::create`` call shown above r
 
 Mat::convertTo
 ------------------
-.. cpp:function:: void Mat::convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const
+.. cpp:function:: void Mat::convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const
 
     Converts an array to another datatype with optional scaling.
 
@@ -1304,7 +1304,7 @@ This is an internally used method called by the
 
 Mat::setTo
 --------------
-.. cpp:function:: Mat& Mat::setTo(const Scalar& s, const Mat& mask=Mat())
+.. cpp:function:: Mat& Mat::setTo(const Scalar& s, InputArray mask=noArray())
 
     Sets all or some of the array elements to the specified value.
 
@@ -1381,13 +1381,11 @@ The method performs matrix inversion by means of matrix expressions. This means
 
 Mat::mul
 ------------
-.. cpp:function:: MatExpr Mat::mul(const Mat& m, double scale=1) const
-
-.. cpp:function:: MatExpr Mat::mul(const MatExpr& m, double scale=1) const
+.. cpp:function:: MatExpr Mat::mul(InputArray m, double scale=1) const
 
     Performs an element-wise multiplication or division of the two matrices.
 
-    :param m: Another matrix of the same type and the same size as  ``*this`` , or a matrix expression.
+    :param m: Another array of the same type and the same size as ``*this``, or a matrix expression.
 
     :param scale: Optional scale factor.
 
@@ -1402,7 +1400,7 @@ Here is an example: ::
 
 Mat::cross
 --------------
-.. cpp:function:: Mat Mat::cross(const Mat& m) const
+.. cpp:function:: Mat Mat::cross(InputArray m) const
 
     Computes a cross-product of two 3-element vectors.
 
@@ -1414,7 +1412,7 @@ The method computes a cross-product of two 3-element vectors. The vectors must b
 
 Mat::dot
 ------------
-.. cpp:function:: double Mat::dot(const Mat& m) const
+.. cpp:function:: double Mat::dot(InputArray m) const
 
     Computes a dot-product of two vectors.
 
@@ -1594,20 +1592,35 @@ This method can be called manually to force the matrix data deallocation. But si
 
 Mat::resize
 ---------------
-.. cpp:function:: void Mat::resize( size_t sz ) const
+.. cpp:function:: void Mat::resize( size_t sz )
+.. cpp:function:: void Mat::resize( size_t sz, const Scalar& s )
 
     Changes the number of matrix rows.
 
     :param sz: The new number of rows.
+    :param s: The value assigned to the newly added elements
+
+The methods change the number of matrix rows. If the matrix is reallocated, the first ``min(Mat::rows, sz)`` rows are preserved. The methods emulates the corresponding methods of the STL vector class.
+
+
+.. index:: Mat::reserve
+
+Mat::reserve
+---------------
+.. cpp:function:: void Mat::reserve( size_t sz )
+
+    Reserves space for the certain number of rows
+
+    :param sz: The number of rows
 
-The method changes the number of matrix rows. If the matrix is reallocated, the first ``min(Mat::rows, sz)`` rows are preserved. The method emulates the corresponding method of the STL vector class.
+The methods reserves space for ``sz`` rows. If matrix already has space enough to store ``sz`` rows, nothing happens. If the matrix is reallocated, the first ``Mat::rows`` rows are preserved. The methods emulates the corresponding method of the STL vector class.
 
 .. index:: Mat::push_back
 
 Mat::push_back
 --------------
 .. cpp:function:: template<typename T> void Mat::push_back(const T& elem)
-.. cpp:function:: template<typename T> void Mat::push_back(const Mat_<T>& elem)
+.. cpp:function:: void Mat::push_back(const Mat& elem)
 
     Adds elements to the bottom of the matrix.
 
index a5a76ab..add5bd6 100644 (file)
@@ -90,11 +90,11 @@ The macros ``CV_Assert`` and ``CV_DbgAssert`` evaluate the specified expression.
 
 error
 ---------
-.. cpp:function:: void error( const Exception\& exc )
+.. cpp:function:: void error( const Exception& exc )
 
-.. cpp:function:: \#define CV_Error( code, msg ) <...>
+.. cpp:function:: #define CV_Error( code, msg ) <...>
 
-.. cpp:function:: \#define CV_Error_( code, args ) <...>
+.. cpp:function:: #define CV_Error_( code, args ) <...>
 
     Signals an error and raises an exception.
 
@@ -244,6 +244,16 @@ That is, the following code computes the execution time in seconds: ::
     // do something ...
     t = ((double)getTickCount() - t)/getTickFrequency();
 
+.. index:: getCPUTickCount
+
+getCPUTickCount
+----------------
+.. cpp:function:: int64 getCPUTickCount()
+
+    Returns the number of CPU ticks.
+
+The function returns the current number of CPU ticks on some architectures (such as x86, x64, PowerPC). On other platforms the function is equivalent to ``getTickCount``. It can also be used for very accurate time measurements, as well as for RNG initialization. Note that in the case of multi-CPU systems a thread, from which ``getCPUTickCount`` is called, can be suspended and resumed at another CPU with its own counter, so in theory (and practice too) the subsequent calls to the function do not necessary return the monotonously increasing values. Also, since modern CPU vary the CPU frequency depending on the load, the number of CPU clocks spent in some code can not be directly converted to time units. Therefore, ``getTickCount`` is generally a preferable solution for measuring execution time.
+
 .. index:: setNumThreads
 
 setNumThreads
@@ -258,4 +268,28 @@ The function sets the number of threads used by OpenCV in parallel OpenMP region
 
 See Also:
 :cpp:func:`getNumThreads`,
-:cpp:func:`getThreadNum` 
\ No newline at end of file
+:cpp:func:`getThreadNum` 
+
+.. index:: setUseOptimized
+
+setUseOptimized
+-----------------
+.. cpp:function:: void setUseOptimized(bool onoff)
+
+    Enables or disables the optimized code.
+
+    :param onoff: The boolean flag, specifying whether the optimized code should be used (``onoff=true``) or not (``onoff=false``).
+
+The function can be used to dynamically turn on and off optimized code (i.e. code that uses SSE2, AVX etc. instructions on the platforms that support it). It sets some global flag, which is further checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only safe to call the function on the very top level in your application, where you can be pretty much sure that no other OpenCV function is currently executed.
+
+By default, the optimized code is enabled (unless you disable it in CMake). The current status can be retrieved using ``useOptimized``.
+
+.. index:: useOptimized
+
+useOptimized
+-----------------
+.. cpp:function:: bool useOptimized()
+
+    Returns status if the optimized code use
+
+The function returns true if the optimized code is enabled, false otherwise.
index 73e11ee..35ec8bc 100644 (file)
@@ -125,29 +125,19 @@ public:
     /*!
      Default constructor
      */
-    Exception() { code = 0; line = 0; }
+    Exception();
     /*!
      Full constructor. Normally the constuctor is not called explicitly.
      Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used.
     */
-    Exception(int _code, const string& _err, const string& _func, const string& _file, int _line)
-        : code(_code), err(_err), func(_func), file(_file), line(_line)
-    { formatMessage(); }
-    
-    virtual ~Exception() throw() {}
+    Exception(int _code, const string& _err, const string& _func, const string& _file, int _line);
+    virtual ~Exception() throw();
 
     /*!
      \return the error description and the context as a text string.
     */ 
-    virtual const char *what() const throw() { return msg.c_str(); }
-
-    void formatMessage()
-    {
-        if( func.size() > 0 )
-            msg = format("%s:%d: error: (%d) %s in function %s\n", file.c_str(), line, code, err.c_str(), func.c_str());
-        else
-            msg = format("%s:%d: error: (%d) %s\n", file.c_str(), line, code, err.c_str());
-    }
+    virtual const char *what() const throw();
+    void formatMessage();
     
     string msg; ///< the formatted error message
 
@@ -1671,7 +1661,6 @@ public:
     MatExpr inv(int method=DECOMP_LU) const;
     //! per-element matrix multiplication by means of matrix expressions
     MatExpr mul(InputArray m, double scale=1) const;
-    MatExpr mul(const MatExpr& m, double scale=1) const;
     
     //! computes cross-product of 2 3D vectors
     Mat cross(InputArray m) const;
index e4de55e..e4ee189 100644 (file)
@@ -1592,14 +1592,13 @@ MatExpr Mat::inv(int method) const
 MatExpr Mat::mul(InputArray m, double scale) const
 {
     MatExpr e;
-    MatOp_Bin::makeExpr(e, '*', *this, m.getMat(), scale);
-    return e;
-}
-    
-MatExpr Mat::mul(const MatExpr& m, double scale) const
-{
-    MatExpr e;
-    m.op->multiply(MatExpr(*this), m, e, scale);
+    if(m.kind() == _InputArray::EXPR)
+    {
+        const MatExpr& me = *(const MatExpr*)m.obj;
+        me.op->multiply(MatExpr(*this), me, e, scale);
+    }
+    else
+        MatOp_Bin::makeExpr(e, '*', *this, m.getMat(), scale);
     return e;
 }
 
index a823725..e4cb15c 100644 (file)
 namespace cv
 {
 
+Exception::Exception() { code = 0; line = 0; }
+
+Exception::Exception(int _code, const string& _err, const string& _func, const string& _file, int _line)
+: code(_code), err(_err), func(_func), file(_file), line(_line)
+{
+    formatMessage();
+}
+
+Exception::~Exception() throw() {}
+
+/*!
+ \return the error description and the context as a text string.
+ */ 
+const char* Exception::what() const throw() { return msg.c_str(); }
+
+void Exception::formatMessage()
+{
+    if( func.size() > 0 )
+        msg = format("%s:%d: error: (%d) %s in function %s\n", file.c_str(), line, code, err.c_str(), func.c_str());
+    else
+        msg = format("%s:%d: error: (%d) %s\n", file.c_str(), line, code, err.c_str());
+}
+    
 struct HWFeatures
 {
     enum { MAX_FEATURE = CV_HARDWARE_MAX_FEATURE };
index 6b24993..2d390f5 100644 (file)
@@ -1,3 +1,26 @@
 #include "test_precomp.hpp"
 
-CV_TEST_MAIN("cv")
+//CV_TEST_MAIN("cv")
+
+#include <iostream>
+#include <cxcore.hpp>
+
+using namespace cv;
+using namespace std;
+
+int main(int,char**)
+{
+    /*cv::Mat img3x3(3, 3, CV_8UC1);
+    cv::Mat img2x2 = img3x3(cv::Rect(0, 0, 2, 2));
+    
+    for(cv::MatIterator_<uchar> it = img3x3.begin<uchar>(); it != img3x3.end<uchar>(); ++it)
+        *it = 1;
+    
+    int sum = 0;
+    for(cv::MatConstIterator_<uchar> it = img2x2.begin<uchar>(); it != img2x2.end<uchar>(); ++it)
+        sum += *it;
+    std::cout << "sum = " << sum << " (should be 4)\n";*/
+    FileStorage fs("empty.yml", CV_STORAGE_READ);
+    cout << fs["a"].type() << endl;
+    return 0;
+}