Is VideoInput disklogger NumFrames correct?

3 visualizaciones (últimos 30 días)
Imran Khan
Imran Khan el 13 de En. de 2021
Editada: Imran Khan el 14 de En. de 2021
Hi,
First of all - this is the 6th time I am trying to write this post - beyond a certain number of lines, the editor becomes unresponsive in my browser (Microsoft Edge) - can't seem to post any of my code due to this reason, so I'll just have to describe what I'm seeing:
I'm using the videoinput in disklogger mode to capture frames for a certain duration from my laptop webcam. I've set up the properties (which I can't share easily due to this editor): FramesPerTrigger=1, FramesAcquiredFcnCount=1, FrameGrabInterval=1, TriggerRepeat=inf, FramesAcquiredFcn=@cameraHandler, TimerPeriod=logDuration, Timeout=logDuration+10 (to avoid timeout error), TimerFcn=@stopLogger (which stops the logging).
Separately, I've defined the FramesAcquiredFcn to grab and store the epoch time from my laptop into a vector (this should happen for each frame given the settings above):
temp=posix(datetime('now','TimeZone','UTC')); frameTimeStamps(1,frameCount)=temp;frameCount=frameCount+1;
(Ofcourse, frameCount is defined to be 1 outside the callback function).
What I'm seeing is that the videoinput object reports FramesAcquired as 580, while I only collect 579 timestamps using the FramesAcquiredFcn. So, I'm wondering whether:
1) The videoinput object is reporting an incorrect framecount, or the FramesAcquiredFcn isn't being triggered for one frame?
2) There is any way to add the epoch timestamp natively into the logged file (i.e. through the VideoWriter), without having to do this in the FramesAcquiredFcn? For my purposes, it needs to be my laptop's epochtime, because I've synced other input sensors to use my laptop's time (they don't have their own RTC).
  1 comentario
Imran Khan
Imran Khan el 14 de En. de 2021
Editada: Imran Khan el 14 de En. de 2021
Updating this question:
I wrote a script to detect when the length of the frameTimeStamps from the FramesAcquiredFcn callback is different from the videoreader's NumFrames (reading the recorded video). In some cases (e.g. Cond5Test_2 and Cond5_Test3 below), these are the same numbers - in most other cases, its off by a few, sometimes just by one or two frames.
My application requires very accurate timestamping using a common clock (hence the epoch time from laptop) - is there anyone who knows why this discrepancy might exist?
------------------------------------------
-E- frameTimeStamps length (573) and VR NumFrames (586) mismatch in file: Data\Cond1Test_1.mp4
-E- frameTimeStamps length (574) and VR NumFrames (579) mismatch in file: Data\Cond1Test_2.mp4
-E- frameTimeStamps length (569) and VR NumFrames (570) mismatch in file: Data\Cond1Test_3.mp4
-E- frameTimeStamps length (574) and VR NumFrames (576) mismatch in file: Data\Cond1Test_4.mp4
-E- frameTimeStamps length (567) and VR NumFrames (575) mismatch in file: Data\Cond1Test_5.mp4
-E- frameTimeStamps length (568) and VR NumFrames (569) mismatch in file: Data\Cond1Test_6.mp4
-E- frameTimeStamps length (579) and VR NumFrames (580) mismatch in file: Data\Cond2Test_1.mp4
-E- frameTimeStamps length (565) and VR NumFrames (568) mismatch in file: Data\Cond2Test_2.mp4
-E- frameTimeStamps length (574) and VR NumFrames (577) mismatch in file: Data\Cond2Test_3.mp4
-E- frameTimeStamps length (576) and VR NumFrames (578) mismatch in file: Data\Cond2Test_4.mp4
-E- frameTimeStamps length (573) and VR NumFrames (574) mismatch in file: Data\Cond2Test_5.mp4
-E- frameTimeStamps length (573) and VR NumFrames (579) mismatch in file: Data\InHand_6.mp4
-E- frameTimeStamps length (571) and VR NumFrames (573) mismatch in file: Data\Cond2Test_7.mp4
-E- frameTimeStamps length (570) and VR NumFrames (571) mismatch in file: Data\Cond3Test_1.mp4
-E- frameTimeStamps length (573) and VR NumFrames (576) mismatch in file: Data\Cond3Test_2.mp4
-E- frameTimeStamps length (572) and VR NumFrames (573) mismatch in file: Data\Cond3Test_4.mp4
-E- frameTimeStamps length (575) and VR NumFrames (635) mismatch in file: Data\Cond3Test_5.mp4
-E- frameTimeStamps length (1051) and VR NumFrames (1052) mismatch in file: Data\Cond4Test_2.mp4
-E- frameTimeStamps length (1052) and VR NumFrames (1053) mismatch in file: Data\Cond4Test_5.mp4
-E- frameTimeStamps length (1051) and VR NumFrames (1052) mismatch in file: Data\Cond5Test_1.mp4
-E- frameTimeStamps length (1052) and VR NumFrames (1053) mismatch in file: Data\Cond5Test_4.mp4
---------------------------------------

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by