How do I retrieve images from the Rekor Scout® Agent?

This UUID can be used to retrieve the image from either the agent or the webserver

When you receive data from the agent, each result will contain an "best_uuid" in the metadata response.  This UUID can be used to retrieve the image from either the agent or the webserver.

The images are stored in a rolling LMDB database for efficiency.  The raw JPEG binary data is stored in LMDB files are located in /var/lib/openalpr/plateimages

Connect Directly to the Agent

The Scout agent exposes a simple web service for retrieving license plate images. Each image is referenced by the UUID that is sent along with the JSON metadata.

By default, this web server is disabled on the agent, but you can turn it on by adding "web_server_enabled = 1" to the alprd.conf file and restart the openalpr-link service.
Assuming that the daemon port is set to the default (8355), the full image is referenced with the following URL:
http://[Agent_IP]:8355/img/[plate_event_uuid].jpg

In some cases, you may prefer to retrieve a cropped image of just the license plate. This requires significantly less bandwidth than downloading the entire source image. The X and Y coordinates can be computed from the JSON metadata x/y coordinates of the license plate. The x1/y1 coordinates reference the top left of the license plate crop region, and the x2/y2 coordinates reference the bottom right. For example, assuming the crop is located at (477,258), (632,297):
http://[Agent_IP]:8355/crop/[plate_event_uuid]?x1=477&y1=258&x2=632&y2=297

You may also add the "max_width" parameter the query string to restrict the size of the resulting image.  The resize happens locally on the agent before being sent back over the network.

Retrieving data from the Web Server

The Scout web server also can act as a proxy to retrieve the images.  The images are retrieved through a WebSockets connection with the active agent.  Connect to the webserver to retrieve the image with the following URL:
https://[webserverip]/img/{image_uuid}.jpg?company_id=yourcompanyid

Accessing JPEG data from local database

This method is not recommended, because the format storage mechanism for the rolling database is complicated and the format could change in future versions without notice.  However, it is possible to access the data directly from the local LMDB database.  For example, you may use the following Python utilities to access the LMDB keys and extract a single key as a file:
https://github.com/openalpr/rollingdb/tree/opensource/utility