codegen: use -package option error?

4 views (last 30 days)
cui
cui on 26 Oct 2022
Commented: cui on 3 Nov 2022
When I use the codegen command line for code generation, I get the following error unexpectedly, which I guess is that the matlab built-in function detectORBFeatures calls the OpenCV source code???
inputsArgs = {'-config','cfg',...
'myEntryFcn','-args',{in1,in2},...
'-package','src.zip',...
'-report'};
codegen(inputsArgs{:});
report following bug:
The following files have the same file name which cannot be packaged together in a flat hierarchy:
C:\Program Files\MATLAB\R2022b\toolbox\vision\builtins\src\ocvcg\opencv\include\opencv2\stitching\detail\warpers.hpp
C:\Program Files\MATLAB\R2022b\toolbox\vision\builtins\src\ocvcg\opencv\include\\opencv2\stitching\warpers.hpp
Use help codegen for more information on using this command.
Error using codegen
Run in R2022b.
  8 Comments
cui
cui on 3 Nov 2022
Recently I have encountered generated C code or mex files that execute much less efficiently than the original matlab code (because many build-in functions are using pre-compiled libraries). I now instead think that in order to preserve the performance of the generated C code, it is possible to call the opencv library, but add the option for the user to choose whether to use a third party library when generating the configuration.

Sign in to comment.

Accepted Answer

cui
cui on 28 Oct 2022
Edited: cui on 28 Oct 2022
The correct approach is for the codegen command to not use the -package option.Then,this bug is easily fixed by manually copying the separate C code.
Also, detectORBFeatures does call a third-party OPENCV library, which is not clearly stated in the official documentation function on the C/C++ generated support description(Extended Capabilities section(bottom page)).Which, in terms of the generated code, is simply a wrapping of the ORB feature detection to fit the C code generation.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!