What is the nested variable syntax in OpenCV documentation supposed to imply?

Viewed 29

I'm trying to understand the syntax on the OpenCV documentation... For example, any function shows the Python implementation in a similar form, such as:

dst =   cv.boxFilter(   src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]  )

Is ksize, dst, anchor, etc optional parameters? Why are they all nested? (e.g. why is borderType inside the normalize brackets, normalize inside the anchor brackets, etc.?) What is that supposed to imply?

1 Answers

The arguments outside of brackets are all required. Each subsequent argument is optional but can only be supplied if all preceding arguments are provided. If we wrote

cv.boxFilter(src, ddepth, ksize[, dst][, anchor])

That would imply that I could call boxFilter and provide anchor but not dst (perhaps using keyword arguments). By writing the optional arguments in this nested form, it makes clear that only the procedural method of providing arguments in the proper order and without skipping over any is officially accepted.

Related