Commit 0e9405e5 authored by Andrey Kamaev's avatar Andrey Kamaev

Honor resently added functionality in hdr_parser and rst_parser; minor fixes in documentation

parent dc5c7ee6
...@@ -179,6 +179,10 @@ div.body p, div.body dd, div.body li { ...@@ -179,6 +179,10 @@ div.body p, div.body dd, div.body li {
margin-bottom: 1em; margin-bottom: 1em;
} }
div.toctree-wrapper li, ul.simple li {
margin:0;
}
div.body h1, div.body h1,
div.body h2, div.body h2,
div.body h3, div.body h3,
......
...@@ -31,7 +31,7 @@ doc_signatures_whitelist = [ ...@@ -31,7 +31,7 @@ doc_signatures_whitelist = [
# templates # templates
"Matx", "Vec", "SparseMat_", "Scalar_", "Mat_", "Ptr", "Size_", "Point_", "Rect_", "Point3_", "Matx", "Vec", "SparseMat_", "Scalar_", "Mat_", "Ptr", "Size_", "Point_", "Rect_", "Point3_",
"DataType", "detail::RotationWarperBase", "flann::Index_", "CalonderDescriptorExtractor", "DataType", "detail::RotationWarperBase", "flann::Index_", "CalonderDescriptorExtractor",
"gpu::DevMem2D_", "gpu::PtrStep_", "gpu::PtrElemStep_", "gpu::PtrStepSz", "gpu::PtrStep", "gpu::PtrElemStep_",
# black boxes # black boxes
"CvArr", "CvFileStorage", "CvArr", "CvFileStorage",
# other # other
...@@ -191,7 +191,7 @@ def process_module(module, path): ...@@ -191,7 +191,7 @@ def process_module(module, path):
hdrlist.append(os.path.join(root, filename)) hdrlist.append(os.path.join(root, filename))
if module == "gpu": if module == "gpu":
hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "devmem2d.hpp")) hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "cuda_devptrs.hpp"))
hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "gpumat.hpp")) hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "gpumat.hpp"))
decls = [] decls = []
......
...@@ -19,19 +19,19 @@ a unified access to all face recongition algorithms in OpenCV. :: ...@@ -19,19 +19,19 @@ a unified access to all face recongition algorithms in OpenCV. ::
// Trains a FaceRecognizer. // Trains a FaceRecognizer.
virtual void train(InputArray src, InputArray labels) = 0; virtual void train(InputArray src, InputArray labels) = 0;
// Updates a FaceRecognizer. // Updates a FaceRecognizer.
virtual void update(InputArrayOfArrays src, InputArray labels); virtual void update(InputArrayOfArrays src, InputArray labels);
// Gets a prediction from a FaceRecognizer. // Gets a prediction from a FaceRecognizer.
virtual int predict(InputArray src) const = 0; virtual int predict(InputArray src) const = 0;
// Predicts the label and confidence for a given sample. // Predicts the label and confidence for a given sample.
virtual void predict(InputArray src, int &label, double &confidence) const = 0; virtual void predict(InputArray src, int &label, double &confidence) const = 0;
// Serializes this object to a given filename. // Serializes this object to a given filename.
virtual void save(const string& filename) const; virtual void save(const string& filename) const;
// Deserializes this object from a given filename. // Deserializes this object from a given filename.
virtual void load(const string& filename); virtual void load(const string& filename);
...@@ -58,7 +58,7 @@ I'll go a bit more into detail explaining :ocv:class:`FaceRecognizer`, because i ...@@ -58,7 +58,7 @@ I'll go a bit more into detail explaining :ocv:class:`FaceRecognizer`, because i
Moreover every :ocv:class:`FaceRecognizer` supports the: Moreover every :ocv:class:`FaceRecognizer` supports the:
* **Training** of a :ocv:class:`FaceRecognizer` with :ocv:func:`FaceRecognizer::train` on a given set of images (your face database!). * **Training** of a :ocv:class:`FaceRecognizer` with :ocv:func:`FaceRecognizer::train` on a given set of images (your face database!).
* **Prediction** of a given sample image, that means a face. The image is given as a :ocv:class:`Mat`. * **Prediction** of a given sample image, that means a face. The image is given as a :ocv:class:`Mat`.
...@@ -111,7 +111,7 @@ Since every :ocv:class:`FaceRecognizer` is a :ocv:class:`Algorithm`, you can use ...@@ -111,7 +111,7 @@ Since every :ocv:class:`FaceRecognizer` is a :ocv:class:`Algorithm`, you can use
.. code-block:: cpp .. code-block:: cpp
// Create a FaceRecognizer: // Create a FaceRecognizer:
Ptr<FaceRecognizer> model = createEigenFaceRecognizer(); Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
// And here's how to get its name: // And here's how to get its name:
std::string name = model->name(); std::string name = model->name();
...@@ -121,7 +121,7 @@ FaceRecognizer::train ...@@ -121,7 +121,7 @@ FaceRecognizer::train
Trains a FaceRecognizer with given data and associated labels. Trains a FaceRecognizer with given data and associated labels.
.. ocv:function:: void FaceRecognizer::train(InputArray src, InputArray labels) .. ocv:function:: void FaceRecognizer::train( InputArrayOfArrays src, InputArray labels ) = 0
:param src: The training images, that means the faces you want to learn. The data has to be given as a ``vector<Mat>``. :param src: The training images, that means the faces you want to learn. The data has to be given as a ``vector<Mat>``.
...@@ -166,7 +166,7 @@ FaceRecognizer::update ...@@ -166,7 +166,7 @@ FaceRecognizer::update
Updates a FaceRecognizer with given data and associated labels. Updates a FaceRecognizer with given data and associated labels.
.. ocv:function:: void FaceRecognizer::update(InputArray src, InputArray labels) .. ocv:function:: void FaceRecognizer::update( InputArrayOfArrays src, InputArray labels )
:param src: The training images, that means the faces you want to learn. The data has to be given as a ``vector<Mat>``. :param src: The training images, that means the faces you want to learn. The data has to be given as a ``vector<Mat>``.
...@@ -193,7 +193,7 @@ This method updates a (probably trained) :ocv:class:`FaceRecognizer`, but only i ...@@ -193,7 +193,7 @@ This method updates a (probably trained) :ocv:class:`FaceRecognizer`, but only i
// //
// Now updating the model is as easy as calling: // Now updating the model is as easy as calling:
model->update(newImages,newLabels); model->update(newImages,newLabels);
// This will preserve the old model data and extend the existing model // This will preserve the old model data and extend the existing model
// with the new features extracted from newImages! // with the new features extracted from newImages!
Calling update on an Eigenfaces model (see :ocv:func:`createEigenFaceRecognizer`), which doesn't support updating, will throw an error similar to: Calling update on an Eigenfaces model (see :ocv:func:`createEigenFaceRecognizer`), which doesn't support updating, will throw an error similar to:
...@@ -203,8 +203,8 @@ Calling update on an Eigenfaces model (see :ocv:func:`createEigenFaceRecognizer` ...@@ -203,8 +203,8 @@ Calling update on an Eigenfaces model (see :ocv:func:`createEigenFaceRecognizer`
OpenCV Error: The function/feature is not implemented (This FaceRecognizer (FaceRecognizer.Eigenfaces) does not support updating, you have to use FaceRecognizer::train to update it.) in update, file /home/philipp/git/opencv/modules/contrib/src/facerec.cpp, line 305 OpenCV Error: The function/feature is not implemented (This FaceRecognizer (FaceRecognizer.Eigenfaces) does not support updating, you have to use FaceRecognizer::train to update it.) in update, file /home/philipp/git/opencv/modules/contrib/src/facerec.cpp, line 305
terminate called after throwing an instance of 'cv::Exception' terminate called after throwing an instance of 'cv::Exception'
Please note: The :ocv:class:`FaceRecognizer` does not store your training images, because this would be very memory intense and it's not the responsibility of te :ocv:class:`FaceRecognizer` to do so. The caller is responsible for maintaining the dataset, he want to work with. Please note: The :ocv:class:`FaceRecognizer` does not store your training images, because this would be very memory intense and it's not the responsibility of te :ocv:class:`FaceRecognizer` to do so. The caller is responsible for maintaining the dataset, he want to work with.
FaceRecognizer::predict FaceRecognizer::predict
----------------------- -----------------------
......
This diff is collapsed.
...@@ -222,7 +222,7 @@ protected: ...@@ -222,7 +222,7 @@ protected:
void getLikelihoods(const Mat& queryImgDescriptor, const vector< void getLikelihoods(const Mat& queryImgDescriptor, const vector<
Mat>& testImgDescriptors, vector<IMatch>& matches); Mat>& testImgDescriptors, vector<IMatch>& matches);
//procomputed data //precomputed data
int (*table)[8]; int (*table)[8];
//data precision //data precision
......
...@@ -818,23 +818,23 @@ Performs linear blending of two images. ...@@ -818,23 +818,23 @@ Performs linear blending of two images.
:param result: Destination image. :param result: Destination image.
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
gpu::bilateralFilter gpu::bilateralFilter
------------------- --------------------
Performs bilateral filtering of passed image Performs bilateral filtering of passed image
.. ocv:function:: void gpu::bilateralFilter(const GpuMat& src, GpuMat& dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode, Stream& stream = Stream::Null()); .. ocv:function:: void gpu::bilateralFilter(const GpuMat& src, GpuMat& dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode, Stream& stream = Stream::Null())
:param src: Source image. Supports only (channles != 2 && depth() != CV_8S && depth() != CV_32S && depth() != CV_64F). :param src: Source image. Supports only (channles != 2 && depth() != CV_8S && depth() != CV_32S && depth() != CV_64F).
:param dst: Destination imagwe. :param dst: Destination imagwe.
:param kernel_size: Kernel window size. :param kernel_size: Kernel window size.
:param sigma_color: Filter sigma in the color space. :param sigma_color: Filter sigma in the color space.
:param sigma_spatial: Filter sigma in the coordinate space. :param sigma_spatial: Filter sigma in the coordinate space.
:param borderMode: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now. :param borderMode: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now.
...@@ -843,24 +843,24 @@ Performs bilateral filtering of passed image ...@@ -843,24 +843,24 @@ Performs bilateral filtering of passed image
.. seealso:: .. seealso::
:ocv:func:`bilateralFilter`, :ocv:func:`bilateralFilter`,
gpu::nonLocalMeans gpu::nonLocalMeans
------------------- -------------------
Performs pure non local means denoising without any simplification, and thus it is not fast. Performs pure non local means denoising without any simplification, and thus it is not fast.
.. ocv:function:: void nonLocalMeans(const GpuMat& src, GpuMat& dst, float h, int search_widow_size = 11, int block_size = 7, int borderMode = BORDER_DEFAULT, Stream& s = Stream::Null()); .. ocv:function:: void nonLocalMeans(const GpuMat& src, GpuMat& dst, float h, int search_widow_size = 11, int block_size = 7, int borderMode = BORDER_DEFAULT, Stream& s = Stream::Null())
:param src: Source image. Supports only CV_8UC1, CV_8UC3. :param src: Source image. Supports only CV_8UC1, CV_8UC3.
:param dst: Destination imagwe. :param dst: Destination imagwe.
:param h: Filter sigma regulating filter strength for color. :param h: Filter sigma regulating filter strength for color.
:param search_widow_size: Size of search window. :param search_widow_size: Size of search window.
:param block_size: Size of block used for computing weights. :param block_size: Size of block used for computing weights.
:param borderMode: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now. :param borderMode: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now.
:param stream: Stream for the asynchronous version. :param stream: Stream for the asynchronous version.
...@@ -868,7 +868,7 @@ Performs pure non local means denoising without any simplification, and thus it ...@@ -868,7 +868,7 @@ Performs pure non local means denoising without any simplification, and thus it
.. seealso:: .. seealso::
:ocv:func:`fastNlMeansDenoising` :ocv:func:`fastNlMeansDenoising`
gpu::alphaComp gpu::alphaComp
------------------- -------------------
Composites two images using alpha opacity values contained in each image. Composites two images using alpha opacity values contained in each image.
......
import os, sys, re, string, fnmatch import os, sys, re, string, fnmatch
allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab"] allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab", "ocl"]
verbose = False verbose = False
show_warnings = True show_warnings = True
show_errors = True show_errors = True
...@@ -342,7 +342,7 @@ class RstParser(object): ...@@ -342,7 +342,7 @@ class RstParser(object):
continue continue
ll = l.rstrip() ll = l.rstrip()
if len(prev_line) > 0 and len(ll) >= len(prev_line) and (ll == "-" * len(ll) or ll == "+" * len(ll)): if len(prev_line) > 0 and len(ll) >= len(prev_line) and (ll == "-" * len(ll) or ll == "+" * len(ll) or ll == "=" * len(ll)):
# new function candidate # new function candidate
if len(lines) > 1: if len(lines) > 1:
self.parse_section_safe(module_name, fname, doc, flineno, lines[:len(lines)-1]) self.parse_section_safe(module_name, fname, doc, flineno, lines[:len(lines)-1])
......
...@@ -155,6 +155,8 @@ class CppHeaderParser(object): ...@@ -155,6 +155,8 @@ class CppHeaderParser(object):
elif angle_stack: elif angle_stack:
arg_type += w arg_type += w
angle_stack[-1] += 1 angle_stack[-1] += 1
elif arg_type == "struct":
arg_type += " " + w
elif arg_type and arg_type != "~": elif arg_type and arg_type != "~":
arg_name = " ".join(word_list[wi:]) arg_name = " ".join(word_list[wi:])
break break
...@@ -429,7 +431,7 @@ class CppHeaderParser(object): ...@@ -429,7 +431,7 @@ class CppHeaderParser(object):
decl_start = decl_start[0:-2].rstrip() + " ()" decl_start = decl_start[0:-2].rstrip() + " ()"
# constructor/destructor case # constructor/destructor case
if bool(re.match(r'(\w+::)*(?P<x>\w+)::~?(?P=x)', decl_start)): if bool(re.match(r'^(\w+::)*(?P<x>\w+)::~?(?P=x)$', decl_start)):
decl_start = "void " + decl_start decl_start = "void " + decl_start
rettype, funcname, modlist, argno = self.parse_arg(decl_start, -1) rettype, funcname, modlist, argno = self.parse_arg(decl_start, -1)
...@@ -441,10 +443,14 @@ class CppHeaderParser(object): ...@@ -441,10 +443,14 @@ class CppHeaderParser(object):
else: else:
if bool(re.match('\w+\s+\(\*\w+\)\s*\(.*\)', decl_str)): if bool(re.match('\w+\s+\(\*\w+\)\s*\(.*\)', decl_str)):
return [] # function typedef return [] # function typedef
elif bool(re.match('\w+\s+\(\w+::\*\w+\)\s*\(.*\)', decl_str)):
return [] # class method typedef
elif bool(re.match('[A-Z_]+', decl_start)): elif bool(re.match('[A-Z_]+', decl_start)):
return [] # it seems to be a macro instantiation return [] # it seems to be a macro instantiation
elif "__declspec" == decl_start: elif "__declspec" == decl_start:
return [] return []
elif bool(re.match(r'\w+\s+\(\*\w+\)\[\d+\]', decl_str)):
return [] # exotic - dynamic 2d array
else: else:
#print rettype, funcname, modlist, argno #print rettype, funcname, modlist, argno
print "Error at %s:%d the function/method name is missing: '%s'" % (self.hname, self.lineno, decl_start) print "Error at %s:%d the function/method name is missing: '%s'" % (self.hname, self.lineno, decl_start)
...@@ -799,6 +805,10 @@ class CppHeaderParser(object): ...@@ -799,6 +805,10 @@ class CppHeaderParser(object):
stmt = " ".join(stmt.split()) # normalize the statement stmt = " ".join(stmt.split()) # normalize the statement
stack_top = self.block_stack[-1] stack_top = self.block_stack[-1]
if stmt.startswith("@"):
# Objective C ?
break
decl = None decl = None
if stack_top[self.PROCESS_FLAG]: if stack_top[self.PROCESS_FLAG]:
# even if stack_top[PUBLIC_SECTION] is False, we still try to process the statement, # even if stack_top[PUBLIC_SECTION] is False, we still try to process the statement,
...@@ -850,5 +860,7 @@ if __name__ == '__main__': ...@@ -850,5 +860,7 @@ if __name__ == '__main__':
decls = [] decls = []
for hname in opencv_hdr_list: for hname in opencv_hdr_list:
decls += parser.parse(hname) decls += parser.parse(hname)
#for hname in sys.argv[1:]:
#decls += parser.parse(hname, wmode=False)
parser.print_decls(decls) parser.print_decls(decls)
print len(decls) print len(decls)
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