MATLAB can't work with webcam

I'm trying to connect webcam in my project, but MATLAB throws an error.
Webcamlist don't find any cam:
>> webcamlist
ans =
{}
Device id:
>> imaqhwinfo('linuxvideo')
ans =
AdaptorDllName: '/home/voland/Documents/MATLAB/SupportPackages/R2014b/osgenericvideointerfac...'
AdaptorDllVersion: '4.8 (R2014b)'
AdaptorName: 'linuxvideo'
DeviceIDs: {[1] [2]}
DeviceInfo: [1x2 struct]
Camera is available, but don't start:
>> vid = videoinput('linuxvideo',1,'YUYV_640x480')
Summary of Video Input Object Using 'UVC Camera (046d:0825)'.
Acquisition Source(s): Camera 1 is available.
Acquisition Parameters: 'Camera 1' is the current selected source.
10 frames per trigger using the selected source.
'YUYV_640x480' video data to be logged upon START.
Grabbing first of every 1 frame(s).
Log data to 'memory' on trigger.
Trigger Parameters: 1 'immediate' trigger(s) on START.
Status: Waiting for START.
0 frames acquired since starting.
0 frames available for GETDATA.
>> preview(vid)
Warning: Unable to reset the crop area. Perhaps the device is in use.
Error using imaqdevice/preview (line 176)
Could not connect to the image acquisition device. Device may be in use.
dmesg:
[11484.585199] usb 4-1.1: new high-speed USB device number 7 using
ehci-pci
[11484.888728] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825)
[11484.979398] input: UVC Camera (046d:0825) as
/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.1/4-1.1:1.0/input/input23
This trick can't help for me:
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so sudo ./matlab
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so sudo ./matlab
Cameras great work on Windows 7x64 with MATLAB 2015b and on Cheese (Linux). My system: Arch Linux x64 with MATLAB 2014b. I have no idea about the resolve this problem. I'm hope for your help. Thanks!

6 comentarios

Walter Roberson
Walter Roberson el 3 de Abr. de 2016
Could you confirm that you installed the Webcam support package?
Marat Gareev
Marat Gareev el 3 de Abr. de 2016
How can I do this? So, my cameras correctly work in Cheese, V4L2ucp
Image Analyst
Image Analyst el 3 de Abr. de 2016
It would tell you if you didn't have it installed. Since it didn't tell you, you do have it installed.
Perhaps you might also need the OS Generic Video Interface hard ware support package from the "Add ons" button on the Home tool strip tab.
Marat Gareev
Marat Gareev el 3 de Abr. de 2016
I installed this package
Image Analyst
Image Analyst el 3 de Abr. de 2016
Does linux have anything like Windows Device Manager, where you can see what devices are attached to your computer? If so, does it show the webcam?
Yes of course. I can see the connected devices from dmesg:
[11484.585199] usb 4-1.1: new high-speed USB device number 7 using
ehci-pci
[11484.888728] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825)
[11484.979398] input: UVC Camera (046d:0825) as
/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.1/4-1.1:1.0/input/input23
I can also see what programs are using the camera:
~ sudo lsof | grep video0
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
...
MATLAB 13813 14145 root 496u CHR 81,0 0t0 13722 /dev/video0
MATLAB 13813 14146 root 496u CHR 81,0 0t0 13722 /dev/video0
MATLAB 13813 15173 root 496u CHR 81,0 0t0 13722 /dev/video0
MATLAB 13813 15180 root 496u CHR 81,0 0t0 13722 /dev/video0
v4l2ucp 15764 root 8u CHR 81,0 0t0 13722 /dev/video0
QProcessM 15764 15765 root 8u CHR 81,0 0t0 13722 /dev/video0
mplayer 15766 root mem CHR 81,0 13722 /dev/video0
mplayer 15766 root 5u CHR 81,0 0t0 13722 /dev/video0
mplayer 15766 root 8u CHR 81,0 0t0 13722 /dev/video0
mplayer 15766 15767 root mem CHR 81,0 13722 /dev/video0
mplayer 15766 15767 root 5u CHR 81,0 0t0 13722 /dev/video0
mplayer 15766 15767 root 8u CHR 81,0 0t0 13722 /dev/video0
But when I connect to Matlab, no programs are using the camera (It is shown v4l2ucp for example)

Iniciar sesión para comentar.

Respuestas (1)

Renan Augusto Starke
Renan Augusto Starke el 15 de Ag. de 2016
Editada: Walter Roberson el 16 de Ag. de 2016

0 votos

Hi,
in order to make cameras to work with Matlab in Arch Linux you should install almost all gstreamer plugins:

Preguntada:

el 3 de Abr. de 2016

Editada:

el 16 de Ag. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by