The dependency on OpenCV for all the C++ code generated by the MATLAB built-in functions is a bit of a complication. I now think it can be boiled down to 2 points.
- if a built-in function in MATLAB has input and output parameters that happen to have very similar meanings to the OpenCV built-in functions, then this function can undoubtedly rely entirely on OpenCV to generate C/C++ code.
- If no similar OpenCV function can be found for a built-in function in MATLAB, then the C/C++ code can be generated by a combination of OpenCV operations/functions to approximate the MATLAB function.
The second point above is difficult to implement because the two built-in functions are designed with different logic, coupling and mutually exclusive parts, and using OpenCV operation/functions in general may add redundant operators to the computation, which is a key consideration.
-----------------
In addition, another possible approach is to refer to my recommendation from a while ago: