waggle-sensor / pywaggle

Python SDK for integrating plugins with Waggle.
Other
6 stars 8 forks source link

Camera() has buffering issue #37

Open gemblerz opened 1 year ago

gemblerz commented 1 year ago

Camera() utilizes OpenCV's VideoCapture to get stream from camera device. The stream could be either from USB or Network via RTSP protocol. When VideoCapture opens up a stream we need to keep pulling frames from the stream to get the latest frame. If not, it would give a buffered frame with the wrong timestamp to users.

gemblerz commented 1 year ago

Current use cases of the Camera() are,

NOTE: the app is checked if it possibly falls into the buffering problem

gemblerz commented 1 year ago

After reviewing the apps, it seems there are 3 use cases,

  1. Apps need to obtain a frame to process the frame. No relationship between frames so obtaining the next frame can happen whenever needed Examples: cloud motion, water depth, surface water, and cloud cover

  2. Some apps need to process frames as fast as they can. But, the processing time can't keep up with the camera FPS. So, they want to obtain the next frame, which should be the latest, whenever they are ready to process Examples: cloud motion, smoke detection, motion detection, Nico's object detection and tracking, and object counter

  3. Some other apps need a video clip that captures frames at the camera FPS and process it Examples: traffic state and motion analysis

With the uses cases in mind, I suggest,