Is there a way to stop preview lag during image acquisition?

4 views (last 30 days)
Hi, I have this script that connects BASLER acA1440 camera and records 10 seconds of video in 60 FPS with preview on:
vid = videoinput('gentl',1,'RGB8');
src = getselectedsource(vid);
vid.ReturnedColorSpace = "rgb";
vid.LoggingMode = "disk";
vid.FramesPerTrigger = 600;
src.Gain = 5;
src.AcquisitionFrameRateEnable = "True";
vid.TriggerFrameDelay = 5;
src.AcquisitionFrameRate = 60;
src.ExposureTime = 16000; % exposure that enables 60 FPS on camera
vidWr = VideoWriter("video.mp4","MPEG-4");
vidWr.FrameRate = 60;
vid.DiskLogger = vidWr;
preview(vid)
open(vidWr);
start(vid);
wait(vid,60,"running");
close(vidWr);
stoppreview(vid);
The video file I get is good. The higher the exposure time the lag gets bigger.
Is there way to get rid of/reduce preview lag?

Accepted Answer

atharva
atharva on 15 Dec 2023
Hey Piotr,
I understand that you want to stop preview lag during image acquisition.
You can reduce the preview lag by reducing the resolution of the preview window or by disabling the preview altogether. You can also try optimizing your code to reduce processing time.
You can also disable the preview window using the function stoppreview. You can learn more about the stoppreview function from the official mathworks documentation mentioned below-
I hope this helps!
  1 Comment
Piotr Bednarz
Piotr Bednarz on 15 Dec 2023
Hi, thanks for the answer. I want to keep preview running during acquisition. Reducing resolution helped. Thank you!

Sign in to comment.

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!