### Start Development Server - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Starts the Next.js development server using pnpm. ```bash pnpm run dev ``` -------------------------------- ### Build and Install Docker Extension Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/dd-extension/README.md Commands to build the extension image and install it into the Docker Desktop environment. ```shell docker buildx build -t platerecognizer/installer:latest . --load docker extension install platerecognizer/installer:latest ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/platerec_installer/build.md Command to install all required Python dependencies for the project using the manage script. ```bash python manage.py install -r requirements.txt ``` -------------------------------- ### Build PyInstaller Bootloader and Install Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/platerec_installer/build.md Commands to compile the custom PyInstaller bootloader and install the package into the current Python environment. ```bash python ./waf all --target-arch=64bit python ./setup.py install ``` -------------------------------- ### Configure Environment Variables - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Copies the example environment file and provides examples of essential environment variables for database connection, webhook request limits, and Cloudflare R2 storage configuration. ```bash cp .env.example .env ``` ```env DATABASE_URL="postgresql://user:password@localhost:5432/your_database?schema=public" NEXT_PUBLIC_MAX_WEBHOOK_REQUESTS=100 CLOUDFLARE_R2_ACCOUNT_ID=your_account_id CLOUDFLARE_R2_ACCESS_KEY_ID=your_access_key_id CLOUDFLARE_R2_SECRET_ACCESS_KEY=your_secret_access_key CLOUDFLARE_R2_BUCKET_NAME=your_bucket_name CLOUDFLARE_R2_PUBLIC_DOMAIN=https://your-bucket-name.r2.dev ``` -------------------------------- ### Start PostgreSQL with Docker - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Starts a PostgreSQL database instance using a Docker container. It maps the default PostgreSQL port and sets up basic user, password, and database name. ```bash docker run --name license-db -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -e POSTGRES_DB=your_database -p 5432:5432 -d postgres ``` -------------------------------- ### Configure Frontend Development Environment Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/dd-extension/README.md Commands to start the frontend development server and link it to the Docker extension for hot reloading. ```shell cd ui npm install npm run dev docker extension dev ui-source platerecognizer/installer:latest http://localhost:3000 ``` -------------------------------- ### Install Dependencies - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Installs project dependencies using pnpm. Includes a command to install pnpm globally if it's not already present. ```bash pnpm install npm install -g pnpm ``` -------------------------------- ### Install Frontend Dependencies with Bun Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/gate-controller/README.md Installs all necessary Node.js packages for the frontend using the Bun package manager. This command reads the dependencies listed in the package.json file. ```sh bun install ``` -------------------------------- ### Install Requirements Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/stream/stream_light_update/README.md Installs all necessary Python packages listed in the requirements.txt file. This is a prerequisite for running the subsequent update scripts. ```shell pip install -r requirements.txt ``` -------------------------------- ### Launch Prisma Studio - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Starts Prisma Studio, a GUI tool for managing and inspecting the application's database during development. ```bash pnpm prisma studio ``` -------------------------------- ### C# Plate Recognizer Console Application Usage Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/csharp/README.md Provides command-line examples for running the Plate Recognizer .Net console application. It covers getting help, uploading an image file to the cloud API, and uploading an image as a Base64 encoded string. ```shell # Get help dotnet run # Uplod to cloud API dotnet run --token=4805bee122### --file=../assets/demo.jpg # Upload the image as Base64 dotnet run --token=4805bee122### --file=../assets/demo.jpg --base64 ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/stream-parkpow-webhook-worker/README.md Installs project dependencies using the pnpm package manager. This is a standard step for setting up the development environment. ```sh pnpm install ``` -------------------------------- ### Install and Run License Plate Recognition Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/README.md Instructions for cloning the repository, installing dependencies, and executing the primary plate recognition script on an image file. ```bash git clone https://github.com/parkpow/deep-license-plate-recognition.git cd deep-license-plate-recognition pip install requests pillow python plate_recognition.py --api-key MY_API_KEY /path/to/vehicle.jpg ``` -------------------------------- ### Configure PyInstaller Spec Paths Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/platerec_installer/build.md Example diff showing how to update the site_packages and pathex variables in the platerec_installer.spec file to point to local directories. ```diff --- a/docker/platerec_installer.spec +++ b/docker/platerec_installer.spec @@ -10,8 +10,8 @@ import sys block_cipher = None if sys.platform == 'win32': - site_packages = 'C:/Python37/Lib/site-packages/' - pathex = ['Z:\\src'] + site_packages = 'C:/Users/hp/AppData/Local/Programs/Python/Python37/Lib/site-packages/' + pathex = ['C:\\Users\\hp\\OneDrive\\Desktop\\deep-license-plate-recognition\\docker'] else: site_packages = '/root/.pyenv/versions/3.7.5/lib/python3.7/site-packages/' pathex = ['/src'] ``` -------------------------------- ### Run with Docker Compose - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Builds and starts the application and its dependencies (like PostgreSQL) using Docker Compose in detached mode. Also includes commands to view logs and stop the containers. ```bash docker-compose up -d --build docker-compose logs -f docker-compose down docker-compose down -v ``` -------------------------------- ### Run Middleware with Docker Compose Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/middleware/README.md Command to start both the middleware and the stream service simultaneously using a docker-compose configuration. ```bash docker compose up ``` -------------------------------- ### Run Application in Development Mode Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/gate-controller/README.md Starts the Next.js development server and the Tauri application simultaneously, enabling hot-reloading for a streamlined development experience. This command is used for local development and testing. ```sh bun tauri dev ``` -------------------------------- ### Start Local Cloudflare Worker with wrangler dev Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/stream-parkpow-webhook-worker/README.md Starts a local development server for the Cloudflare Worker, allowing for local testing and debugging before deployment. This command uses the wrangler CLI. ```sh wrangler dev ``` -------------------------------- ### Clone Repository and Run Benchmark Script Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/benchmark/benchmark_snapshot.md This command sequence clones the deep-license-plate-recognition repository and executes the snapshot SDK benchmark script. It requires Git and Python to be installed. The script will perform API calls and measure performance. ```shell git clone https://github.com/parkpow/deep-license-plate-recognition.git cd deep-license-plate-recognition python -m benchmark.benchmark_snapshot ``` -------------------------------- ### Generate Single File Executable Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/platerec_installer/build.md Command to trigger the PyInstaller build process to generate a single-file executable from the installer script. ```bash pyinstaller --onefile platerec_installer.py ``` -------------------------------- ### Manage SDK Docker Containers Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Interactive command to launch the Plate Recognizer SDK Manager. This utility handles installation, updates, uninstallation, and configuration of Docker containers across various hardware platforms. ```bash python docker/sdk_manager/PlateRec_SDK_Manager.py ``` -------------------------------- ### Process Images from FTP/SFTP Server Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/README.md This section describes how to use the `ftp_and_sftp_processor.py` script to process images stored on an FTP or SFTP server. It covers basic setup, protocol selection, and optional arguments for deleting processed images. ```APIDOC ## Process Images from FTP/SFTP Server ### Description This script allows you to automatically process license plate images stored on an FTP or SFTP server. It can fetch images, send them for processing, and optionally remove them after successful processing. ### Method Command-line execution of a Python script. ### Endpoint N/A (Local script execution) ### Parameters #### Command Line Arguments - **--api-key** (string) - Required - Your Plate Recognizer API key. - **--hostname** (string) - Required - The hostname or IP address of the FTP/SFTP server. - **--ftp-user** (string) - Required - The username for connecting to the FTP/SFTP server. - **--ftp-password** (string) - Required - The password for the FTP/SFTP user. - **--folder** (string) - Required - The path to the folder on the server containing images to process. - **--protocol** (string) - Optional - The protocol to use. Choices: 'ftp' (default) or 'sftp'. - **--delete** (boolean) - Optional - If set, images will be removed from the server after processing. Can also accept a timeout in seconds. - **--port** (integer) - Optional - The port number for the FTP/SFTP connection. - **--regions** (string) - Optional - Specify regions for license plate matching. - **--sdk-url** (string) - Optional - URL to a self-hosted SDK. - **--timestamp** (string) - Optional - Timestamp argument. - **--output-file** (string) - Optional - Path to save the processing results. - **--interval** (integer) - Optional - Interval in seconds to periodically fetch new images. - **--camera-id** (string) - Optional - Name of the source camera. - **--cameras-root** (string) - Optional - Root folder for dynamic cameras. - **--format** (string) - Optional - Format of the result. Choices: 'json' (default) or 'csv'. - **--mmc** (boolean) - Optional - Enable Make and Model prediction (SDK only). - **--pkey** (string) - Optional - Path to the SFTP private key file. ### Request Example ```bash python ftp_and_sftp_processor.py --api-key YOUR_API_KEY --hostname ftp.example.com --ftp-user ftpuser --ftp-password ftpPassword --folder /images/to/process --protocol sftp --delete ``` ### Response Results are typically saved to a file or printed to the console, depending on the arguments provided. #### Success Response - **Processing Status** (string) - Indicates if images were processed successfully. - **Results** (object/array) - Contains the license plate recognition data for each image. #### Response Example ```json { "results": [ { "plate": "ABC1234", "vehicle_make": "Toyota", "vehicle_model": "Camry", "vehicle_color": "Blue", "confidence": 0.95, "image_path": "/images/to/process/image1.jpg" } ] } ``` ``` -------------------------------- ### Perform License Plate Recognition via Cloud API Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Demonstrates how to send image files to the Plate Recognizer Cloud API using curl. Includes examples for basic recognition, region-specific matching, vehicle make/model/color (MMC) detection, and strict configuration settings. ```bash curl -X POST "https://api.platerecognizer.com/v1/plate-reader/" \ -H "Authorization: Token MY_API_KEY" \ -F "upload=@/path/to/vehicle.jpg" curl -X POST "https://api.platerecognizer.com/v1/plate-reader/" \ -H "Authorization: Token MY_API_KEY" \ -F "upload=@/path/to/vehicle.jpg" \ -F "regions=us-ca" \ -F "regions=us-ny" curl -X POST "https://api.platerecognizer.com/v1/plate-reader/" \ -H "Authorization: Token MY_API_KEY" \ -F "upload=@/path/to/vehicle.jpg" \ -F "mmc=true" curl -X POST "https://api.platerecognizer.com/v1/plate-reader/" \ -H "Authorization: Token MY_API_KEY" \ -F "upload=@/path/to/vehicle.jpg" \ -F 'config={"region":"strict"}' ``` -------------------------------- ### Monitor Stream Health via REST API Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Commands to start the stream monitoring server and query its status endpoint. The monitor tracks container health and camera status, returning JSON responses indicating active status and camera connectivity. ```bash python stream_monitor.py -c stream -i 30 -d 120 curl http://localhost:8001 ``` -------------------------------- ### Java API Request with Unirest Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt This Java code snippet demonstrates how to send an image file to the Plate Recognizer API using the Unirest library. It shows how to authenticate with an API key, upload an image, specify regions, and handle the JSON response. It also includes an example of interacting with a local SDK endpoint. ```java // Maven dependency in pom.xml: // // com.konghq // unirest-java // 3.1.00 // standalone // import kong.unirest.HttpResponse; import kong.unirest.JsonNode; import kong.unirest.Unirest; import java.io.File; public class PlateRecognizer { private static final String API_URL = "https://api.platerecognizer.com/v1/plate-reader/"; private static final String SDK_URL = "http://localhost:8080/v1/plate-reader/"; public static JsonNode recognizePlate(String apiKey, String imagePath, String[] regions) { var request = Unirest.post(API_URL) .header("Authorization", "Token " + apiKey) .field("upload", new File(imagePath)); if (regions != null) { for (String region : regions) { request.field("regions", region); } } HttpResponse response = request.asJson(); return response.getBody(); } public static JsonNode recognizePlateSDK(String imagePath) { HttpResponse response = Unirest.post(SDK_URL) .field("upload", new File(imagePath)) .asJson(); return response.getBody(); } public static void main(String[] args) { String apiKey = "MY_API_KEY"; String imagePath = "/path/to/vehicle.jpg"; String[] regions = {"us-ca", "us-ny"}; // Cloud API JsonNode result = recognizePlate(apiKey, imagePath, regions); System.out.println(result.toPrettyString()); // Local SDK JsonNode sdkResult = recognizePlateSDK(imagePath); System.out.println(sdkResult.toPrettyString()); } } ``` -------------------------------- ### Set Up Database with Prisma - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Generates the Prisma client and applies database migrations to set up the necessary tables for the application. ```bash npx prisma generate npx prisma migrate dev --name init ``` -------------------------------- ### C# Plate Recognizer Quick Build and Run Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/csharp/README.md Illustrates a quick command-line execution for the Plate Recognizer .Net console application, demonstrating how to build and run the application with specific parameters like token, file path, and camera ID. ```shell dotnet run --token=4805bee122### --file=../assets/demo.jpg --camera=camera46363 ``` -------------------------------- ### GET / (Stream Monitor) Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Retrieves the current health status of the Stream container and connected cameras. ```APIDOC ## GET / ### Description Checks if the Stream monitoring service is active and reports the status of individual cameras. ### Method GET ### Endpoint http://localhost:8001 ### Response #### Success Response (200) - **active** (boolean) - Indicates if the Stream container is running. - **cameras** (object) - Map of camera IDs to their current status (e.g., 'running' or 'offline'). #### Response Example { "active": true, "cameras": { "camera-1": { "status": "running" } } } ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/gate-controller/README.md Clones the GateController repository from GitHub and navigates into the project directory. This is the initial step for setting up the development environment. ```sh git clone https://github.com/parkpow/deep-license-plate-recognition.git cd gate-controller ``` -------------------------------- ### Build Application for Production Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/gate-controller/README.md Compiles the Rust backend and bundles the frontend to create a distributable application executable for the target platform. This command is used to prepare the application for deployment. ```sh bun tauri build ``` -------------------------------- ### Run ParkPow Performance Benchmark Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/benchmark/benchmark_parkpow.md Commands to clone the repository and execute the benchmark script to measure system performance. ```shell git clone https://github.com/parkpow/deep-license-plate-recognition.git cd deep-license-plate-recognition python -m benchmark.benchmark_parkpow ``` -------------------------------- ### Test Genetec Webhook Endpoint Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/genetec/README.md Tests the Genetec webhook endpoint using cURL to send a POST request with JSON data. This is useful for verifying the integration setup. ```shell curl -vX POST http://localhost:8002/ -d @../../snapshot-middleware/test/Genetec.txt --header "Content-Type: application/json" ``` -------------------------------- ### Build and Run Middleware with Docker Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/middleware/README.md Commands to build the Docker image for the middleware and execute it. The run command maps the container port to the host and utilizes an environment file for configuration. ```bash docker build -t webhook-middleware . docker run --env-file .env -p 8002:8002 webhook-middleware ``` -------------------------------- ### License Plate Recognition API Response Format Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/README.md Example of the JSON response structure returned by the API, containing bounding box coordinates, the identified plate string, and confidence scores. ```json [ { "version": 1, "results": [ { "box": { "xmin": 85, "ymin": 85, "ymax": 211, "xmax": 331 }, "plate": "ABC123", "score": 0.904, "dscore": 0.92 } ], "filename": "car.jpg" } ] ``` -------------------------------- ### Build and Run AXIS LPR Integration Container Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/axis-lpr/README.md Commands to build the Docker image from the source and execute the container with required environment variables for ParkPow connectivity. ```bash docker build --tag parkpow-axis-lpr . docker run --rm -t -p 5000:5000 -e PP_URL=https://myparkpow.com -e TOKEN=1234 parkpow-axis-lpr ``` -------------------------------- ### Build Docker Image for Hikvision LPR Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/hikvision_lpr/README.md Builds the Docker image required to process and forward Hikvision LPR data. This command uses the Dockerfile in the current directory to create an image tagged as 'parkpow-hikvision-lpr'. ```bash docker build --tag parkpow-hikvision-lpr . ``` -------------------------------- ### Deploy On-Premise SDK via Docker Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Provides commands to pull and run the Plate Recognizer SDK container on various hardware platforms including standard Linux, NVIDIA GPU-enabled systems, Raspberry Pi, and NVIDIA Jetson. ```bash docker run --rm -t -p 8080:8080 -v license:/license -e TOKEN=MY_API_TOKEN -e LICENSE_KEY=MY_LICENSE_KEY platerecognizer/alpr docker run --rm -t -p 8080:8080 --runtime nvidia -v license:/license -e TOKEN=MY_API_TOKEN -e LICENSE_KEY=MY_LICENSE_KEY platerecognizer/alpr-gpu docker run --rm -t -p 8080:8080 -v license:/license -e TOKEN=MY_API_TOKEN -e LICENSE_KEY=MY_LICENSE_KEY platerecognizer/alpr-raspberry-pi nvidia-docker run --rm -t -p 8080:8080 --runtime nvidia -v license:/license -e TOKEN=MY_API_TOKEN -e LICENSE_KEY=MY_LICENSE_KEY platerecognizer/alpr-jetson ``` -------------------------------- ### Build Docker Image for Verkada-ParkPow Integration Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/verkada-lpr-webhooks/on_premise/README.md Builds a Docker image tagged as platerecognizer/verkada-parkpow from the current directory. This image contains the necessary components to process Verkada webhook events. ```bash docker build --tag platerecognizer/verkada-parkpow . ``` -------------------------------- ### Process Events to ParkPow using Docker Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/genetec/README.md Runs the Docker container to process Genetec events and forward them to ParkPow. Requires a ParkPow token and optionally a URL. ```shell docker run --rm -t \ --net=host \ -e LOGGING=DEBUG \ platerecognizer/genetec-integration \ parkpow \ --token=pass \ --url='http://localhost:8000' ``` -------------------------------- ### Use Local SDK for Image Processing Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Processes images using a local SDK instance. Requires the SDK URL and the path to the image file. ```bash python plate_recognition.py --sdk-url http://localhost:8080 /path/to/vehicle.jpg ``` -------------------------------- ### Publish Docker Extension Image Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/dd-extension/README.md Builds and pushes the extension image to a registry for multiple architectures. ```shell docker buildx build --push --platform=linux/amd64,linux/arm64 --tag=platerecognizer/installer:0.0.1 . ``` -------------------------------- ### Run Docker Container for LPR Forwarding Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/hikvision_lpr/README.md Runs the Docker container for the Hikvision LPR integration. It maps port 5000, sets the ParkPow URL and authentication token via environment variables, and ensures the container is removed upon exit. ```bash docker run --rm -t -p 5000:5000 -e PP_URL=https://myparkpow.com -e TOKEN=1234 parkpow-hikvision-lpr ``` -------------------------------- ### Process Image with Engine Configuration Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Processes an image with custom engine configuration settings. Requires an API key, engine configuration JSON, and image path. ```bash python plate_recognition.py --api-key MY_API_KEY --engine-config '{"region":"strict"}' /path/to/vehicle.jpg ``` -------------------------------- ### Clone Repository - Bash Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/webhook_preview/README.md Clones the deep-license-plate-recognition repository from GitHub and navigates into the webhook_preview directory. ```bash git clone https://github.com/parkpow/deep-license-plate-recognition.git cd /webhooks/webhook_preview ``` -------------------------------- ### Build Docker Image for Genetec Integration Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/genetec/README.md Builds the Docker image for the Genetec integration project. This image is a prerequisite for processing events. ```shell docker build --tag platerecognizer/genetec-integration . ``` -------------------------------- ### Batch Process Images with Blur API SDK Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Processes a folder of images using the Blur API SDK. Supports local SDK usage, exclusion zones, explicit exclusion boxes, image splitting, and output directory customization. ```bash # Process a folder of images python blur/main.py --api-key MY_API_KEY --images /path/to/images/ ``` ```bash # Use local blur SDK python blur/main.py -b http://localhost:8001/v1/blur --images /path/to/images/ ``` ```bash # With margin exclusions (10% from each edge) python blur/main.py --api-key MY_API_KEY --images /path/to/images/ \ --et 0.1 --el 0.1 --eb 0.1 --er 0.1 ``` ```bash # With explicit exclusion box coordinates python blur/main.py --api-key MY_API_KEY --images /path/to/images/ \ --xmin 100 --ymin 100 --xmax 200 --ymax 200 ``` ```bash # Split large images for better detection python blur/main.py --api-key MY_API_KEY --images /path/to/images/ \ --split 3 --overlap 10 ``` ```bash # Output to different directory with metadata preservation python blur/main.py --api-key MY_API_KEY --images /path/to/images/ \ --output /path/to/output/ --copy-metadata --resume ``` -------------------------------- ### Run Pytest for LPR Integration Tests Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/hikvision_lpr/README.md Executes integration tests for the LPR forwarding service using pytest. This requires setting the ParkPow URL and authentication token as environment variables before running the tests. ```bash export PP_URL=https://myparkpow.com export TOKEN=1234 python -m pytest ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/middleware/README.md Required configuration settings for the .env file, including API credentials for stream integration and optional webhook receiver settings. ```ini STREAM_LICENSE_KEY=your_license_key_here STREAM_API_TOKEN=your_api_token_here WEBHOOK_URL=https://app.parkpow.com/api/v1/webhook-receiver/ PARKPOW_TOKEN=your_parkpow_token ``` -------------------------------- ### C++ API Request with libcurl Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt This C++ code snippet demonstrates how to send an image file to the Plate Recognizer API using the libcurl library. It handles API authentication, file uploads, optional configuration modes (redaction, fast), and JSON response parsing. It requires libcurl and a JSON library for compilation. ```cpp #include "curl/curl.h" #include "json/json/json.h" #include #include #include using namespace std; namespace { size_t callback(const char* in, size_t size, size_t num, string* out) { const size_t totalBytes(size * num); out->clear(); out->append(in, totalBytes); return totalBytes; } } Json::Value sendRequest(string auth_token, string fileName, string mode = "") { curl_global_init(CURL_GLOBAL_ALL); CURL *hnd = curl_easy_init(); curl_mime *form = curl_mime_init(hnd); // Set API endpoint curl_easy_setopt(hnd, CURLOPT_URL, "https://api.platerecognizer.com/v1/plate-reader/"); // Add image file curl_mimepart *field = curl_mime_addpart(form); curl_mime_name(field, "upload"); curl_mime_filedata(field, fileName.c_str()); // Add config mode if specified (redaction or fast) if (mode.length()) { curl_mimepart *part = curl_mime_addpart(form); curl_mime_name(part, "config"); if (mode == "redaction") { curl_mime_data(part, "{\"mode\":\"redaction\"}", CURL_ZERO_TERMINATED); } else if (mode == "fast") { curl_mime_data(part, "{\"mode\":\"fast\"}", CURL_ZERO_TERMINATED); } } curl_easy_setopt(hnd, CURLOPT_MIMEPOST, form); // Set authorization header struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "cache-control: no-cache"); headers = curl_slist_append(headers, ("Authorization: Token " + auth_token).c_str()); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); // Set up response handling unique_ptr httpData(new string()); curl_easy_setopt(hnd, CURLOPT_WRITEFUNCTION, callback); curl_easy_setopt(hnd, CURLOPT_WRITEDATA, httpData.get()); // Execute request CURLcode ret = curl_easy_perform(hnd); // Parse JSON response Json::Value jsonData; Json::Reader jsonReader; if (jsonReader.parse(*httpData, jsonData)) { cout << jsonData; } curl_easy_cleanup(hnd); curl_mime_free(form); return jsonData; } int main(int argc, char *argv[]) { string token = "MY_API_KEY"; if (argc >= 2) { string mode = (argc >= 3) ? argv[2] : ""; Json::Value data = sendRequest(token, argv[1], mode); // Save response to file ofstream file; file.open("response.txt", ios::app); file << data << "\n\n"; file.close(); } else { cout << "Usage: program [ConfigMode]" << endl; cout << "ConfigMode options: fast, redaction" << endl; } return 0; } // Compile: g++ -o alpr numberPlate.cpp -lcurl // Run: ./alpr /path/to/vehicle.jpg // With redaction mode: ./alpr /path/to/vehicle.jpg redaction ``` -------------------------------- ### Process Images from SFTP Server using Python Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt This script processes images from an SFTP server. It supports various authentication methods including password and private key. Options include using a local SDK, continuous monitoring, deleting processed images, and specifying camera IDs and regions for output. ```bash python ftp_and_sftp_processor.py \ --protocol sftp \ --api-key MY_API_KEY \ --hostname 192.168.0.59 \ --ftp-user user1 \ --ftp-password pass123 \ --folder /tmp/images ``` ```bash python ftp_and_sftp_processor.py \ --protocol sftp \ --api-key MY_API_KEY \ --hostname 192.168.0.59 \ --ftp-user user1 \ --pkey /home/user/.ssh/id_rsa \ --folder /tmp/images ``` ```bash python ftp_and_sftp_processor.py \ --sdk-url http://localhost:8080 \ --hostname 192.168.0.59 \ --ftp-user user1 \ --ftp-password pass123 \ --folder /home/images ``` ```bash python ftp_and_sftp_processor.py \ --api-key MY_API_KEY \ --hostname 192.168.0.59 \ --ftp-user user1 \ --ftp-password pass123 \ --folder /home/images \ --interval 10 ``` ```bash python ftp_and_sftp_processor.py \ --api-key MY_API_KEY \ --hostname 192.168.0.59 \ --ftp-user user1 \ --ftp-password pass123 \ --folder /home/images \ --delete 60 ``` ```bash python ftp_and_sftp_processor.py \ --api-key MY_API_KEY \ --hostname 192.168.0.59 \ --ftp-user user1 \ --ftp-password pass123 \ --folder /home/images \ --camera-id parking-lot-1 \ --regions us-ca \ --mmc \ -o results.csv \ --format csv ``` ```bash python ftp_and_sftp_processor.py \ --api-key MY_API_KEY \ --hostname 192.168.0.59 \ --ftp-user user1 \ --ftp-password pass123 \ --cameras-root /srv/cameras ``` -------------------------------- ### Process Events to Platerecognizer Snapshot using Docker Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/genetec/README.md Runs the Docker container to process Genetec events and forward them to Platerecognizer Snapshot. Requires a Snapshot token and optionally a URL. ```shell docker run --rm -t \ --net=host \ -e LOGGING=DEBUG \ platerecognizer/genetec-integration \ snapshot \ --token=pass \ --url='http://localhost:8080' ``` -------------------------------- ### Execute Disk Cleanup Script Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/stream/README.md Run the cleanup script manually to remove oldest images when disk usage exceeds the trigger threshold. The script requires target free space and trigger usage percentages as integer arguments. ```bash python remove_images.py --usage --target_free 20 --trigger_usage 80 --directory /path/to/images ``` -------------------------------- ### Run Vitest Test Suite Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/webhooks/stream-parkpow-webhook-worker/README.md Executes the project's test suite using Vitest, a modern testing framework. This command can be run in watch mode for continuous testing during development. ```sh vitest ``` -------------------------------- ### Log Vehicle Detections to ParkPow API using Python Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt This Python code demonstrates how to log vehicle detections to the ParkPow API. It includes functions for sending image files with detection results and for sending base64 encoded images, typically used in webhook integrations. Requires the `requests` library. ```python import requests import json def log_vehicle_to_parkpow(api_token, camera_name, plate_results, image_path): """Log a vehicle detection to ParkPow.""" api_url = "https://app.parkpow.com/api/v1/log-vehicle" headers = {"Authorization": f"Token {api_token}"} with open(image_path, "rb") as img_file: payload = { "results": json.dumps(plate_results), "camera": camera_name } files = { "image": (image_path, img_file, "application/octet-stream") } response = requests.post( api_url, data=payload, headers=headers, files=files, timeout=20 ) return response.json() # Example plate_results format: plate_results = [ { "plate": "ABC123", "score": 0.95, "box": {"xmin": 100, "ymin": 200, "xmax": 300, "ymax": 250} } ] # Using base64 encoded image (for webhook integrations) def log_vehicle_base64(api_token, camera_name, plate, confidence, base64_image, timestamp): """Log vehicle with base64 encoded image.""" api_url = "https://app.parkpow.com/api/v1/log-vehicle/" headers = { "Authorization": f"Token {api_token}", "Content-type": "application/json" } data = { "camera": camera_name, "image": base64_image, "results": [{"plate": plate, "score": confidence}], "time": timestamp # ISO format: "2024-01-15T10:30:00Z" } response = requests.post(api_url, headers=headers, json=data) return response.json() ``` -------------------------------- ### Process Images from FTP/SFTP Server using Python Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/README.md This script processes images from an FTP or SFTP server. It requires an API key and server credentials. Options include specifying the protocol (FTP/SFTP), deleting images after processing, and defining the folder to process. It can be configured to use default FTP or SFTP protocols. ```bash python ftp_and_sftp_processor.py --api-key MY_API_KEY --hostname FTP_HOST_NAME --ftp-user FTP_USER --ftp-password FTP_USER_PASSWORD --folder /path/to/server_folder --protocol sftp --delete ``` -------------------------------- ### Redaction with Local SDK and Image Splitting Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Uses the local SDK for license plate redaction, with image splitting enabled for high-resolution images. Requires SDK URL and image path. ```bash python number_plate_redaction.py --sdk-url http://localhost:8080 --split-image /path/to/vehicle.jpg ``` -------------------------------- ### POST /api/v1/log-vehicle/ Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Logs a detected vehicle event into the ParkPow system, including license plate details, confidence score, and camera metadata. ```APIDOC ## POST /api/v1/log-vehicle/ ### Description Sends license plate recognition data from an external source (like a Verkada camera) to the ParkPow dashboard. ### Method POST ### Endpoint https://app.parkpow.com/api/v1/log-vehicle/ ### Parameters #### Request Body - **camera** (string) - Required - The identifier of the camera that captured the image. - **image** (string) - Required - Base64 encoded image string. - **results** (array) - Required - List of detection results containing plate and score. - **time** (string) - Required - ISO 8601 formatted timestamp of the event. ### Request Example { "camera": "cam-001", "image": "base64_data...", "results": [{"plate": "ABC-123", "score": 0.98}], "time": "2023-10-27T10:00:00Z" } ### Response #### Success Response (200) - **status** (string) - Confirmation of the log entry creation. #### Response Example { "status": "success" } ``` -------------------------------- ### Process Images from FTP Server Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Processes images directly from an FTP server. Requires API key, hostname, FTP user credentials, and the folder path on the server. ```bash python ftp_and_sftp_processor.py \ --api-key MY_API_KEY \ --hostname 192.168.0.59 \ --ftp-user user1 \ --ftp-password pass123 \ --folder /home/images ``` -------------------------------- ### Process Batch of Images Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Processes a batch of images using a wildcard pattern. Requires an API key and a path to a set of image files. ```bash python plate_recognition.py --api-key MY_API_KEY /path/to/*.jpg ``` -------------------------------- ### Run Verkada-ParkPow Docker Container Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/parkpow/verkada-lpr-webhooks/on_premise/README.md Runs the Docker container in detached mode, using host networking, and setting the logging level to DEBUG. It requires API key, token, and optionally a ParkPow URL as arguments. ```bash docker run --rm -t \ --net=host \ -e LOGGING=DEBUG \ platerecognizer/verkada-parkpow \ --api-key=user \ --token=pass \ --pp-url='http://localhost:8000' ``` -------------------------------- ### Advanced Plate Recognition Configurations Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/README.md Commands for performing regional lookups, batch processing multiple files, and connecting to a locally hosted SDK container. ```bash # Regional lookup python plate_recognition.py --api-key MY_API_KEY --regions fr --regions it /path/to/car.jpg # Batch processing python plate_recognition.py --api-key MY_API_KEY /path/to/car1.jpg /path/to/car2.jpg /path/to/trucks*.jpg # Local SDK connection python plate_recognition.py --sdk-url http://localhost:8080 /path/to/vehicle.jpg ``` -------------------------------- ### Manage Extension Debugging and Updates Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/docker/dd-extension/README.md Commands to toggle Chrome Dev Tools for the extension and update the backend container after code changes. ```shell docker extension dev debug platerecognizer/installer:latest docker extension update platerecognizer/installer:latest docker extension dev reset platerecognizer/installer:latest ``` -------------------------------- ### Schedule Disk Cleanup on Linux Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/stream/README.md Configure a cron job to automate the execution of the cleanup script at specific intervals. This ensures consistent disk space management without manual intervention. ```bash sudo sh -c 'echo "*/10 * * * * root /usr/bin/python3 /home/user/stream/remove_images.py --usage --target_free 20 --trigger_usage 80 --directory /home/user/stream >> /home/user/stream/free_up_disk_space.log 2>&1" >> /etc/crontab' ``` -------------------------------- ### Detect Make/Model/Color and Output to CSV Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Performs make, model, and color detection along with license plate recognition, outputting results to a CSV file. Requires an API key, output file, and image paths. ```bash python plate_recognition.py --api-key MY_API_KEY --mmc -o results.csv --format csv /path/to/*.jpg ``` -------------------------------- ### Automatic Image Transfer Tool Source: https://github.com/parkpow/deep-license-plate-recognition/blob/master/README.md Overview of the Automatic Image Transfer command-line tool, which monitors a folder for new images, processes them using the ALPR Engine (Cloud or SDK), and optionally forwards results to the Parkpow service. ```APIDOC ## Automatic Image Transfer ### Description The Automatic Image Transfer tool is a command-line utility that integrates with the Plate Recognizer ALPR Engine. It monitors a specified local folder, automatically processes any new images added to it (either via Cloud API or self-hosted SDK), and moves processed images to an archive directory. It also supports forwarding recognition results to the Parkpow management service. ### Method Command-line execution of a Python script. ### Endpoint N/A (Local script execution) ### Parameters Refer to the script's help message for detailed parameters: ```bash python transfer.py --help ``` ### Request Example ```bash python transfer.py --source-folder /path/to/watch --archive-folder /path/to/archive --api-key YOUR_API_KEY --parkpow-forward ``` ### Response Processed images are moved to an archive directory. Results can be forwarded to Parkpow or accessed via other configured outputs. ``` -------------------------------- ### Automatic Image Transfer Script Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt The `transfer.py` script monitors a source folder for new images, processes them using a specified ALPR API, and can forward results to ParkPow. It supports local archiving, cloud API usage, saving results to JSON, and parallel processing with worker threads. ```bash python transfer.py \ --source /home/alpr/camera-images/ \ --archive /home/alpr/archived-images/ \ --alpr-api http://localhost:8080/v1/plate-reader/ \ --parkpow-token MY_PARKPOW_TOKEN \ --cam-pos 2 \ --use-parkpow ``` ```bash python transfer.py \ --source /home/alpr/camera-images/ \ --archive /home/alpr/archived-images/ \ --alpr-api https://api.platerecognizer.com/v1/plate-reader/ \ --platerec-token MY_PLATEREC_TOKEN \ --parkpow-token MY_PARKPOW_TOKEN \ --cam-pos 2 \ --use-parkpow ``` ```bash python transfer.py \ --source /home/alpr/camera-images/ \ --archive /home/alpr/archived-images/ \ --alpr-api http://localhost:8080/v1/plate-reader/ \ --cam-pos 2 \ --output-file results.json ``` ```bash python transfer.py \ --source /home/alpr/camera-images/ \ --archive /home/alpr/archived-images/ \ --alpr-api http://localhost:8080/v1/plate-reader/ \ --parkpow-token MY_PARKPOW_TOKEN \ --cam-pos 2 \ --workers 4 \ --use-parkpow ``` -------------------------------- ### Process Single Image with Cloud API Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt Processes a single image using the cloud API for license plate recognition. Requires an API key and the path to the image file. ```bash python plate_recognition.py --api-key MY_API_KEY /path/to/vehicle.jpg ``` -------------------------------- ### Integrate Verkada LPR Webhooks with Cloudflare Workers Source: https://context7.com/parkpow/deep-license-plate-recognition/llms.txt This snippet provides a Cloudflare Worker implementation to receive Verkada LPR events and forward them to the ParkPow API. It includes a helper class for API communication and a queue handler for processing asynchronous webhook events. ```javascript class ParkPowApi { constructor(token, sdkUrl = null) { this.token = token; this.apiBase = sdkUrl ? `${sdkUrl}/api/v1/` : "https://app.parkpow.com/api/v1/"; } async logVehicle(encodedImage, licensePlateNumber, confidence, camera, timestamp) { const pTime = new Date(timestamp * 1000).toISOString(); const data = { camera: camera, image: encodedImage, results: [{ plate: licensePlateNumber, score: confidence }], time: pTime }; const response = await fetch(this.apiBase + "log-vehicle/", { method: "POST", headers: { "Content-type": "application/json", Authorization: `Token ${this.token}` }, body: JSON.stringify(data) }); return response.json(); } } export default { async fetch(request, env, _ctx) { if (request.method === "POST") { const data = await request.json(); if (data.webhook_type === "lpr") { await env.LPR_WEBHOOKS.send(data); return new Response("OK!"); } } return new Response("Error", { status: 400 }); }, async queue(batch, env) { const parkpow = new ParkPowApi(env.PARKPOW_TOKEN, env.PARKPOW_URL); for (const message of batch.messages) { const data = message.body.data; const imageBase64 = await downloadImage(data.image_url); await parkpow.logVehicle(imageBase64, data.license_plate_number, data.confidence, data.camera_id, data.created); message.ack(); } } }; ```