error from Matlab rightCam = imaq.VideoDevice('winvideo', 1, 'MJPG_640x480'); -


when matlab r2015a:

inf = imaqhwinfo ('winvideo')

inf =

   adaptordllname: 'c:\matlab\supportpackages\r2015a\osgenericvideointerfa...' adaptordllversion: '4.9 (r2015a)'       adaptorname: 'winvideo'         deviceids: {[1]  [2]  [3]}        deviceinfo: [1x3 struct] 

vid = videoinput('winvideo',1,'mjpg_640x480')

rightcam = imaq.videodevice('winvideo', 1, 'mjpg_640x480');

i error: "attempt reference field of non-structure array."

imaqhwinfo shows logitech c290 stereo webcams.

the solution different way..........

there 2 different ways talk cameras in image acquisition toolbox. 1 using videoinput object, other using imaq.videodevice. have use 1 or other, not both @ same time. imaq.videodevice, simplest way.

leftcam = imaq.videodevice('winvideo', 2, 'mjpg_640x480'); rightcam = imaq.videodevice('winvideo', 1, 'mjpg_640x480'); leftcam.returneddatatype = 'uint8'; leftcam.deviceproperties.focusmode = 'manual'; leftcam.deviceproperties.whitebalancemode = 'manual';  rightcam.returneddatatype = 'uint8'; rightcam.deviceproperties.focusmode = 'manual'; rightcam.deviceproperties.whitebalancemode = 'manual';  %% take pictures %player = vision.deployablevideoplayer; count = 1; = 1:1000     leftimage = step(leftcam);     rightimage = step(rightcam);     dispimage = imfuse(leftimage, rightimage, 'montage');     if mod(i, 20) == 0         imwrite(leftimage, sprintf('left/image%d.png', count));         imwrite(rightimage, sprintf('right/image%d.png', count));         dispimage = zeros(size(dispimage), 'like', dispimage);         count = count+1;     end     imshow(dispimage);     drawnow; end 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -