Video frames all garbled and not in sequence
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
gujax
el 20 de Ag. de 2024
Movida: Walter Roberson
el 20 de Ag. de 2024
Hi
I am using imaqtools in particular using gentl driver with Lucid vision camera. Ni Max and Arena records a sequence of frames just fine.
But matlab is having trouble. Initially the frames are in sequence for first few ten frames and then the frames randomly start jumping around e.g., frame 260 appears prior to frame 259 etc.
When I look at frame time, it all seems to be in sequence. Here is my code
Not only that the timing shows that frame interval is about 40ms.
Based on the frame rate that I am providing (40fps), the frame rate should have been ~22ms
% Generated in MATLAB R2022b on 14-Jan-2023 18:07:51
% Connect to Device
% Create connection to the device using the specified adaptor with the specified format.
clearvars;
v = videoinput("gentl", 1, "Mono16");
%% Configure Device-Specific Properties
% Configure properties that are specific to this device.
v.SelectedSource = "1";
%src displays a summary of video object
src = getselectedsource(v);
src.ExposureAuto = 'Off';
src.AcquisitionFrameRateEnable = 'true';
src.AcquisitionFrameRate = 40;
exposuretime =1000;%ms
src.ExposureTime = exposuretime;
%PRF=1000;
numFrames=ceil(231*4*5/src.AcquisitionFrameRate);
v.FramesPerTrigger = 1.5*numFrames;%extra frames for not missing out
set(v, 'Timeout', 600);
%% Record Video for Set Number of Frames
% Record video data for a specified number of frames.
start(v);
%give sufficient time 3x
wait(v,3*1/src.AcquisitionFrameRate*numFrames);
%stop(v);
while get(v,'FramesAvailable')<1 %Wait until at least 1 frame is available
unavailable=1;
end
% Determine the number frames acquired.
framesLogged = v.FramesAcquired;
[recording1,Time,Meta] = getdata(v, framesLogged);
%% Show Recording
% View the recorded video.
implay(recording1);
%% Clean Up
% Delete the videoinput object and clear variables from the workspace.
%stop(v);
delete(v)
clear src v
%%
fid = fopen('2D_scan.bin','w');
fwrite(fid',recording1,"uint16");
1 comentario
Walter Roberson
el 20 de Ag. de 2024
frame 260 appears prior to frame 259 etc
Interesting -- but how can you tell that the frames are out of order?
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface) en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!