Query params for event snapshots not working consistently #16319
mbronstein1
started this conversation in
General
Replies: 2 comments 10 replies
-
|
Beta Was this translation helpful? Give feedback.
9 replies
-
Regarding 1: I have also been getting a lot of 404s when calling the API for snapshot.jpg. When studying the code, in some situations (if the object is currently being tracked) the API calls 'tracked_obj.get_jpg_bytes(...)'. However, that method seems to have been renamed to 'get_img_bytes(...)'. That could be the cause of the 404s. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm exploring the Frigate API and trying to determine the best approach for my specific use case. I receive event MQTT messages and fetch the clean copy of the event image to save in my database for a number of purposes, including training and being able to toggle whether I want the bbox overlayed or not in my extended application. However, I also need a cropped copy of the object temporarily for certain LLM queries. The priority is the clean copy because the bbox in the mqtt message is the bbox that is saved in the db so it should match perfectly with the image. However, this has not been as easy as I thought.
I have three different approaches here:
snapshots.bounding_box: true
andsnapshots.crop: true
and then make separate API calls to/snapshot.jpg
and/snapshot-clean.png
. However, I've found inconsistencies w/ getting the clean snapshot, with over 50% of my calls returning 404. More importantly, because the clean snapshot is saved after the original (but while still using opencv to capture the image from the stream), the bbox coordinates for the object that was received initially from the MQTT message most likely has moved since receiving the message. I need to save a clean version in my application outside of Frigate but need to overlay the bbox I receive from the mqtt message on top of that image in my app. This approach has proven unreliable./snapshot.jpg
route to make 2 calls for both cropped and non-cropped images. There are query parameters for crop and bbox, but the actual behavior is it usually returns the same image regardless. Looking through the source code, it looks like the parameters are only passed to the image if the object has not ended, in which case it gets a snapshot from the stream. However, the data required to crop and overlay the bbox for each event are present in the database for that event. So ideally, even if the event has finished, the query params should still be able to work. This seems like a bug or oversight to me./{camera}/recordings/{frame_time}/snapshot.jpg
, but the box almost always seems to be off even though the timing should be perfectly timed with the frame_time that I received with the bbox and other data from the MQTT message. (It should be noted that I'm also converting the returned Buffer to the correct dimensions that I am expecting from snapshots and/or passing a specific height param).Also, I've tried cropping the original image on my end, but I have a node backend and openCV is not a great option, and image processing libraries don't crop nearly as well as openCV. I'd prefer to use Frigate to crop.
Option 2 seems to be the best approach for getting clean and cropped versions, especially considering I need the time-specific clean copy as the main priority. There are query params for the snapshot route, so ideally those should work.
If this is a bug, I'm happy to create a discussion in the bug section. If it's expected behavior, I'm curious what the reasoning is and if it would be easy to also allow the query params to work for ended events. The route is already selecting events that match the id. It wouldn't be too hard to determine at that point if the event is ended or not and react accordingly. Either way, I think the query params should work in both situations, not just one.
Beta Was this translation helpful? Give feedback.
All reactions