0

I'm running a Realsense camera, and have a flask server streaming images from /video_feed for humans to check out what's going on.

But it's for a robot application, and the robot doesn't need the video feed. It just needs the latest distance data, which is collected while running /video_feed.

So, just a JSON string, maybe a list of: -object name, distance, bounding box coordinates

What's my best option here?

Ideally I'd just have /video_feed saving the latest string to a global, application scope variable, and have /get_distance_data return that string.

A database seems overkill. But I'm not familiar enough with flask, to understand how application scope variables can be done simply.

djb
  • 1,635
  • 3
  • 26
  • 49
  • If you don't want to dump your data to a storage you can use in memory sqlite. It is fast and won't come in your way. Application scope variables are not recommended to use data that is mutable. See https://stackoverflow.com/a/32825482/4720957 – user47 Aug 14 '22 at 15:10
  • Thanks, I'm trying out sqllite. Seems like it's either that, or a multiprocessing manager and a lock. App scoped is a single annotation in Java... was hoping similar for Python. Oh well. Win some, lose some. – djb Aug 14 '22 at 16:15

0 Answers0