Trouble with videoinput and dcam device

Hi all,
I'm relatively new to Matlab. I am trying to write a script that takes a live video feed from a Logitech HD Pro Webcam C920. Eventually I want to use edge detection with it rather than a recorded video, but thats not where Im having the issue. I am using Matlab R2014b.
This is my code for creating a videoinput object:
caminf = imaqhwinfo;
mycam = char(caminf.InstalledAdaptors());
mycaminfo = imaqhwinfo(mycam);
resolution = char(mycaminfo.DeviceInfo.SupportedFormats());
vid = videoinput(mycam, 1, resolution);
if I enter the command: imaqhwinfo(mycam), it says that AdaptorName: 'dcam'. However, if I run this code in a script I get the error message:
Error using videoinput (line 233)
There are no devices installed for the specified ADAPTORNAME. See IMAQHWINFO.
Im not really sure where the problem could be here...
Thank you

12 Kommentare

Luke - what happens when you step through the code? i.e. put a breakpoint at the line
mycaminfo = imaqhwinfo(mycam);
and step through each line. What does mycaminfo become? What is mycam?
So, if I input the lines one by one mycaminfo becomes:
mycaminfo =
AdaptorDllName: 'C:\MATLAB\SupportPackages\R2014b\dcamhardware\toolbo...'
AdaptorDllVersion: '4.8 (R2014b)'
AdaptorName: 'dcam'
DeviceIDs: {1x0 cell}
DeviceInfo: [1x0 struct]
and:
mycam =
dcam
Luke
Luke am 5 Jan. 2015
I did some digging and found this help thread where they say that if DeviceIDs is {1x0 cell}, it means the computer does not recognize the camera. In the command Window I set mycaminfo.DeviceIDs = 1, but this does not change the situation.
Geoff Hayes
Geoff Hayes am 6 Jan. 2015
Luke - have you installed any (all?) drivers for this webcam? What happens if you run the command webcamlist in the MATLAB Command Window? Does your webcam appear in the list?
Kais Abu saleh
Kais Abu saleh am 7 Dez. 2015
hey, i'm having same problem as luke, i tried the command webcamlist and i get an empty list as a result, i've tried everything do you have any idea what to do next?
install webcam package from Support Package Installer could show you the webcam list
where do I get a support package installer? i'm facing the exact same problem
Yousef Mohamed
Yousef Mohamed am 18 Dez. 2016
When i write webcam list it tells me that it identifies the webcam and its name but the same problem occurs does that mean i have to work with a usb cam not the built in laptop cam ?
Diah Junaidi
Diah Junaidi am 31 Mai 2019
Best way to solve this ---> if the usb webcam doesnt wanna install winvideo but you just have webcam, so you absolutely should choose : Image Acquisition Toolbox Support Package for "OS Generic Video Interface". This is the answer.
Vijay Hiremath
Vijay Hiremath am 4 Mär. 2021
Diah Junaidi : It worked as I installed the "OS Generic Video Interface" Thank you so much & U are really osm !

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

David Tarkowski
David Tarkowski am 6 Jan. 2015

1 Stimme

You are using a Logitech camera which is a webcam. The dcam adaptor does not support webcams. If you are using the videoinput command, you should use the winvideo adaptor.
Since you are using R2014b, you can also use the webcam object. It doesn't have all of the features of videoinput, but has a simpler interface.

3 Kommentare

Yousef Mohamed
Yousef Mohamed am 18 Dez. 2016
winvideo adaptor wasn't installed when i installed image acquisition toolbox how can i install it ?
KAE
KAE am 28 Jun. 2017
Thanks for the link, Walter. It worked for me.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Duy Dang
Duy Dang am 10 Apr. 2018

0 Stimmen

Thank you Vishwas Banjan, it work with your solution.

Community Treasure Hunt

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

Start Hunting!

Translated by