I am trying to connect 4 web cameras and have all 4 live videos simultaneoulsy. I can connect 3 of the cameras with no issue, but every time I try a 4th camera I get the following error:
Error using videoinput (line 391)
winvideo: Image aquisition device is not functioning. Make sure no other objects or applications are accessing the same device.
each camera works fine, and I can switch which camera I turn on first, but no matter what camera when I try turning on the 4th camera I am always thrown that error.I have checked multiple times and I don't think any other program is trying to access the web cam, I am not sure what to do and would appreciate some help.
here is what my code looks like:
%start of the code here
webcamlist
vid1 = videoinput('winvideo', 1);
f1 = figure('Position', [4 378 560 420]');
vidRes1 = vid1.VideoResolution;
nBands1 = vid1.NumberOfBands;
hImage1 = image(zeros(vidRes1(2), vidRes1(1), nBands1) );
preview (vid1,hImage1);
vid2 = videoinput('winvideo', 2);
f2 = figure('Position', [4 378 560 420]');
vidRes2 = vid2.VideoResolution;
nBands2 = vid2.NumberOfBands;
hImage2 = image(zeros(vidRes2(2), vidRes2(1), nBands2) );
preview (vid2,hImage2);
vid3 = videoinput('winvideo', 3);
f3 = figure('Position', [4 378 560 420]');
vidRes3 = vid3.VideoResolution;
nBands3 = vid3.NumberOfBands;
hImage3 = image(zeros(vidRes3(2), vidRes3(1), nBands3) );
preview (vid3,hImage3);
vid4 = videoinput('winvideo', 4);
f4 = figure('Position', [4 378 560 420]');
vidRes4 = vid4.VideoResolution;
nBands4 = vid4.NumberOfBands;
hImage4 = image(zeros(vidRes4(2), vidRes4(1), nBands4) );
preview (vid4,hImage4);