Blur API Reference
Welcome to the Plate Recognizer Blur API! Use our API to blur license plates and faces in images. Check detailed instructions on how to install Blur SDK. Blur forwards images to Snapshot API then uses the detected plate bounding box to perform accurate blurring. Plate Recognizer Blur is only available to registered users with blur enabled. Sign up for a Free Trial to get an API Token.
Blur Cloud API​
Authentication​
All API calls must include an Authorization header containing the API Token in below format:
Authorization: Token YOUR_API_TOKEN
For the commands below, make sure to replace YOUR_API_TOKEN
with your API Token. For example, Authorization: Token 3a0effff73919f898b69ac65a32dc12347769564
.
Get your token from, here.
Blur Plates and Faces in an Image​
This snapshot API endpoint blurs number plates and human faces in an image.
- To programmatically process a bunch of images in a folder, refer to our Blur Images Guide.
HTTP Request​
POST https://blur.platerecognizer.com/v1/blur
The CORS
policy of this endpoint does not allow requests from all origins.
POST Parameters​
Parameter | Required | Description |
---|---|---|
upload | Yes | The file to be uploaded. optional if upload_url param is present. |
upload_url | No | The url of file to be uploaded. Given priority over upload param. |
regions | No | Regions forwarded to Snapshot |
skip_regexp | No | Override configuration SKIP_REGEXP. Can be specified multiple times. |
faces | Conditionally | Override configuration FACES. Either faces or plates, or both, are required. |
plates | Conditionally | Override configuration PLATES. Either plates or faces, or both, are required. |
logo | No | Logo file or a file path in /logos directory. Overrides configuration LOGO. Setting an empty string param disables env LOGO |
config | No | Extends configuration CONFIG. |
et | No | Exclude a percentage margin of image height at the top. |
el | No | Exclude a percentage margin of image width at the left. |
eb | No | Exclude a percentage margin of image height at the bottom. |
er | No | Exclude a percentage margin of image width at the right. |
xmin | No | Excluded region bounding box xmin. |
ymin | No | Excluded region bounding box ymin. |
xmax | No | Excluded region bounding box xmax. |
ymax | No | Excluded region bounding box ymax. |
split | No | Split image into horizontal chunks before blur. Use on panoramic images |
overlap | No | Overlap percentage if splitting image. Default is 20. |
camera_id | No | Override configuration CAMERA_ID. |
snapshot_filename | No | Custom file name sent to Snapshot, Default is the uploaded file name. |
copy_metadata | No | Override configuration COPY_METADATA. Copies metadata from the input image to the blurred image if set to true |
face_max_resolution | No | Override configuration FACE_MAX_RESOLUTION. |
- Shell
- Python
# Process an image from a URL
curl -H "Authorization: Token YOUR_API_TOKEN" -d "upload_url=https://app.platerecognizer.com/static/demo.jpg" -d "faces=10" -d "plates=10" https://blur.platerecognizer.com/v1/blur
# Get back unskewed bounding box in JSON format but skip burring
curl -H "Authorization: Token YOUR_API_TOKEN" -d "upload_url=https://app.platerecognizer.com/static/demo.jpg" https://blur.platerecognizer.com/v1/blur
# Download a test picture
curl -o /tmp/car.jpg https://app.platerecognizer.com/static/demo.jpg
# Upload to API for blurring
curl -H "Authorization: Token YOUR_API_TOKEN" -F "upload=@/tmp/car.jpg" -F "faces=10" -F "plates=10" https://blur.platerecognizer.com/v1/blur
# Upload image and logo
curl -H "Authorization: Token YOUR_API_TOKEN" -F "upload=@/tmp/car.jpg" -F "logo=@/tmp/logo.jpg" -F "faces=10" -F "plates=10" https://blur.platerecognizer.com/v1/blur
import requests
import base64
# Download a test picture
# curl -o /tmp/car.jpg https://app.platerecognizer.com/static/demo.jpg
files = {
'upload': open('/tmp/car.jpg', 'rb'),
#'logo': open('/tmp/logo.jpg', 'rb'), # Addition of a logo, this item is optional
}
response = requests.post(
'https://blur.platerecognizer.com/v1/blur',
files=files,
data={
'plates': 10,
'faces': 10,
#'upload_url': 'https://app.platerecognizer.com/static/demo.jpg' # If necessary, using an image via URL
},
headers={"Authorization": "Token YOUR_API_TOKEN"})
if response.status_code == 200:
res_data = response.json()
if res_data.get('blur') is None:
print('Blur on server is not enabled')
print(res_data)
else:
with open('/tmp/blur-car.jpg', 'wb') as f:
base64_encoded_data = response.json()['blur']['base64']
decoded_bytes = base64.b64decode(base64_encoded_data)
f.write(decoded_bytes)
else:
print(f'Error: {response.text}')
print(response.text)
Response​
Accurate Polygon points around the plates and faces in JSON format.
{
"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": {}
}
],
"blur": {
"content_type": "image/jpeg",
"filename": "demo.jpg",
"base64": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIB..."
}
}
Attribute | Description |
---|---|
faces/box | Face detection bounding box |
faces/score | Face detection score between 0-1. Closer to 0 means low confidence, Closer to 1 means high confidence |
plates/polygon | Accurate plate bounding box polygon points |
plates/result | Original plate detection result from Snapshot |
blur | Blurred image result, null if blurring on the server is disabled. Enable by include faces or plates params or set a blur intensity greater than 0 in config FACES or PLATES. |
blur/filename | Blur filename |
blur/content_type | Response image content type. null if unknown |
blur/base64 | Blurred image in base64 |
Errors​
Code | Meaning |
---|---|
400 | An error occurred, check error in JSON response body for more info. |
403 | Refer to Snapshot 403 Error |
413 | Refer to Snapshot 413 Error |
429 | Refer to Snapshot 429 Error |
Sample Error Response
{"error":"An Error Occurred ... "}
Blur On-Premise API​
Blur service is also available on-premise. Get started with the SDK. It has a similar interface as the blur API and hosted locally.
Are you using the on-premise API from a different device? Make sure that your firewall allows it. For example, you can disable the Windows Defender firewall to check if it is blocking the API calls.
Blur API​
HTTP Request​
POST http://localhost:8001
The CORS
policy of this endpoint does not allow requests from all origins.
This endpoint has no maximum calls per second contrary to our Cloud API.
Parameters​
All the parameters from blur cloud API.
- Shell
- Python
# Process an image from a URL
curl -d "upload_url=https://app.platerecognizer.com/static/demo.jpg" -d "faces=10" -d "plates=10" http://localhost:8001/
# Get back unskewed bounding box in JSON format and skip burring
curl -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" -F "faces=10" -F "plates=10" http://localhost:8001/
# Upload image and logo
curl -F "upload=@/tmp/car.jpg" -F "logo=@/tmp/logo.jpg" -F "faces=10" -F "plates=10" http://localhost:8001/
import requests
import base64
# Download a test picture
# curl -o /tmp/car.jpg https://app.platerecognizer.com/static/demo.jpg
files = {
'upload': open('/tmp/car.jpg', 'rb'),
#'logo': open('/tmp/logo.jpg', 'rb'), # Addition of a logo, this item is optional
}
response = requests.post(
'http://localhost:8001/',
files=files,
data={
'plates': 10,
'faces': 10,
#'upload_url': 'https://app.platerecognizer.com/static/demo.jpg' # If necessary, using an image via URL
},
headers={"Authorization": "Token YOUR_API_TOKEN"})
if response.status_code == 200:
res_data = response.json()
if res_data.get('blur') is None:
print('Blur on server is not enabled')
print(res_data)
else:
with open('/tmp/blur-car.jpg', 'wb') as f:
base64_encoded_data = response.json()['blur']['base64']
decoded_bytes = base64.b64decode(base64_encoded_data)
f.write(decoded_bytes)
else:
print(f'Error: {response.text}')
print(response.text)
SDK Version​
Show version and Snapshot version
HTTP Request​
GET http://localhost:8001/info/
JSON Response​
Returns the SDK version and forwards Snapshot response from info.
Returns null
for Snapshot incase unreachable, errored or if using snapshot Cloud.
{
"version": "1.0.2",
"snapshot":{
"version": "1.3.8",
"license_key": "XXX",
"total_calls": 2500,
"usage": {"calls": 10},
"webhooks": []
}
}