matlab coder: It's time to consider about performance deployment in the Computer Vision field!
5 views (last 30 days)
It is well known that the OpenCV computer vision library is a high performance C++ library that can be deployed on almost any device from desktop computers to embedded devices. C/C++ code generated by Matlab coder/embeded coder products should be generated with full consideration of the performance benefits of OpenCV, especially in the CV domain i.e. it is best to rely on the OpenCV library.
Rationale: As far as I know, the current version of R2022b supports C/C++ generation for most of the basic core built-in functions in the image processing toolbox and computer vision toolbox. If the user chooses to deploy code for a non-"MATLAB HOST COMPUTER" target, there is a high probability that the generated standalone C/C++ code is either not optimised or relies on the TMW self-built platform-specific shared library (Performance is only reserved for the "MATLAB HOST COMPUTER").
Note here that if the user designs a slightly more complex algorithm, e.g. one that uses mainly built-in functions, the resulting stand-alone C/C++ code is generally very difficult to run on embedded devices and is not as efficient as the simple matrix multiplication operations listed in the official examples. For example, the built-in function 'imwarp' supports stand-alone C code generation, but if the user is deploying for an embedded platform, then the resulting stand-alone C code does not rely on pre-compiled optimisation libraries and is many times slower than in a matlab development environment! However, there are functions that do a better job, such as the built-in function 'detectORBFeatures', which generates internal OpenCV dependent calls regardless of whether the user is deploying to a desktop or embedded platform, so at least performance is fully guaranteed and the user can spend less effort on optimising function details.
To summarise: the goal of matlab coder/embeded coder products is to allow users to deploy matlab algorithms to all types of devices as quickly as possible, with minimal interference from code restrictions.
Alternatively, it is recommended that matlab coder/embeded coder products should consider providing pre-compiled optimisation libraries for each platform as an SDK download, so that the C/C++ shell calls generated by users using matlab coder are all consistent. When it comes time to deploy, in addition to the shell code, you also need to download the SDK for the corresponding target platform and use it together, which will be much more convenient.