3

This might seem like a duplicate post, well yes it is, but I have a different problem compared with the duplicate version of it.

My value for imaqhwinfo gives me:

   InstalledAdaptors: {'dcam'  'linuxvideo'}
    MATLABVersion: '7.14 (R2012a)'
      ToolboxName: 'Image Acquisition Toolbox'
   ToolboxVersion: '4.3 (R2012a)'

The value for imaqhwinfo('linuxvideo',1) gives me:

DefaultFormat: 'YUYV_640x480'
   DeviceFileSupported: 0
            DeviceName: '1.3M WebCam'
              DeviceID: 1
 VideoInputConstructor: 'videoinput('linuxvideo', 1)'
VideoDeviceConstructor: 'imaq.VideoDevice('linuxvideo', 1)'
      SupportedFormats: {1x7 cell}

So, after that I gave the following to the Matlab terminal:

vid = videoinput('linuxvideo', 1);
set(vid, 'ReturnedColorSpace', 'RGB');

However, after inputting the following line:

img = getsnapshot(vid);

I get the following error:

Warning: Unable to set the selected source.  Perhaps the device is in use. 
Error using imaqdevice/getsnapshot (line 62)
Could not connect to the image acquisition device.  Device may be in use.

I posted this question to Matlab central and am waiting for a reply.

I'm using ArchLinux(64 bit) & Matlab(2012a) ( 64 bit). Webcam apps such as Cheese are running okay. I can see my face. I also have Skype, though I haven't configured it yet.

TL;DR

Can anybody help me fix this issue? It would be a great help, because if I cannot, I'll have to re-install Windows 7 for just a little bit of a school assignment, and that's time consuming. Plus I don't want to go back to Windows right now.

P.S: lsusb gives me:

Bus 002 Device 005: ID 148e:099a EVATRONIX SA 
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 064e:a219 Suyin Corp. 1.3M WebCam (notebook emachines E730, Acer sub-brand)
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
slm
  • 363,520
  • 117
  • 767
  • 871
motiur
  • 153
  • 7

1 Answers1

1

How about if you include the image size argument?

vid = videoinput(‘linuxvideo’, 1, ‘YUYV_640x480′);

Then try opening a preview window to view video at runtime:

preview(vid);

Formats

Also you can find out the acceptable formats:

info = imaqhwinfo('linuxvideo', 1);
info.SupportedFormats'

These formats can be used thusly:

vid = videoinput(‘linuxvideo’, 1, ‘...formats here...′);

Additional things to try?

I'd take a look at this ArchLinux forums thread titled: [SOLVED] matlab image capturing using webcam. There were several other things to try if the above doesn't work out.

slm
  • 363,520
  • 117
  • 767
  • 871
  • I see an window 640x480 , but no image , however an error message again after preview(vid): `Warning: Unable to set the selected source. Perhaps the device is in use. Error using imaqdevice/preview (line 177) Could not connect to the image acquisition device. Device may be in use.` – motiur Aug 16 '13 at 16:09
  • I think this is where Arch really caught me off-guard , because I am in charge of making my own OS . – motiur Aug 16 '13 at 16:11
  • @MotiurRahman - yes I've tried to get to using it but it felt like a step back to me. I usually use (Fedora, Ubuntu, or Debian). For ease of use I'd use either (Mint or PCLinuxOS). – slm Aug 16 '13 at 16:21
  • I saw you latest edit , I think I no what you are trying to do , I have done it ,but , umm , same error every time . Its a pity that I have to change an OS for an assignment , but this has been my life for the last 3-4 years , never stuck with a single OS for long enough to rot . – motiur Aug 16 '13 at 16:27
  • Yes , I saw that post on Arch , apparently , he bought a new webcam because its not supported . By my webcam is running fine , I can see video on that , its just I can't connect it with Matlab.Well , thanks for your reply , I am looking into the docs . – motiur Aug 16 '13 at 16:45
  • @motiur - Any solution to this? I have the same problem. Can see video fine on VLC. Matlab gives "could not connect to the image acquisition device. device may be in use". – Sanjay Manohar Sep 16 '15 at 13:49
  • @sanjay I couldn't, I used windows for Matlab,sorry. – motiur Sep 16 '15 at 16:12