-
Notifications
You must be signed in to change notification settings - Fork 53
Added Number plate detection project #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Number plate detection project #48
Conversation
|
👋 @iamdevdhanush |
iamwatchdogs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @iamdevdhanush, Please make the following changes:
- Remove mp4 file
- Remove xml file
- Update your program (either with suggested workaround or your own logic that doesn't include those file locally)
- Remove the licensing part from README.md
Important
To remove those mp4 and xml file, please perform interactive rebasing along with force push to the branch which you made this PR. This would remove the existance of those files from commit history.
Note
If you need help with interactive rebasing, please refer to YouTube tutorials or ping @iamwatchdogs for help. Remember, Closing PR won't fix this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this mp4 file from this PR. The PR shouldn't include any binary files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this xml file from this PR. Despite being a formatted text file, this is more like a config file that contains some sort of metadata.
| import cv2 | ||
| import os | ||
| import time | ||
|
|
||
| cascade_path = 'indian_license_plate.xml' | ||
| plate_cascade = cv2.CascadeClassifier(cascade_path) | ||
| if plate_cascade.empty(): | ||
| print(f"Error loading cascade from {cascade_path}") | ||
| exit() | ||
|
|
||
| os.makedirs('plates', exist_ok=True) | ||
| video_path = 'Trafic Camera.mp4' | ||
| cap = cv2.VideoCapture(video_path) | ||
| if not cap.isOpened(): | ||
| print(f"Error opening video file {video_path}") | ||
| exit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have requested that you remove the required files (mp4 file and xml file) for this program to work properly. Here's a workaround that could work for your program:
| import cv2 | |
| import os | |
| import time | |
| cascade_path = 'indian_license_plate.xml' | |
| plate_cascade = cv2.CascadeClassifier(cascade_path) | |
| if plate_cascade.empty(): | |
| print(f"Error loading cascade from {cascade_path}") | |
| exit() | |
| os.makedirs('plates', exist_ok=True) | |
| video_path = 'Trafic Camera.mp4' | |
| cap = cv2.VideoCapture(video_path) | |
| if not cap.isOpened(): | |
| print(f"Error opening video file {video_path}") | |
| exit() | |
| import cv2 | |
| import os | |
| import time | |
| import urllib.request | |
| import tempfile | |
| def download_if_url(path): | |
| if isinstance(path, str) and path.startswith(('http://', 'https://')): | |
| try: | |
| suffix = os.path.splitext(path)[1] or '' | |
| tmp = tempfile.NamedTemporaryFile(delete=False, suffix=suffix) | |
| tmp.close() | |
| print(f"Downloading {path} ...") | |
| urllib.request.urlretrieve(path, tmp.name) | |
| return tmp.name | |
| except Exception as e: | |
| print(f"Failed to download {path}: {e}") | |
| return path | |
| return path | |
| cascade_path = 'https://raw.githubusercontent.com/iamdevdhanush/Number-Plate-Detection/refs/heads/main/indian_license_plate.xml' | |
| cascade_path = download_if_url(cascade_path) | |
| plate_cascade = cv2.CascadeClassifier(cascade_path) | |
| if plate_cascade.empty(): | |
| print(f"Error loading cascade from {cascade_path}") | |
| exit() | |
| os.makedirs('plates', exist_ok=True) | |
| video_path = 'https://github.com/iamdevdhanush/Number-Plate-Detection/raw/refs/heads/main/Trafic%20Camera.mp4' | |
| video_path = download_if_url(video_path) | |
| cap = cv2.VideoCapture(video_path) | |
| if not cap.isOpened(): | |
| print(f"Error opening video file {video_path}") | |
| exit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @iamwatchdogs,
I’ve updated the implementation to remove any dependency on local mp4 or xml files by using OpenCV’s built-in Haar cascade and defaulting to webcam input.
I’ve also performed an interactive rebase and force-pushed the branch so the mp4 and xml files are completely removed from the commit history, and removed the license section from the README.
Please let me know if any further changes are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @iamdevdhanush,
We have reviewed your changes. We want to remind you that reverting changes doesn't completely remove the traces of"input" files (such as mp4 or xml). These files can be recovered by reverting the "deleted" revert commits.
We want you to perform interactive rebasing for this branch to edit the initial commit (i.e., 6f94836c) and delete the mp4 & xml file, and during the same interactive rebasing session, remove the reverting commit that you have made. After all these changes, force-push your reorganised commit history to the remote branch.
We can proceed with these changes. Please feel free to ask any questions for clarification or help needed.
Tip
Here's a sample YouTube Tutorial for using interactive rebasing.
What is this Python project?
This is a real-time Number Plate Detection project using Python and OpenCV.
It detects vehicle number plates from webcam feed, images, or video, and optionally saves cropped plate images.
It is beginner-friendly and modular, so others can expand it for automation, security, or traffic monitoring projects.
Features
Why it is useful / Difference from similar projects
Anyone who agrees with this pull request could submit an Approve review to it.