Python ANPR with OpenCV and EasyOCR in 25 Minutes | Automatic Number Plate Recognition Tutorial
Ғылым және технология
Tired of searching for your Uber?
Trying to get a better idea of who’s stealing your car park?
Just want an awesome Computer Vision project to try out using Python?
Well, ANPR might just be the perfect thing for your to try out! In this video we’ll go through a full blown walkthrough of performing Automatic Number Plate Recognition (ANPR) using OpenCV and EasyOCR. We just edge detection and filtering techniques combined with deep learning powered optical character recognition to be able to extract number plate text from images in just 25 minutes.
In this video you’ll learn how to:
0:00 - Start
5:59 - Reading and visualising images using OpenCV with Python
7:37 - Applying color shifts and changes to images (e.g. grayscaling and BGR2RGB)
9:48 - Detecting contours using OpenCV findCountours
14:32 - Masking number plates to improve text extraction for OCR
18:40 - Extracting number plate text using EasyOCR
GET THE CODE!
github.com/nicknochnack/ANPRw...
Links Mentioned:
Circuit Digest Article: circuitdigest.com/microcontro...
OpenCV Documentation: docs.opencv.org/4.5.0/
EasyOCR: github.com/JaidedAI/EasyOCR
PyTorch: pytorch.org/get-started/locally/
If you have any questions, please drop a comment below!
Oh, and don't forget to connect with me!
LinkedIn: / nicholasrenotte
Facebook: / nickrenotte
GitHub: github.com/nicknochnack
Happy coding!
Nick
P.s. Let me know how you go and drop a comment if you need a hand!
Пікірлер: 381
Thanks, this has helped simplify a lot of techniques I was getting my head around. Such a great pipeline, and a great tutorial. Keep them up in the same style!
@NicholasRenotte
3 жыл бұрын
Thanks so much @Anthony, glad you enjoyed it!
Great video and really good explanation and as for typing that amount of code by hand and it working first time. . . Just amazing.
Very lucid and beautifully presented, Nicholas.
I have mad respect towards you for this. thank you so much
Thanks man it's working fine...u explains very well
Great explanation from you Nicholas. Like the method you used.
😎👍🏼 PERFECT Tutorial!
Amazing approach. Thanks for sharing.
@NicholasRenotte
3 жыл бұрын
Thanks so much @Eduardo!
Program is working well, that helped a lot thanks.
@abhinavsingh3513
3 ай бұрын
Bro please tell me how to install and run the project please
Another great tutorial, Nicholas! 👏👏
@NicholasRenotte
3 жыл бұрын
🙏🙏🙏 thanks so much @Gustavo!!
Great tutorial !!!! Thank you
Clearly explained ....👏
Man you saved my presentation ....thank you so much!
@NicholasRenotte
3 жыл бұрын
YESS, glad I could help @Mency, how did your presentation go?
@mencychristian1831
3 жыл бұрын
@@NicholasRenotte That was my best presentation ever 😀
@NicholasRenotte
3 жыл бұрын
@@mencychristian1831 YESSSSS, so glad to hear!!
Thank you for sharing this great knowledge
@NicholasRenotte
3 жыл бұрын
Anytime @Josh, glad you enjoyed it!
Great explanation!!!
@NicholasRenotte
3 жыл бұрын
Thanks a bunch @01bit, so glad you enjoyed it!
Thank you my teacher. Nice education. ^_^
@NicholasRenotte
3 жыл бұрын
So glad you enjoyed it Özlem!
Really great 👍 thank you 🙂
Thank you for the detail
@NicholasRenotte
3 жыл бұрын
Glad you enjoyed it @232nate, this is the updated version if you're interested: kzread.info/dash/bejne/YmFo0sGKl9XKkqg.html
Thanks a lot brother🙌
@NicholasRenotte
3 жыл бұрын
Anytime @Sakshi!
Amazing 👍👍
Nice thanks bro!
@NicholasRenotte
3 жыл бұрын
Thanks so much @Kronos!
great, thanks
Thank you
Thanks man.
Amazing!!!!!
@NicholasRenotte
3 жыл бұрын
Thanks so much @Joshua!
You're amazing. This is the best video and tutorial I've seen. Please create a tutorial to apply Machine Learning to Number Plate Recognition!
@NicholasRenotte
3 жыл бұрын
Definitely, going to try for deep learning @Luis!
Hey mate. Great videos. I’ve read through a few comments and pretty excited to see this “new” video ahah. Any idea when it’s going to be released?
@NicholasRenotte
3 жыл бұрын
Was smashing it out til late last night @J H, let me know what you think: kzread.info/dash/bejne/YmFo0sGKl9XKkqg.html
Thanks Man
Hi Nicholas, thanks for this video. Could you do another video that shows how to extract hand written text from the Crosswords puzzles and compare that with the correct answers?
thanks sir !...this helped me
@NicholasRenotte
3 жыл бұрын
You're welcome man! So glad it helped!
@rohit_mondal__
3 жыл бұрын
@@NicholasRenotte sir can u please make a video on yolo using keras ?
@NicholasRenotte
3 жыл бұрын
@@rohit_mondal__ will take a look!
Please make one more video with great accuracy. This video is also excellent but I test some images on the data sometimes accuracy miss
Thanks bro))😀😇
thank you very helpfull
Thanks bro Nicholas Renotte....
@NicholasRenotte
3 жыл бұрын
Thanks a ton @Absor!
Killing it man! 🔥 Can you show how you would turn this into an api and host it maybe?
@NicholasRenotte
3 жыл бұрын
WHADDUP @Vikash! Definitely, have some stuff with Streamlit and FastAPI planned!!
@vikashchand.
3 жыл бұрын
@@NicholasRenotte sounds awesome man! Looking forward to it!
@raymondmichael4987
2 жыл бұрын
9 months later; asking if you made it bro
Great tutorial! What about to implement usign live videos!
Great video. Do you have a video on how to incorporate machine learning into this?
please make object tracking & counting video on vehicles in opencv & python
Awesome vid Nick, surprised you don't have more subs. Any chance of considering doing semantic segmentation, particularly with the human body.
@NicholasRenotte
3 жыл бұрын
Thanks so much @Andy, 😅 it's taken a little while but i've really only hit the ground running for a few months now! We'll get there! I've done it with JS (kzread.info/dash/bejne/fXWVusSAopzVYNY.html), Python is defs coming!
@Andy-rq6rq
3 жыл бұрын
@@NicholasRenotte Wow thanks!
@NicholasRenotte
3 жыл бұрын
@@Andy-rq6rq anytime hombre!
Really amazing,was very helpful. Just wanted to know if there's a way to use an entire dataset of images for this technique? Any tutorial you may know of? Thanks In advance!
@NicholasRenotte
3 жыл бұрын
Stay tuned @Godfrey, updated version of this tutorial coming out this week!
@godfreyfonseca5707
3 жыл бұрын
@@NicholasRenotte great 😍🙌... looking forward to it!
Amazing intro ))) One question though, can the image size affect findContours functions?
nice
Thank you so much for this code! Is there any way to do a performance evaluation of the code?
Hi, Nick, Great video. I did spend a lot of time on the Tensorflow version of this project that you posted a while back. What do you see as the plusses and minuses of the two different approaches?
@NicholasRenotte
2 жыл бұрын
The TF version is a lot more resilient to different photos of plates. This almost needs to be tuned each time depending on lighting, contrast, hue and sat to be able to effectively pick up the plate each time. However the TF version is wayyyy more compute heavy.
@adityagoel2792
Жыл бұрын
@@NicholasRenotte I had the same question. Thanks for clarifying Nick! Keep them coming - you're a GREAT teacher! :)
Thx Bro 👍
@NicholasRenotte
3 жыл бұрын
Anytime @Chazim!
Thank you!!! It is very interesting. I have a question. If the number is compound. And there are 2 rectangular counters? How much I tried, only the last contour defines.
Great video , i want to add to this project real time object detection from webcam. Can you tell me few stepts for that? Thanks in advance :)
Can u make some videos using open cv.... (Problem statement on real life based.. ) And also tere solution.
Hi Nicholas, Thank You for all the hard work you put into this tutorial, its taught me SO Much.. I have a question about the images you used vs. My own images , yours work fine in the program, but the ones I used doesn't populate any coordinates in the location cell. the properties of your images are: 160KB in sizes, 300dpi, 960x722 (dimensions) and 24 bit depth, my images are: 600KB, 96dpi, 2000x1500, and 24 bit depth, aren't
@vonvanmany997
Жыл бұрын
is this the reason why the coordinates aren't population or am I missing something in the code
Is this one better than the other one?
Hi Nick, Great Video!! One question, Is it possible to run this on a mp4 file.
Nicholas, great job. How do I apply EasyOCR on a camera stream?
Are there any videos showing a physical prototype or build with a camera?
Hi, whenever i'm trying to import cv2 and other my jupyter kernel The kernel appears to have died. It will restart automatically. do you have any solution?
Amazing Nicholas. I am into ANPR technology. Let me know how we can collaborate.
@NicholasRenotte
3 жыл бұрын
Cool stuff @Viaggio!
thank you for this videos but I found that works only on separated cars I mean when there is only one car in a photo, and also the car doesnt have rectangles in its shape
Great video!! i have a doubt can do the same thing by using visual studio code ??
@NicholasRenotte
3 жыл бұрын
Sure can, just need to install a Python interpreter into VSC.
Would it be able to capture at least 2 plates at the same time?
Sir how can we create the front end for this project by using flask.
please make video when u capture with live camera the plates
@NicholasRenotte
3 жыл бұрын
Yup, definitely coming @Seby!
Was just involved in a hit and run... Can you help me uncover the license plate number. should be fun haha
@NicholasRenotte
2 жыл бұрын
Oh no! You should take a look at the super resolution models!
Hey bro m facing assert error 251 for drawcontour anu suggestion how to solve it
Hi thanks for this fantastic tutorial , how can we add button to add more than one picture and result convert it to excel ?
@NicholasRenotte
2 жыл бұрын
Check out the new tutorial on the channel!
im having a error in reader = easyocr.Reader(['en']) line it says it's detection models an after like 2% it is getting stucked kinda very very slow any idea?
haw can i applied on raspberry pi plz for my graduation project
is it possible to make it as a realtime video detection?
hi, im like zero of python, im trying to follow step by step but i could not install imutil, i've installed easyocr but here can i find imutil to install? thanks
How to make this able to read 7 segment display?
Hi... Great video but the problem is it works only on about 10 percent of images in my data set... On others it either says cannot find contour or just detects wrong contour... I have tried with 400+ images and only got about 40-50 correct results... What should i do... Or is this algorithm not enough??
Great tutorial, however, I tried other images but the detection of carplate seems to be off. Any idea why ?
@NicholasRenotte
3 жыл бұрын
This particular model isn't super generalised to different types of plates. Try this model, it's way more performant: kzread.info/dash/bejne/YmFo0sGKl9XKkqg.html
Good day, Nicholas can i use opencv contour detection to detect square number plates used in Zimbabwe
can you please make a video for helmet detection using open cv please
@NicholasRenotte
3 жыл бұрын
Heya @Yati, check out the latest video, should give you a walkthrough on how to do it!
Can I use this code to detect number plate from videos
I import opencv library but kernal automatically close??
Nice tutorial. Do you know how to recognize the characters without using easy OCR at the last step..? I want to use template matching technique to recognize the characters and i will have to use a dataset for it as well. Is there any tutorials you can point me to if you know..? Would be a huge help thank you.
@NicholasRenotte
3 жыл бұрын
Heya @Dil lil, you could also use something like Tesseract or an API? Any reason you can't use Easy OCR?
@Dillil
3 жыл бұрын
@@NicholasRenotte It’s for a college project. So I have to train a model.
@NicholasRenotte
3 жыл бұрын
@@Dillil ah got it, I don't really have anything that's built from scratch yet unfortunately!
sir can this be applied in a video MP4?
How to get the accuracy of this model
line 28, in new_image = cv2.drawContours(mask, [location], 0,255, -1) error: (-215:Assertion failed) reader.ptr != NULL in function 'cvDrawContours' got this error... can u resolve it?
Can you help me for that for research paper only..
how to connect it on raspi camera?
Hi have a small request in the last step (step 6) for rendering results can you help me how i can add Chinese characters and English on the image
Hi body! I run your code on colab. Almost everything perfect but other plate I tryed it recognize letter "I" as "1". There is some update?
hi, I just wanted to know can I use this model as a Text detection model, will this model be able to recognize text from images.
@NicholasRenotte
2 жыл бұрын
Sure can, check out the drug extraction video I did for PaddleOCR. I show how to do it there.
I want to make a executable file with a GUI for this project. How can I do that? Please help me.
@NicholasRenotte
3 жыл бұрын
Check out PySimpleGUI, you could probably wrap the code into something like that!
All I got after reading the text from the cropped image was an error: \Scripts\venv\lib\site-packages\easyocr\craft_utils.py", line 31, in getDetBoxes_core nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(text_score_comb.astype(np.uint8), connectivity=4) cv2.error: Unknown C++ exception from OpenCV code
why other images besides the 4 images provided cant extract the plate number?
@nathakritnukulrat3063
Жыл бұрын
I've got this problem too
How can i use this model with flutter?
can this be done on footage?
please share tutorial how to search number in bulk image folder use free api ocr
would this work on a raspberry pi? with raspberry pi OS
please say how to detect vehicle in real time and extract the number plate
I don't know why, but it works for me only with Porsche, the others have still None on location step. Could you help me and tell on which parts of code should i focus?
@NicholasRenotte
3 жыл бұрын
Heya @Pokojowy, walk through each step and ensure you're still detecting the edges appropriately. You might need to play with the Canny algorithm line!
How do you know the registration number of the taxi?
Hello, where can i have the full code?
I got this error "too many values to unpack (expected 2)" when i did the crop part
I need this in javacv
Hi nic anyway to edit the code such that it can better detect images of black license plates with white text? (Singaporean License Plate)
@NicholasRenotte
3 жыл бұрын
Heya @Giggs! Try out the new workflow, it's way more accurate and can do different types of plates!
what if there are more than 1 number plate how to detect both?
Nich Sir, what if I dont have External Graphics card can it still work?
In my case it is detecting headlights and bumper