Similar function to python module 'inspect'? [closed]
Hey There, python provides a module called 'inspect' which gives possibilities to retrieve function information, like number of arguments, type of arguments, and more. Unfortunately this doesn't cover imported modules implemeted in C. Parameters of a to-be-parsed C module can't be read. See python issues like http://bugs.python.org/issue1748064
My question is: Does OpenCV itself provide a similar function? I need to read arguments, eg. of cv2.Canny(...), to generate a GUI for user-friendly setting it's parameters.
Thank You
you could use the __doc__ string, either from help():
(besides that, the python wrappers are all generated. you could exploit modules/python/src/gen2.py to generate your own doc/api/gui bindings in the very same way)
Thanks for your answer. The __doc__ or help function only return a single string providing me parameter names. What I need are the types of the input arguments. For example, I want to build a QSpinBox with PyQt if the type is integer to embed this in my widget. For this cause gen2.py seems quite promising, as it builds python lists containing the needed information. If I get to catch those lists, I will post my solution.
if you go that way, also look here . it preprocesses the raw hdr_parser.py output to some nice AST/DOM thing.
(maybe also look here (shameless plug))