origami icon indicating copy to clipboard operation
origami copied to clipboard

add docstrings and named parameters for the generated functions

Open rrrnld opened this issue 8 years ago • 8 comments

I know the mapping is pretty straight forward and if you have some familiarity with ocv it might not even that much of a benefit, however I tend to explore new clojure APIs in my editor (emacs w/ spacemacs config) by navigating to a symbol and hitting , h h which in case of a function displays its signature and the docstring in a minibuffer. Would be super handy for me to have this in origami. Is there any work in this direction? I don't know if named parameters make any more sense then type signatures (they might in liaison w/ spec), but docstrings would help a lot already.

rrrnld avatar Dec 17 '17 11:12 rrrnld

I really like the idea. But I can't find anything that could be used from the original opencv to docs at: https://docs.opencv.org/

The generated javadoc and other pages are completely empty. For example: https://docs.opencv.org/java/3.0.0/org/opencv/core/Core.html

AFAIK, the javadoc generated when compiling the java bindings is empty as well.

Any idea of where to find something useful to use as docstring ?

hellonico avatar Dec 18 '17 00:12 hellonico

How exactly do you generate the bindings?

rrrnld avatar Dec 18 '17 12:12 rrrnld

I am using some simple java reflection to read the java methods and parameter types. Then output the clojure api methods (as-is or in what I've called bikkuri-mode) as text/clojure code.

Any good idea to provide something useful ?

hellonico avatar Dec 19 '17 00:12 hellonico

No, to be honest I don't have any good idea. In my mind the generated docs of OpenCV were better, and they also seem to have been slightly better at one point. The docs for 2.4.11 for example have more info. For OpenCV 3 I don't know really, I can't really find anything.

rrrnld avatar Dec 19 '17 16:12 rrrnld

Not all the doc strings are empty. I think you just had a unlucky example. For instance:

https://github.com/opencv/opencv/blob/master/modules/imgproc/include/opencv2/imgproc.hpp

Has tons of documentation

But a cursory look tells me it's not going to be fun parsing that into a docstring :)

Sometimes it has something convenient like /** @brief Calculates all of the moments up to the third order of a polygon or rasterized shape.

While other times it's an /** @overload So you have to go find the overload somehow?

And then the enums at the top have a different format with //! mode of the contour retrieval algorithm

I'd ask around and see if anyone has written a converter (I'm seeing javadoc->python-docstring stuff with a quick search) or at least look into some software that reads C++ docstrings and gives you an in-memory mapping

kxygk avatar Apr 17 '18 08:04 kxygk

what about this: https://docs.opencv.org/java/2.4.2/org/opencv/core/Core.html but its for opencv 2 unfortunately...

Chouffe avatar Mar 13 '19 15:03 Chouffe

Some useful text in the latest opencv javadoc https://docs.opencv.org/4.1.2/javadoc/index.html

https://docs.opencv.org/4.1.2/javadoc/org/opencv/videoio/VideoCapture.html

hellonico avatar Nov 13 '19 02:11 hellonico

New Javadoc for 4.3 ! https://docs.opencv.org/master/javadoc/

hellonico avatar Apr 17 '20 10:04 hellonico