MATLAB: Do i have 20 of the same frames every 300-400 frames when recording video

dropped framesfrozen framesImage Acquisition ToolboxImage Processing Toolboxstreaming videowriting video

About every 300-400 frames I get 'freezing' in my video where it pauses for approximately 1 second and then jumps to the new part of the video. Upon inspection i have actually written about 20 frames of the exact same image to the file. I am using a FLIR A615 Gige camera with image processin and image acquisition toolboxes. I am thinking it is a bandwidth issue and that every so many frames get dropped or i get lost packets of data. The card and camera are capable of 1 gbps but we melted our first cable and had to splice it so my speed is down to 100mbps. Due to the reduced bandwidth I am running about 20 fps, however when i re-configured the camera from 25Hz to 12Hz i still get the same freezing albeit at different intervals. It is 16-bit data and 480×640 resolution so I thought the 12Hz would get me under the bandwidth issue. I am currently live streaming the images using peekdata (where i see it pause) and then go back and write all the data to a file at the end using getdata in a loop (which also writes in those pauses). When i use the implay function i can see that i write 19-20 of the same exact images in a row. I would think if I were losing frames it would just skip to the next frame and not write 20 of the same frames in a row. I'm thinking it may be something with the camera hardware but wanted to ask here to see if anyone experienced anything similar.
In the code attached i edited out all of the hooks I have in place that use the OPC toolbox. Basically our PLC will tell the matlab when to record & live stream vs just live stream based on sensor data in the plant.

Best Answer

  • Found that there is a register in the camera that specifies an auto sensor 'recalibration' to compensate for the camera's internal temperature (NUC). Turning off this automatic function allowed the camera to stream & record without any pauses or duplicate frames.