img is typed as an “InputOutputArray”, and the bindings generator simply puts everything in the result that is “output”.
in that drawing call, one always has to pass img
in. in this case, also returning it wouldn’t be strictly necessary, because the caller already has a reference to it (the result).
however, there are OpenCV APIs that accept no/default arguments for some parameters, for convenience.
consider cvtColor
. you don’t have to give it a dst
. but you can. if you don’t, cvtColor creates it for you… and if it didn’t return that, you’d have no way to get a hold of the automatically created object.
both APIs call these parameters InputOutputArray. the only difference is that one requires an argument, for the other it’s optional.
the bindings generator does something that works for both cases.
I guess it is conceivable that mandatory-argument InputOutputArray parameters not be returned… but that probably requires more advanced analysis of the C++ code by the bindings generator than anyone as yet found worth the trouble.