Blur Plates and Faces in Image Files
Blur Plates and Faces in Image Files
There are two ways to use Blur.
Approach 1: Command Line
Process images in a single folder recursively then exit. Minimum required command options:
Command Option | Description |
---|---|
-e TOKEN=TOKEN | Snapshot Cloud API token |
-e LICENSE_KEY=LICENSE_KEY | Snapshot SDK license key |
-v /folder/with/images:/images | Mount Images folder |
Start the program with:
docker run -it \
-e TOKEN=TOKEN \
-e LICENSE_KEY=LICENSE_KEY \
-v /folder/with/images:/images \
platerecognizer/skew-correction
Blur will send images in the folder to Snapshot API and use the detected plate bounding box to perform blurring. New files will be created in the same folder with blur- pre-pended to the original file names. More configuration options are available
Approach 2: REST API
Start the API Server
Process images uploaded using the REST API. Minimum required command options:
Command Option | Description |
---|---|
-e TOKEN=TOKEN | Snapshot Cloud API token |
-e LICENSE_KEY=LICENSE_KEY | Snapshot SDK license key |
-e SERVER=1 | Run as an API Server |
-p 8001:8001 | Server port. Optional if using host networking |
docker run -it \
-p 8001:8001 \
-e TOKEN=TOKEN \
-e LICENSE_KEY=LICENSE_KEY \
-e SERVER=1 \
platerecognizer/skew-correction
Upload Images
- Allowed request method is POST.
- Any errors in processing will return a status code of
400
- Server listening port is 8001
# Process an image from a URL
curl -o /tmp/blur-car.jpg -d 'upload_url=https://app.platerecognizer.com/static/demo.jpg' http://localhost:8001/
# Download a test picture
curl -o /tmp/car.jpg https://app.platerecognizer.com/static/demo.jpg
# Upload to API for blurring
curl -F 'upload=@/tmp/car.jpg' -o /tmp/blur-car.jpg http://localhost:8001/
Response Format
The response is a JSON of accurate polygon points around the plates and faces for blurring the image externally.
Attribute | Description |
---|---|
faces/box | Face detection bounding box |
faces/score | Face detection confidence level |
plates/polygon | Accurate plate polygon |
plates/result | Original plate detection result from Snapshot |
{
"faces": [
{
"box": {
"xmax": 326,
"xmin": 300,
"ymax": 137,
"ymin": 100
},
"score": 0.7088521122932434
}
],
"plates": [
{
"polygon": [
[
157.375,
494.484375
],
[
272.546875,
544.453125
],
[
268.890625,
581.625
],
[
153.109375,
531.65625
]
],
"result": {}
}
]
}
To blur an image with the API, add the blur
param to the API call or enable blurring when running the container.
The response is a binary output of the blurred image with a format similar to the input.
More configuration options are available