SIMULINK Code Generation with USB Webcam under Ubuntu

5 vues (au cours des 30 derniers jours)
Timotheus
Timotheus le 16 Juin 2014
Hello everybody,
Please find my complete setup at the bottom of this Post.
i am trying to integrate a USB Webcam in a SIMULINK model from which i want to generate and build a standalone application. I am trying to achieve this by two different ways:
1) Using the "From Video Device Block":
Therefore I simply use this model:
[From Video Device Block]->[Convert 2D to 1D]->[To File block] Building the model succedes but when i am trying to run it with sudo ./model i get: "Could not open library: libmwimaqmex.so" Copying libmwimaqmex.so to the folder where the compiled model lies did not solve the problem.
2) Using a MATLAB function block:
In the MATLAB function block i wrote the following code:
function y = fcn()
%#codegen
persistent vid
if isempty(vid)
vid = imaq.VideoDevice('linuxvideo');
end
img = step(vid);
y = 1;
Trying to build this model results in an error during building:
HostLib_rtw.o: In function `DestroyHostLibrary': HostLib_rtw.c:(.text+0x15): undefined reference to `dlclose' HostLib_rtw.o: In function `CreateHostLibrary': HostLib_rtw.c:(.text+0x93): undefined reference to `dlopen'
I had a look in the generated C files and i found in HostLib_rtw.h: include dlfcn.h So i thought that libdl.so should be linked somewhere.
Does anybody has some experience with this problems?
Here my complete setup:
OS: Ubuntu 14.04 LTS Kernel: 3.7.8-030708-generic (important cause with the kernel brought by 14.04 LTS, the USB Webcam cannot be used even with standard MATLAB Code)
Target: ert_linux.tlc (Downloaded from http://rtime.felk.cvut.cz/~sojka/blog/)
  2 commentaires
Ketan
Ketan le 17 Juin 2014
For situation (1) try adding the directory containing libmwimaqmex.so to LD_LIBRARY_PATH
Timotheus
Timotheus le 17 Juin 2014
Modifié(e) : Timotheus le 17 Juin 2014
Hey Ketan! thanks for your advices. I have modified my LD_LIBRARY_PATH by adding follwing lines to ~/.bashrc:
export LD_LIBRARY_PATH=/usr/local/MATLAB/R2014a/toolbox/imaq/imaqblks/imaqmex/g$
export LD_LIBRARY_PATH=/usr/local/MATLAB/R2014a/bin/glnxa64:$LD_LIBRARY_PATH
As described below, my model runs now for ever but still the same error is thrown and no mat file is written:
Could not open library: libmwimaqmex.so

Connectez-vous pour commenter.

Réponses (3)

Kaustubha Govind
Kaustubha Govind le 16 Juin 2014
Are you able to run the model using:
>> !sudo ./model
at the MATLAB prompt? If yes, it could be that libmwimaqmex.so needs additional dependencies that were not copied over (within MATLAB, the system PATH is correctly setup). You could try using the packngo utility to grab all dependencies.
Regarding the second issue, what happens if you include libdl.so in the Simulation Target>Custom Code>Libraries pane of the Configuration Parameters window? Also, please check the box that says "Use the same custom code settings as Simulation Target" on the Code Generation>Custom Code pane
  3 commentaires
Kaustubha Govind
Kaustubha Govind le 17 Juin 2014
Timotheus: I wonder if you are missing some dependency files for libmwimaqmex.so - could you try using the nm or ldd utilities as documented in this solution to see why the OS is having trouble loading the library.
Ketan
Ketan le 18 Juin 2014
Kaustubha mentioned earlier to use packNGo to get all the needed dependent libraries. Have you tried that for situation (1)? This goes along with the idea of missing dependencies. See the following doc page:

Connectez-vous pour commenter.


Timotheus
Timotheus le 14 Juil 2014
if anybody is interested, i have solved this problem by simply creating a C s function block and grapping from there an image from my usb webcam by using opencv. the other block simply didn't work out

RAVI CHEKURI
RAVI CHEKURI le 2 Mar 2020
Hi, does your problem got solved. Please help me I am also getting same error. When I run the standalone application generated from video device block . I am getting error of could not determine entry point functions in libmwimaqmex.so

Community Treasure Hunt

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

Start Hunting!

Translated by