Cant't Change FramesPerTrigger in videoWriter

Hello,
When i try to change the number of fremes per trigger in the it just resets to 10. And when i open the 1x1 videoinput in the workspace it says 10.
See pictures for a better explantion
Is it a bug in R2020b?
i have tried the following:
Open the 'vidobj' 1x1 videoinput variable in the workspace and change there.
set(vidobj, 'FramesPerTrigger', 50); %this code
vidobj.FramesPerTrigger=50 % and this code

 Risposta accettata

Walter Roberson
Walter Roberson il 22 Apr 2021
Frames Per Trigger is not a documented property of Videowriter or of Videoreader

4 Commenti

It is, however, a property of videoinput()
https://www.mathworks.com/help/imaq/framespertrigger.html
Look at the documentation. The property is read-only while the object is started, and your code clearly has a start before you try to set the property.
Thank you for your reply.
Here is the setup part of the code and what it returns:
Summary of Video Input Object Using 'OBS-Camera'.
Acquisition Source(s): input1 is available.
Acquisition Parameters: 'input1' is the current selected source.
50 frames per trigger using the selected source.
'YUY2_1280x720' video data to be logged upon START.
Grabbing first of every 1 frame(s).
Log data to 'disk' on trigger.
Trigger Parameters: 1 'immediate' trigger(s) on START.
Status: Waiting for START.
0 frames acquired since starting.
0 frames available for GETDATA.
---------------------
What i don't understand is where the FramesPerTriger =10 comes from. As you can see above, it kinda works.
% video setup
numFrames=50;
set(vidobj, 'FramesPerTrigger', numFrames)
vidobj.FramesPerTrigger=numFrames
vidobj=videoinput('winvideo', 2, 'YUY2_1280x720')
currentLoggingMode = vidobj.LoggingMode;
set(vidobj, 'LoggingMode');
vidobj.LoggingMode = 'disk';
logfile = VideoWriter('logfile.avi', 'Motion JPEG AVI');
vidobj.DiskLogger = logfile;
writing=false ;%bool used somewhere else
The very first line of the blurry image of code that you posted is start(vidobj). Your if after that does an additional start(vidobj) even though you already started it. Then you try to change the frames per trigger. However as documented, that property is read-only while the reader is started.
Now i understand, thanks!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by