{"id":18535341,"url":"https://github.com/sanjinkurelic/flaskalpr","last_synced_at":"2025-04-09T15:32:06.229Z","repository":{"id":200595680,"uuid":"319071968","full_name":"SanjinKurelic/FlaskALPR","owner":"SanjinKurelic","description":"Flask ALPR is a web service for automatic license plate recognition (ALPR). The web service is written in Python using Flask for REST API and OpenCV with PyTesseract for plate recognition. The service offers two REST API-s, one for checking if licence plate is detected and one for detecting licence plate from camera image. All detected licence plates are automatically stored in a SQLite database using the SQLAlchemy library.","archived":false,"fork":false,"pushed_at":"2022-02-13T21:53:53.000Z","size":218,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T08:47:38.115Z","etag":null,"topics":["alpr","flask","flask-sqlalchemy","imutils","numpy","opencv","opencv-python","pytesseract","pytesseract-ocr","python-dateutil","python-ocr","sqlalchemy","sqlite-python","sqlite3","tesseract","tesseract-ocr"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SanjinKurelic.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-12-06T15:58:49.000Z","updated_at":"2024-09-20T11:51:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"7597c08e-4a74-4d60-b897-409c5c16ffa9","html_url":"https://github.com/SanjinKurelic/FlaskALPR","commit_stats":null,"previous_names":["sanjinkurelic/flaskalpr"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SanjinKurelic%2FFlaskALPR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SanjinKurelic%2FFlaskALPR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SanjinKurelic%2FFlaskALPR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SanjinKurelic%2FFlaskALPR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SanjinKurelic","download_url":"https://codeload.github.com/SanjinKurelic/FlaskALPR/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248058084,"owners_count":21040693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpr","flask","flask-sqlalchemy","imutils","numpy","opencv","opencv-python","pytesseract","pytesseract-ocr","python-dateutil","python-ocr","sqlalchemy","sqlite-python","sqlite3","tesseract","tesseract-ocr"],"created_at":"2024-11-06T19:22:30.771Z","updated_at":"2025-04-09T15:32:06.223Z","avatar_url":"https://github.com/SanjinKurelic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask ALPR\n\nFlask ALPR is a web service for automatic license plate recognition (ALPR). ALPR is a technology that uses optical character recognition on images to read vehicle registration plates. It is used by police forces, for electronic toll collection on pay-per-use roads and as a method of cataloguing the movements of traffic.\n\nThe web service is written in Python using Flask for REST API and OpenCV with PyTesseract for plate recognition. The service offers two REST API-s, one for checking if licence plate is detected and one for detecting licence plate from camera image. All detected licence plates are automatically stored in a SQLite database using the SQLAlchemy library.\n\n## Getting started\n\n### Requirements\n\nTo start the web service you should have **Python 3.8 or higher** and **Tesseract-OCR** program installed. Tesseract-OCR program is available on all platforms and can be installed using \nofficial documentation: https://github.com/tesseract-ocr/tesseract. For Windows you can install program in `C:/Program Files/Tesseract-OCR/tesseract.exe` path so it's compatible with current code without the extra configuration. Linux will work out-of-the-box.\n\nTo install required Python modules using PIP, you can use the following command in the project root directory:\n\n```bash\npip3 install -r requirements.txt\n```\n\n### Running\n\nIt's recommended to set Python virtual environment before running script or to use PyCharm program which will do this automatically. To start the web service run the following command:\n\n```bash\npython3 run.py\n```\n\n## REST API\n\nThere are two available API-s defined in the web service - one for detecting licence plates from the image, and the other for checking if given licence plate is detected.\n\n### Detecting licence plate from image\n\nWeb service can detect licence plate from all cameras that have the ability to save images in JPG or PNG format. Testing the service could also be done using Postman or a similar program with example images from the Internet. Images like this one below will work without any problems and licence plate will be extracted from the image (licence plate on given image is blurred because this is a live image captured from the security camera).\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/SanjinKurelic/FlaskALPR/blob/master/media/licencePlate.jpg\" alt=\"Licence plate example image\"/\u003e\u003c/p\u003e\n\n#### Request\n\n```\nPOST /upload-camera-image\n\nContent-Type: multipart/form-data\nContent-Disposition: form-data; name=\"image\"; filename=\"\u003cfile.jpg\u003e\"\nContent-Type: image/jpeg\n```\n\n#### Repsponse\n\nIf licence plate is detected:\n\nStatus code - 200 OK\n\n```json\n{\n  \"message\": \"Licence plate AB1234CD found\",\n  \"status\": 200\n}\n```\n\nIf licence plate is not detected:\n\nStatus code - 200 OK\n\n```json\n{\n  \"message\": \"No licence plate found\",\n  \"status\": 404\n}\n```\n\n### Checking if licence plate is detected\n\nFor checking if given licence plate is detected from last time check was made `GET` request can be sent to `check-licence-plate` URL with two variables: \n\n- licence plate or comma separated licence plates that we need to check, for example: `AB1234AB`, or `AB1234AB,CD567EF,GH888II`\n- ISO datetime from the last check, for example: `2020-12-01T19:15:00`\n  \nThe service will check if licence plate is detected in the interval from given datetime and current datetime. If licence plate is detected the time of detection will be filled.\n\n#### Request\n\n```\nGET /check-licence-plate/\u003clicence plate\u003e/\u003ciso datetime\u003e\n```\n\n#### Response\n\nIf licence plates are detected:\n\nStatus code - 200 OK\n\n```json\n[\n  {\n    \"detected\": true,\n    \"plate\": \"AB1234AB\",\n    \"time\": \"2020-12-01T19:14:23\"\n  }\n]\n```\n\nIf licence plates are not detected:\n\nStatus code - 200 OK\n\n```json\n[\n  {\n    \"detected\": false,\n    \"plate\": \"AB1234AB\",\n    \"time\": \"\"\n  }\n]\n```\n\n## Technologies\n\n- Flask\n- SQLAlchemy\n- python-dateutil\n- opencv-python-headless\n- imutils\n- numpy\n- pytesseract\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanjinkurelic%2Fflaskalpr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanjinkurelic%2Fflaskalpr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanjinkurelic%2Fflaskalpr/lists"}