MatLab (Image Processing/Image Acquisition) How to use trigger/getsnapshot if the preview(vid1) is on a different callback?
Show older comments
I already asked this but I will try it in different approach.
I am getting an error saying
winvideo: The device associated with device ID 1 is already in use.
A new videoinput object cannot be created for this device while it is in use.
My preview code is:
vid1 = videoinput('winvideo', 1, 'MJPG_1024x576');
vid1.FramesPerTrigger = 1;
vid1.ReturnedColorspace = 'rgb';
triggerconfig(vid1,'manual');
vid1Res = get(vid1, 'VideoResolution');
imWidth = vid1Res(1);
imHeight = vid1Res(2);
nBands = get(vid1, 'NumberofBands');
hImage = image(zeros(imHeight, imWidth, nBands), 'parent', handles.axes7);
axes(handles.axes7);
preview(vid1, hImage);
and my Capture code is:
vid1 = videoinput('winvideo', 1, 'MJPG_1024x576');
vid1.FramesPerTrigger = 1;
vid1.ReturnedColorspace = 'rgb';
triggerconfig(vid1, 'manual');
vid1Res = get(vid1, 'VideoResolution');
im1Width = vid1Res(1);
im1Height = vid1Res(2);
n1Bands = get(vid1, 'NumberOfBands');
h1Image = image(zeros(im1Height, im1Width, n1Bands), 'parent', handles.axes7);
preview(vid1, h1Image);
I know that the error is insanely obvious but I really can't figure out on how to capture the preview using different button. Please guide me dear Sir(s)/Mam(s). Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Matrox Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!