I'm looking for a function or a method that can return a list of parameters' names of a type object, something like: func(X)
or X.method
that will return ['normType', 'crossCheck']
for cv2.BFMatcher
and ['index_params', 'search_params']
for cv2.FlannBasedMatcher
(and even the keys of index_params
and search_params
dictionary if possible, like ['algorithm', 'table_number', 'key_size', 'multi_probe_level']
etc.)
I tried some inspect methods like inspect.getfullargspec
but they don't work on type objects
Use case:
I'm writing a function that based on its arguments will create a combination (detector, descriptor, matcher), and i want to pass the parameters to use for those three directly when i call the function.
and i want to use something like dict(zip(params_keys, params_values))
so I'm thinking about something like this:
def method(detector_name, detector_params_values, descriptor_name, descriptor_params_values, matcher_name, matcher_params_values):
# ...
MATCHERS = {"BF": cv2.BFMatcher, "FLANN": cv2.FlannBasedMatcher}
matcher_params_keys = func(matcher_name) # this is what i'm looking for
matcher = MATCHERS[matcher_name](**dict(zip(matcher_params_keys, matcher_params_values)))
# and basically the same for the detectors and descriptors
PS: I may be using some wrong terminology because I'm not an expert in Python, but I hope my question is clear.