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
2
  • So are you sure that there isn't any application using the webcam? Logout and back again just to make sure. Commented Aug 16, 2013 at 14:27
  • Doesn't work mate , even after rebooting the same error message shows up . Commented Aug 16, 2013 at 15:25

1 Answer 1

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.

7
  • 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. Commented Aug 16, 2013 at 16:09
  • I think this is where Arch really caught me off-guard , because I am in charge of making my own OS . Commented Aug 16, 2013 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). Commented Aug 16, 2013 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 . Commented Aug 16, 2013 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 . Commented Aug 16, 2013 at 16:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.