Skip to main content

Configuration

The Blur container provides different modes of usage:

  1. CLI - As a Command Line Application processing a folder of images
  2. Server - As a server exposing a REST API.
note

CLI is the default run mode, To start the container as a server:

  1. You must include this option in the run command -e SERVER=1
  2. The server listens on port 8001 so might need to map it to a desired port on the HOST (add -p 3000:8001) or maintain the port by using host networking (add --net=host)

Common Parameters#

These parameters apply when running both as CLI or Server

-e KEY=pass (required)#

Specify the container password

Format: -e KEY=passcode
Example: -e KEY=password123

-e BLUR= (optional)#

Control the blur intensity applied. Default is 4.

  • Min Blur -e BLUR=10
  • Max Blur -e BLUR=1

-e LOGO= (optional)#

Use a different image to cover the plate area instead of blurring.
Examples:

  • Default logo(Platerecognizer): -e LOGO=
  • Custom logo:
    1. Share your logos directory by adding this option to the run command: -v /tmp/logos:/logos
    2. Any file named logo.png in your logos directory will act as the default
    3. If there is no default you should specify a different file like so -e LOGO=’/logos/logo2.png’

-e FACES= (optional)#

Used with -e BLUR. Also blur faces in the images.

-e REGIONS= (optional)#

Specify the regions used in detection.
Format: -e REGIONS=<region1,region2,region3>

Example: -e REGIONS=gb
Example: -e REGIONS=in,us

-e REGION_STRICT= (optional)#

Used with -e REGIONS. Blur only plates that match the region's format.
Format: -e REGION_STRICT=

-e DETECTION_STRICT= (optional)#

Blur only plates that have a vehicle bounding box.
Format: -e DETECTION_STRICT=

-e SHAPE= (optional)#

Used with -e FACES. Specify the shape used for blurring.
Format: -e SHAPE=<shape>
Shape can be any of the below options

  1. ellipse (default)
  2. circle
  3. square

Example: -e SHAPE=circle

-e SDK_URL= (optional)#

Use Snapshot SDK rather than CloudAPI (default).

Format: -e SDK_URL=’<protocol>://<host>:<port>’
Example: -e SDK_URL='http://localhost:8080'

Full Example:

    docker run \        -it \        -e KEY=password123 \        -v /home/brian/images:/images \        -e TOKEN=MY_TOKEN \        -e SDK_URL='http://localhost:8080' \        platerecognizer/skew-correction

-e TOKEN= (optional if using OnPremise Snapshot SDK)#

Provide the Cloud API Token

Format: -e TOKEN=###########
Example: -e TOKEN=22333f3e33r3##################

Full Example:

    docker run \        -it \        -e KEY=password123 \        -v /home/brian/images:/images \        -e TOKEN=MY_TOKEN \        -e BLUR=10 \        platerecognizer/skew-correction

-e PLATE_DETECTION_THRESHOLD=t (optional)#

Specify a threshold for plate confidence to be included in the results.
Format -e PLATE_DETECTION_THRESHOLD=<t>

The value t should be between 0.1 and 1
Example -e PLATE_DETECTION_THRESHOLD=0.7

-e FACE_DETECTION_THRESHOLD=t (optional)#

Specify a threshold for face confidence to be included in the results.
Format -e FACE_DETECTION_THRESHOLD=<t>

The value t should be between 0.1 and 1
Example -e FACE_DETECTION_THRESHOLD=0.7

-e SKIP_REGEXP=regex1,regex2 (optional)#

Exclude plates that match a list of regexes from the results.
Example -e SKIP_REGEXP=adwdwd,3344ff,sds33

CLI Parameters#

These parameters apply when running as a CLI Application

-v#

Specify the directory containing the images.

Format: -v path-to-images-folder:/images
Example: -v /home/brian/VehicleLicensePlates:/images

Server Parameters#

These parameters apply when running as a Server
The server exposes a single API endpoint at the root of the server (e.g http://localhost:8001/)
The allowed request method is POST.

tip

If you need a param set for all requests, considering using it's common equivalent.
e.g Blur all uploaded images by adding -e BLUR=4 to the run command instead of adding blur=4 to each request.

upload#

Image file to process

blur#

Blur intesity of the upload.
Example blur=3
Exclude this param if you are only interested in the unskewed bounding box (the default).

detection_rule_strict#

Only consider plates that have a vehicle bb detected

regions#

Regions to format plates in.
This param can be specified multiple times

region_strict#

Only consider plates that match regions format.
When specified, -e REGIONS= or regions param must also be specified.

skip_regexp#

Skip plates that match these regexes, can be specified multiple times.
This param can be specified multiple times
Example:

Detected plate = KAXZ 7226882

Regexes that will exclude this plate:

KAXZ 7226882KAXK7226882Z 72268

Regexes that won't exclude this plate:

KXZKAXZ 7226882555AX 82

faces#

Process faces too, Exclude if you are only interestade in plates (the default). Example faces=true

logo#

Use a logo for blurring.
Example logo=1

threshold_d#

Skip any detection whose confidence is lower.

Specifying any of these params overrides any set as an env var in the run command.
The response is in JSON format. Check for error key existence in responses to verify success of the request.

Command Examples#

  1. Providing a different Snapshot SDK URL:

    docker run \    -it \    -e KEY=password123 \    -v /home/brian/images:/images \    -e TOKEN=MY_TOKEN \    -e SDK_URL='http://localhost:8080' \    platerecognizer/skew-correction
    
  2. Example of providing blur intensity of 7:

    docker run \    -it \    -e KEY=password123 \    -v /home/brian/images:/images \    -e TOKEN=MY_TOKEN \    -e BLUR=7 \    platerecognizer/skew-correction
  3. Example of running as a server and uploading images using the REST API. Note: that this only gives back the unskewed bounding box(s) and so you’ll need to perform blurring externally.

    docker run \    -it \    -p 3000:8001 \    -e KEY=password123 \    -e SERVER=1 \    platerecognizer/skew-correction
  4. Example of using CURL to send an image to blur for the skew-corrected bounding box.

    curl -F 'upload=@/tmp/car.jpg' http://localhost:3000/

    Sample API response:

    {"faces": [],"results": [    {    "polygon": [        [        157.375,        494.484375        ],        [        272.546875,        544.453125        ],        [        268.890625,        581.625        ],        [        153.109375,        531.65625        ]    ],    "result": {        "box": {        "xmax": 276,        "xmin": 146,        "ymax": 576,        "ymin": 481        },        "candidates": [        {            "plate": "nhk552",            "score": 0.899        }        ],        "dscore": 0.9252,        "plate": "nhk552",        "region": {        "code": "gb",        "score": 0.985        },        "score": 0.899,        "vehicle": {        "box": {            "xmax": 914,            "xmin": 68,            "ymax": 643,            "ymin": 103        },        "score": 0.834,        "type": "Sedan"        }    }    }]}

    When using the API, Face bounding boxes won't be included by default. Use any of these 2 options to include them:

    1. Include the env variable -e FACES=1 when running the container
    2. Include this param faces=true when making an API call

    Sample API response with faces:

    {"faces": [    {    "box": {        "xmax": 326,        "xmin": 300,        "ymax": 137,        "ymin": 100    },    "score": 0.7088521122932434    },    {    "box": {        "xmax": 104,        "xmin": 90,        "ymax": 100,        "ymin": 83    },    "score": 0.6313210725784302    },    {    "box": {        "xmax": 52,        "xmin": 39,        "ymax": 114,        "ymin": 98    },    "score": 0.5979868769645691    },    {    "box": {        "xmax": 37,        "xmin": 20,        "ymax": 113,        "ymin": 93    },    "score": 0.5521909594535828    },    {    "box": {        "xmax": 518,        "xmin": 502,        "ymax": 135,        "ymin": 117    },    "score": 0.5192767381668091    },    {    "box": {        "xmax": 10,        "xmin": 0,        "ymax": 97,        "ymin": 85    },    "score": 0.3350403606891632    }],"results": [    {    "polygon": [        [        157.375,        494.484375        ],        [        272.546875,        544.453125        ],        [        268.890625,        581.625        ],        [        153.109375,        531.65625        ]    ],    "result": {        "box": {        "xmax": 276,        "xmin": 146,        "ymax": 576,        "ymin": 481        },        "candidates": [        {            "plate": "nhk552",            "score": 0.899        }        ],        "dscore": 0.9252,        "plate": "nhk552",        "region": {        "code": "gb",        "score": 0.985        },        "score": 0.899,        "vehicle": {        "box": {            "xmax": 914,            "xmin": 68,            "ymax": 643,            "ymin": 103        },        "score": 0.834,        "type": "Sedan"        }    }    }]}