matlab coder:Can I give some advice on C/C++ code generation for the Image Processing Toolbox and Computer Vision Toolbox?

3 views (last 30 days)
As far as I know from years of experience and official releases(see attachment), many of the built-in functions in the mathworks Image Processing Toolbox and Computer Vision Toolbox are somewhat deficient in their support for C/C++ code, which can easily create a barrier for deploying embedded users, as they always need to be careful to consider whether the functions they use fully support standalone C/C++ code generation(any device target). There are few built-in functions that fully support platform-independent code generation, and there are many functions that generate shared libraries optimised for x86-64 platforms or none at all to support, which makes porting to embedded code platforms difficult or slightly less powerful than the native computer vision open source library opencv.
Therefore, for ease of deployment (from embedded platforms to desktop x86-64 platforms), my recommendation is that in the future all built-in functions in these 2 toolboxes will be dependencies on OpenCV after generating C/C++ code, without the need for users to consider any limitations. And performance would be guaranteed, just like the "detectOrbFeatures" built-in function generation relies on the OpenCV library!
  1 Comment
cui,xingxing
cui,xingxing on 15 Feb 2023
Edited: cui,xingxing on 16 Feb 2023
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:

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!