Hopefully a simple question

Can somebody point me to an OpenCV tutorial or other doc that explains the technical details of how the Python cv2 API interworks with OpenCV C++ code? In particular how translations between complex objects (e.g. Numpy np.array and OpenCV cv::Mat). We want to do two things:

  1. Write new C++ code that inter-works with C++ OpenCV (and other C++) and Python the same way OpenCV inter-works with Python.
  2. Re-write C++ wrappers for C++ OpenCV to convert our existing C++ code to a functional and much more data-oriented in a way that “just works” based on how the Python API just works rather impressively.

Right now we are using Pybind11 to provide a Python API to our C++ code but we don’t need to have C++ call Python and we’d like to simplify it. Obviously, and hats off to the team for this, OpenCV has done this about as close to ideal as perhaps possible. We’ve started to study the repo code, but we are thinking that there is a specification somewhere for this and we don’t want to re-invent the wheel — and possibly get it wrong. Thanks very much.