Commit dfe7708f authored by Andrey Kamaev's avatar Andrey Kamaev

Improved javadoc comments generation scripts; fixed some typos in documentation

parent eea62ca6
...@@ -218,7 +218,7 @@ Closes video file or capturing device. ...@@ -218,7 +218,7 @@ Closes video file or capturing device.
.. ocv:pyfunction:: cv2.VideoCapture.release() .. ocv:pyfunction:: cv2.VideoCapture.release()
.. ocv:cfunction: void cvReleaseCapture(CvCapture** capture) .. ocv:cfunction:: void cvReleaseCapture(CvCapture** capture)
The methods are automatically called by subsequent :ocv:func:`VideoCapture::open` and by ``VideoCapture`` destructor. The methods are automatically called by subsequent :ocv:func:`VideoCapture::open` and by ``VideoCapture`` destructor.
...@@ -233,7 +233,7 @@ Grabs the next frame from video file or capturing device. ...@@ -233,7 +233,7 @@ Grabs the next frame from video file or capturing device.
.. ocv:pyfunction:: cv2.VideoCapture.grab() -> successFlag .. ocv:pyfunction:: cv2.VideoCapture.grab() -> successFlag
.. ocv:cfunction: int cvGrabFrame(CvCapture* capture) .. ocv:cfunction:: int cvGrabFrame(CvCapture* capture)
.. ocv:pyoldfunction:: cv.GrabFrame(capture) -> int .. ocv:pyoldfunction:: cv.GrabFrame(capture) -> int
...@@ -252,7 +252,7 @@ Decodes and returns the grabbed video frame. ...@@ -252,7 +252,7 @@ Decodes and returns the grabbed video frame.
.. ocv:pyfunction:: cv2.VideoCapture.retrieve([image[, channel]]) -> successFlag, image .. ocv:pyfunction:: cv2.VideoCapture.retrieve([image[, channel]]) -> successFlag, image
.. ocv:cfunction: IplImage* cvRetrieveFrame(CvCapture* capture) .. ocv:cfunction:: IplImage* cvRetrieveFrame(CvCapture* capture)
.. ocv:pyoldfunction:: cv.RetrieveFrame(capture) -> iplimage .. ocv:pyoldfunction:: cv.RetrieveFrame(capture) -> iplimage
...@@ -271,7 +271,7 @@ Grabs, decodes and returns the next video frame. ...@@ -271,7 +271,7 @@ Grabs, decodes and returns the next video frame.
.. ocv:pyfunction:: cv2.VideoCapture.read([image]) -> successFlag, image .. ocv:pyfunction:: cv2.VideoCapture.read([image]) -> successFlag, image
.. ocv:cfunction: IplImage* cvQueryFrame(CvCapture* capture) .. ocv:cfunction:: IplImage* cvQueryFrame(CvCapture* capture)
.. ocv:pyoldfunction:: cv.QueryFrame(capture) -> iplimage .. ocv:pyoldfunction:: cv.QueryFrame(capture) -> iplimage
...@@ -444,7 +444,7 @@ VideoWriter::open ...@@ -444,7 +444,7 @@ VideoWriter::open
----------------- -----------------
Initializes or reinitializes video writer. Initializes or reinitializes video writer.
.. ocv:function: bool VideoWriter::open(const string& filename, int fourcc, double fps, Size frameSize, bool isColor=true) .. ocv:function:: bool VideoWriter::open(const string& filename, int fourcc, double fps, Size frameSize, bool isColor=true)
.. ocv:pyfunction:: cv2.VideoWriter.open(filename, fourcc, fps, frameSize[, isColor]) -> retval .. ocv:pyfunction:: cv2.VideoWriter.open(filename, fourcc, fps, frameSize[, isColor]) -> retval
...@@ -455,7 +455,7 @@ VideoWriter::isOpened ...@@ -455,7 +455,7 @@ VideoWriter::isOpened
--------------------- ---------------------
Returns true if video writer has been successfully initialized. Returns true if video writer has been successfully initialized.
.. ocv:function: bool VideoWriter::isOpened() .. ocv:function:: bool VideoWriter::isOpened()
.. ocv:pyfunction:: cv2.VideoWriter.isOpened() -> retval .. ocv:pyfunction:: cv2.VideoWriter.isOpened() -> retval
......
...@@ -1537,7 +1537,7 @@ The second case corresponds to a kernel of: ...@@ -1537,7 +1537,7 @@ The second case corresponds to a kernel of:
.. seealso:: .. seealso::
:ocv:func:`Scharr`, :ocv:func:`Scharr`,
:ocv:func:`Lapacian`, :ocv:func:`Laplacian`,
:ocv:func:`sepFilter2D`, :ocv:func:`sepFilter2D`,
:ocv:func:`filter2D`, :ocv:func:`filter2D`,
:ocv:func:`GaussianBlur` :ocv:func:`GaussianBlur`
......
...@@ -23,7 +23,7 @@ def document(infile, outfile, decls): ...@@ -23,7 +23,7 @@ def document(infile, outfile, decls):
marker = parceJavadocMarker(l) marker = parceJavadocMarker(l)
decl = decls.get(marker[0],None) decl = decls.get(marker[0],None)
if decl: if decl:
for line in makeJavadoc(decl, marker[2]).split("\n"): for line in makeJavadoc(decl, decls, marker[2]).split("\n"):
outf.write(marker[1] + line + "\n") outf.write(marker[1] + line + "\n")
else: else:
print "Error: could not find documentation for %s" % l.lstrip()[len(javadoc_marker):-1] print "Error: could not find documentation for %s" % l.lstrip()[len(javadoc_marker):-1]
...@@ -50,12 +50,12 @@ def ReformatForJavadoc(s): ...@@ -50,12 +50,12 @@ def ReformatForJavadoc(s):
pos_end = min(77, len(term)-1) pos_end = min(77, len(term)-1)
while pos_start < pos_end: while pos_start < pos_end:
if pos_end - pos_start == 77: if pos_end - pos_start == 77:
while pos_end >= pos_start: while pos_end >= pos_start+60:
if not term[pos_end].isspace(): if not term[pos_end].isspace():
pos_end -= 1 pos_end -= 1
else: else:
break break
if pos_end < pos_start: if pos_end < pos_start+60:
pos_end = min(pos_start + 77, len(term)-1) pos_end = min(pos_start + 77, len(term)-1)
while pos_end < len(term): while pos_end < len(term):
if not term[pos_end].isspace(): if not term[pos_end].isspace():
...@@ -72,6 +72,8 @@ def getJavaName(decl): ...@@ -72,6 +72,8 @@ def getJavaName(decl):
name += decl["module"] name += decl["module"]
if "class" in decl: if "class" in decl:
name += "." + decl["class"] name += "." + decl["class"]
else:
name += "." + decl["module"].capitalize()
if "method" in decl: if "method" in decl:
name += "." + decl["method"] name += "." + decl["method"]
return name return name
...@@ -84,7 +86,7 @@ def getDocURL(decl): ...@@ -84,7 +86,7 @@ def getDocURL(decl):
url += "#" + decl["name"].replace("::","-").replace("()","").replace("=","").strip().rstrip("_").replace(" ","-").replace("_","-").lower() url += "#" + decl["name"].replace("::","-").replace("()","").replace("=","").strip().rstrip("_").replace(" ","-").replace("_","-").lower()
return url return url
def makeJavadoc(decl, args = None): def makeJavadoc(decl, decls, args = None):
doc = "" doc = ""
prefix = "/**\n" prefix = "/**\n"
...@@ -130,7 +132,11 @@ def makeJavadoc(decl, args = None): ...@@ -130,7 +132,11 @@ def makeJavadoc(decl, args = None):
# other links # other links
if "seealso" in decl: if "seealso" in decl:
for see in decl["seealso"]: for see in decl["seealso"]:
doc += prefix + " * @see " + see.replace("::",".") + "\n" seedecl = decls.get(see,None)
if seedecl:
doc += prefix + " * @see " + getJavaName(seedecl) + "\n"
else:
doc += prefix + " * @see " + see.replace("::",".") + "\n"
prefix = " *\n" prefix = " *\n"
#doc += prefix + " * File: " + decl["file"] + " (line " + str(decl["line"]) + ")\n" #doc += prefix + " * File: " + decl["file"] + " (line " + str(decl["line"]) + ")\n"
...@@ -155,9 +161,11 @@ if __name__ == "__main__": ...@@ -155,9 +161,11 @@ if __name__ == "__main__":
print "Parsing documentation..." print "Parsing documentation..."
for m in ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts"]: for m in ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts"]:
parser.parse(m, os.path.join(selfpath, "../" + m)) parser.parse(m, os.path.join(selfpath, "../" + m))
parser.printSummary()
for i in range(1, len(sys.argv)): for i in range(1, len(sys.argv)):
folder = os.path.abspath(sys.argv[i]) folder = os.path.abspath(sys.argv[i])
for jfile in glob.glob(os.path.join(folder,"*.java")): for jfile in [f for f in glob.glob(os.path.join(folder,"*.java")) if not f.endswith("-jdoc.java")]:
outfile = os.path.abspath(os.path.basename(jfile).replace(".java", "-jdoc.java")) outfile = os.path.abspath(os.path.basename(jfile).replace(".java", "-jdoc.java"))
document(jfile, outfile, parser.definitions) document(jfile, outfile, parser.definitions)
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