{"id":23093177,"url":"https://github.com/crispengari/car-plates-detection-open-computer-vision","last_synced_at":"2026-05-10T06:49:59.795Z","repository":{"id":141093781,"uuid":"326644477","full_name":"CrispenGari/car-plates-detection-open-computer-vision","owner":"CrispenGari","description":"This is a simple Machine Learning open computer vision application that number plates in real time from an image using `haarcascade_russian_plate_number.xml` from opencv.","archived":false,"fork":false,"pushed_at":"2021-01-04T10:22:58.000Z","size":587,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T17:02:41.300Z","etag":null,"topics":["ai","machine-learning","opencv","python","python3","rectangle"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CrispenGari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-04T10:17:01.000Z","updated_at":"2023-08-14T05:00:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f771444-6766-4d88-bc09-809fb54a4c2d","html_url":"https://github.com/CrispenGari/car-plates-detection-open-computer-vision","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrispenGari%2Fcar-plates-detection-open-computer-vision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrispenGari%2Fcar-plates-detection-open-computer-vision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrispenGari%2Fcar-plates-detection-open-computer-vision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrispenGari%2Fcar-plates-detection-open-computer-vision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CrispenGari","download_url":"https://codeload.github.com/CrispenGari/car-plates-detection-open-computer-vision/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247061242,"owners_count":20877166,"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":["ai","machine-learning","opencv","python","python3","rectangle"],"created_at":"2024-12-16T21:46:37.372Z","updated_at":"2026-05-10T06:49:54.752Z","avatar_url":"https://github.com/CrispenGari.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is this?\n\nThis is a simple Machine Learning open computer vision\napplication that number plates in real time from an image\nusing `haarcascade_russian_plate_number.xml` from opencv.\n\n### Demo\n![image-demo](https://github.com/CrispenGari/car-plates-detection-open-computer-vision/blob/main/images/bandicam%202021-01-04%2012-15-41-143.jpg)\n### App capabilities.\nThis app is cappable of:\n* detecting car number plates  in real time\n* draw rectangle around each plate detected\n* put text label `Plate` to show that this is a Plate detected\n\n### First of all install `opencv-python` and `numpy`:\n#### You can install `opencv-python` by running:\n\n`python -m pip install opencv-python`\n\n#### You can install `numpy` by running:\n`python -m pip install numpy`\n\n### Alternatively, you can install all of them by pasting the following code on your `main.py` and run it.\n\n````buildoutcfg\ntry:\n    import cv2\n    import numpy as np\nexcept ImportError as e:\n    from pip._internal import main as install\n    packages = [\"numpy\", \"opencv-python\"]\n    for package in packages:\n        install([\"install\", package])\nfinally:\n    pass\n````\n\n### After installation of all the packages then we are ready to go.\n\n#### step 1:\nDefine a function that detects face, and accepts an image path as its argument.\n\n\n#### step 2:\nLoad the face cascade\n````buildoutcfg\n plateClassifier = cv2.CascadeClassifier(\"cascade/haarcascade_russian_plate_number.xml\")\n````\n#### step 3:\nLoad an image and Convert the image to gray-scale and detects\nplates-points using the `detectMultiScale()` function.\n````buildoutcfg\nimage = cv2.imread(image_path)\ngrayImage = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\nplates = plateClassifier.detectMultiScale(grayImage, 1.5)\n````\nNow we have all the point to draw the rectangle to our original image.\n\n#### step 4:\nDetect plates and\nLoop through plates array and draw a rectangle around each plate\nthat is going to be detected. \nDraw the text as was as a rectangle that is \nfilled with green color that bounds the text\nand show the image.\n````buildoutcfg\nif len(plates):\n    for (x, y, w, h) in plates:\n        cv2.rectangle(image, (x, y - 20), (x + int(w / 2), y), (0, 255, 0), -1)\n        cv2.putText(image,\"Plate\",(x + 10, y-5), cv2.FONT_HERSHEY_PLAIN,1,(255, 255, 255))\n        final_image = cv2.rectangle(image, (x, y), (x+w, y+h),(0, 255, 0), 1)\n        cv2.imshow(\"Number Plates Detector\",final_image)\n````\nNow everything is ready we are only left with showing images in a loop and wait \nfor `q` key press to close the loop.\n#### step 6:\n````buildoutcfg\nkey = cv2.waitKey(0)\nif key \u0026 0xFF == ord('q'):\n    break\n````\n\n### All code in one place: `main.py`\n\n````buildoutcfg\n\n# Plates detector\n\"\"\"\"\nWhat is this?\n    * This is a car number plates detector using open computer vision.\n*   This app detects car plates from an image.\n\"\"\"\n\ntry:\n    import cv2\n    import numpy as np\nexcept ImportError as e:\n    from pip._internal import main as install\n    packages = [\"numpy\", \"opencv-python\"]\n    for package in packages:\n        install([\"install\", package])\nfinally:\n    pass\n\ndef plateDetector(image_path):\n    plateClassifier = cv2.CascadeClassifier(\"cascade/haarcascade_russian_plate_number.xml\")\n    image = cv2.imread(image_path)\n    grayImage = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n    # Load the cascade classifier\n    plates = plateClassifier.detectMultiScale(grayImage, 1.5)\n    if len(plates):\n        for (x, y, w, h) in plates:\n            cv2.rectangle(image, (x, y - 20), (x + int(w / 2), y), (0, 255, 0), -1)\n            cv2.putText(image,\"Plate\",(x + 10, y-5), cv2.FONT_HERSHEY_PLAIN,1,(255, 255, 255))\n            final_image = cv2.rectangle(image, (x, y), (x+w, y+h),(0, 255, 0), 1)\n            cv2.imshow(\"Number Plates Detector\",final_image)\n    key = cv2.waitKey(0)\n    if key \u0026 0xFF == ord('q'):\n        cv2.destroyAllWindows()\n    return\nplateDetector(\"images/car2.jpg\")\n````\n### Where to find the face cascade classifier?\nYou will find it on the opencv github [here](https://github.com/opencv/opencv/tree/master/data/haarcascades)\n \n### Why this simple App?\nThis app was build for practise purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrispengari%2Fcar-plates-detection-open-computer-vision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrispengari%2Fcar-plates-detection-open-computer-vision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrispengari%2Fcar-plates-detection-open-computer-vision/lists"}