GPU Coder fails to generate Vision toolbox detector using OpenCV

I am attempting to use the GPU Coder to generate a DLL from a detector from the Vision toolbox, so that I can integrate it back into a Simulink model similar to the example found here: Integrating GPU Coder™ into Simulink®
My simplified example instantiation of the detector is attached in Detector_GPU.m.
My script to setup and call the GPU Coder is attached in Generate_Code_For_Detector_GPU.m.
The output of the codegen operation is attached in Codegen_Output.txt.
The full test example is attached in Detector_GPU_Codegen_Test.zip.
The code appears to generate correctly, but fails to compile.
The issue as far as I understand it is that when passing arguments to the nvcc linker, each one must be proceded by "-Xlinker".
The list of libraries (OpenVC) passed to the linker does not have "-Xlinker" before each one, so they do not get correctly passed into the linker.
If I modify the makefile Detector_GPU_rtw.mk to pass the linker the list of libraries with the "-Xlinker" option before each one, this correctly compiles.
The output of this compilation is attached in codegen_Fixed_Makefile_Output.txt
I am able to manually compile the DLL, but I would like to be able to generate this correctly inside MATLAB for ease of generating my Simulink model.
Is there any way to modify the way that the makefile is generated my MATLAB?
I have tried this on MATLAB R2018b and R2019a and they behave the same.
I do not have access to R2019b yet.

 Accepted Answer

Hi Matthew,
I was able to reproduce the issue on my end. This appears to be a bug related to vision.PeopleDetector. I have notified the relevant team of the issue, and they will consider this for future releases of MATLAB. For now, the only workaround is to manually edit the makefile to include the -Xlinker flag. I apologize for any inconvience this has caused you.
Best,
Connor

1 Comment

Thank you Connor.
I assumed this would be the case.
I will continue working by replacing the makefile.

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with GPU Coder in Help Center and File Exchange

Products

Release

R2019a

Community Treasure Hunt

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

Start Hunting!