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

3 次查看(过去 30 天)
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?

采纳的回答

atharva
atharva 2023-12-15
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 个评论
Piotr Bednarz
Piotr Bednarz 2023-12-15
Hi, thanks for the answer. I want to keep preview running during acquisition. Reducing resolution helped. Thank you!

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by