Awesome content! I've been diving into ANPR technology myself and recently developed a Windows app for it. It's fascinating to see the different approaches out there.
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!
Some great inspiration for my related project; just one tip, I seem to find that adaptive mean thresholding works better than the canny filter. You're looking for a discrete shape, a number plate - not the edges of something which could be one of any number of shapes like.. well, the actual car. All license plates are going to either be rectangular or some small-vertex polygon similarly (
Notes to Self: @ 7:22 In the given code, the imshow() function is used to display the grayscale image, which has only one color channel. However, the imshow() function expects an RGB image to display, so the cvtColor() function is used to convert the grayscale image to RGB format by replicating the pixel values across all three color channels. This allows the imshow() function to display the image correctly, but the resulting plot will still show the image in grayscale.
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?
You are awesome! I am just digging in to python and you my friend are so informative, easy to undersatand, and the pacing is perfect. Thank you will be following and checking out your other vids 😁
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??
i am trying to do this but just for single images, to send the program an image URL and have it return the numberplate text. Is there another tutorial or idea for something like that ? Thanks !
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
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
Hi, In [44]: you have typed 'en' as the plate number is in English. but my question is will it work for the other languages like Bangla or Arabic or even German? Video duration: 19:28
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!
I have a problem in when in section number zero when I import the libraries. "The kernel appears to have died. It will restart automatically." it occurs only when I try to run "import easyocr", when I remove it runs normally, please help!
@@NicholasRenotte I solved the problem, I cleaned my pc from everything related to python and download everything from the begging I Guess something was related to the log in appdata file was making problem. Thank you!
@@h-electronics602 awesome stuff, yeah sometimes there's a bunch of conflicts and it requires a clean slate. Awesome work on getting it working though!!
Normally would need to do some additional processes to manually filter it out. Could also filter based on detected region size i.e. the main plate is going to be the largest detected block of text (most of the time)
@@NicholasRenotte if using region detected trick, so it must have a certain distance from the camera to get the range of plate box, if you do it in real time from a video capture, not from a photo. But it will also get another text in a box that close to the range region that we've set.
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?
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!
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?
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?
Everything worked perfectly fine and I even got the cropped number plate but the line result = reader.readtext(cropped_image) Showing unknown C++ exception from opencv code I don't have GPU so using CPU only Plz help
it's not working on Pakistani number plates like a dual-line on the number plate i.e: FD-13 388 here is only detect FD not other text on the number plate how i can fix it ????
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?
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.
I have another question how can I detect a plate in a video instead of a high-quality picture I modified the code to take frames from a video but the plate is not really clear. In another video I used, the plate in it was very clear, but could not detect, and even I tried your original code with a screenshot of the scene but it could not detect the picture anyway. Any suggestions?
Heya @H-Electronics, it might take some additional processing to detect. What I would suggest is using a DL model to identify the region with the plate, single out the region, apply perspective transformation (www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/) THEN applying OCR.
@@NicholasRenotte Oops! The page you are looking for no longer exists. Perhaps starting from the site's homepage will get you on the right track. XD That what I found
@@NicholasRenotte I am thinking of an algorithm to detect all the possible rectangles in the frame and then by machine learning try to identify whether this rectangle is a plate or not. Like the algorithm that recognize if this animal is cat or dog.The problem I think it will not be efficient because the processing time will belong. What do you think?
@@h-electronics602 from what I've seen, it's normally a little slower than using non-deep learning powered OCR. It should be a lot more resilient to different styled plates though!
@@NicholasRenotte hey thanks for the reply, the command i used is, pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio===0.8.1 -f download.pytorch.org/whl/torch_stable.html
@@gimanthadesilva And you're running Python 3.x? I'd check this and make sure that the machine you're running meets the dependencies: pytorch.org/get-started/locally/
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?
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.
easyocr cannot be installed on a raspberry pi 4. I have spent hrs trying to fix it but I gave up and tried a different package pytesseract or something which seem to work now.
I have managed to get this to work on Jetson Nano until I got to easyOCR where I m getting the following error: CUDA not available - defaulting to CPU. Note: This module is much faster with a GPU. Illegal instruction (core dumped) Another rabbit hole
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
Hey, bro! In the current license plate recognition system, which method can I think of to locate the license plate using opencv that you mentioned or deep learning such as yolo, which one is more useful in practical application?
Nah no stress man, welcome to the fam! You can do it in a few ways: 1. Use a one step model to identify the frame (deep learning can improve the plate detection) then use standard OCR 2. Use a two step model to both identify the frame and extract the text!
it is not working for me cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-wvn_it83\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' it is showing me this no matter how many times i am editing
Hey, amazing video first of. I do have one problem with the mask, it does not mask out the numberplate but instead masks out the window, any clue how i can fix this?
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 (ruclips.net/video/KAaXbGr9o0s/видео.html), Python is defs coming!
To add on, i have some images of carplates where they dont detect the carplates but detect something else instead of the carplates not sure why pls help me thanks!
Awesome content! I've been diving into ANPR technology myself and recently developed a Windows app for it. It's fascinating to see the different approaches out there.
Man you saved my presentation ....thank you so much!
YESS, glad I could help @Mency, how did your presentation go?
@@NicholasRenotte That was my best presentation ever 😀
@@mencychristian1831 YESSSSS, so glad to hear!!
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!
Thanks so much @Anthony, glad you enjoyed it!
Some great inspiration for my related project; just one tip, I seem to find that adaptive mean thresholding works better than the canny filter. You're looking for a discrete shape, a number plate - not the edges of something which could be one of any number of shapes like.. well, the actual car. All license plates are going to either be rectangular or some small-vertex polygon similarly (
Great video and really good explanation and as for typing that amount of code by hand and it working first time. . . Just amazing.
Notes to Self: @ 7:22
In the given code, the imshow() function is used to display the grayscale image, which has only one color channel. However, the imshow() function expects an RGB image to display, so the cvtColor() function is used to convert the grayscale image to RGB format by replicating the pixel values across all three color channels. This allows the imshow() function to display the image correctly, but the resulting plot will still show the image in grayscale.
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?
Program is working well, that helped a lot thanks.
Bro please tell me how to install and run the project please
You are awesome! I am just digging in to python and you my friend are so informative, easy to undersatand, and the pacing is perfect. Thank you will be following and checking out your other vids 😁
i am not getting any location which you explained at 14:20 then what to do at that time?
Very lucid and beautifully presented, Nicholas.
I have mad respect towards you for this. thank you so much
What's the difference between this video and your 2 hour long video on ANPR
This video uses OpenCv, the 2 hour long video uses TensorFlow
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 explanation from you Nicholas. Like the method you used.
why other images besides the 4 images provided cant extract the plate number?
I've got this problem too
Thanks man it's working fine...u explains very well
please make object tracking & counting video on vehicles in opencv & python
😎👍🏼 PERFECT Tutorial!
i am trying to do this but just for single images, to send the program an image URL and have it return the numberplate text. Is there another tutorial or idea for something like that ? Thanks !
Thank you for the detail. But could you please make a video of collecting toll tax using this ANPR.
Another great tutorial, Nicholas! 👏👏
🙏🙏🙏 thanks so much @Gustavo!!
I import opencv library but kernal automatically close??
Amazing approach. Thanks for sharing.
Thanks so much @Eduardo!
Is this one better than the other one?
Can u make some videos using open cv....
(Problem statement on real life based.. )
And also tere solution.
Clearly explained ....👏
Hiii I am getting error like attribute error
Cv2. Cv2 module not found something like that
Help me out off it
I am using Jupiter notebook
Try installing opencv-python!
Amazing 👍👍
haw can i applied on raspberry pi plz for my graduation project
I noticed that the program doesnt work well with black plates, how should I tweak it so it can detect black colour plates?
Heya @Jia, can you share some of your example images? I can play around with the mask settings for you and give you some updated parameters!
@@NicholasRenotte sure, can u drop your email here ??
@@jiachuntan3144 hmu on LinkedIn to share privately! www.linkedin.com/in/nicholasrenotte/
can this be used to detect numbers on coins? and color of coins?
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
is this the reason why the coordinates aren't population or am I missing something in the code
Can you please tell me how can we give command to Arduino to do something when we detect face or our algorithms given us yes to do something
Haven't worked much with arduinos yet but when I do I got you!
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
Hi, In [44]: you have typed 'en' as the plate number is in English. but my question is will it work for the other languages like Bangla or Arabic or even German?
Video duration: 19:28
Supports a ton of languages @Srabon. Check this out: www.jaided.ai/easyocr/
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!
Stay tuned @Godfrey, updated version of this tutorial coming out this week!
@@NicholasRenotte great 😍🙌... looking forward to it!
Is it possible to actually automatically use the pictures inside the folder without manually typing the image file into cv2.imread?
You can loop through the images in the folder using os.listdir then pass them to the model!
I have a problem in when in section number zero when I import the libraries. "The kernel appears to have died. It will restart automatically." it occurs only when I try to run "import easyocr", when I remove it runs normally, please help!
Hmm, what does it say in your terminal or command prompt that's running the Jupyter Notebook server?
@@NicholasRenotte I solved the problem, I cleaned my pc from everything related to python and download everything from the begging I Guess something was related to the log in appdata file was making problem.
Thank you!
@@h-electronics602 awesome stuff, yeah sometimes there's a bunch of conflicts and it requires a clean slate. Awesome work on getting it working though!!
Thank you my teacher. Nice education. ^_^
So glad you enjoyed it Özlem!
What if there is another text beside the number plate? Such as, numbers on car sticker.
Normally would need to do some additional processes to manually filter it out. Could also filter based on detected region size i.e. the main plate is going to be the largest detected block of text (most of the time)
@@NicholasRenotte if using region detected trick, so it must have a certain distance from the camera to get the range of plate box, if you do it in real time from a video capture, not from a photo. But it will also get another text in a box that close to the range region that we've set.
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?
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!
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?
Hey bro m facing assert error 251 for drawcontour anu suggestion how to solve it
Thank you for sharing this great knowledge
Anytime @Josh, glad you enjoyed it!
Hello Sir, how about in my country? White text in black background?
Try using the updated version of the model, video is on the channel!!
@@NicholasRenotte thank you Sir
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?
Was smashing it out til late last night @J H, let me know what you think: ruclips.net/video/0-4p_QgrdbE/видео.html
Please make one more video with great accuracy.
This video is also excellent but I test some images on the data sometimes accuracy miss
Sir how can we create the front end for this project by using flask.
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?
Are there any videos showing a physical prototype or build with a camera?
Everything worked perfectly fine and I even got the cropped number plate but the line
result = reader.readtext(cropped_image)
Showing unknown C++ exception from opencv code
I don't have GPU so using CPU only
Plz help
Try uninstalling opencv and reinstalling it using pip install opencv-python
Was just involved in a hit and run... Can you help me uncover the license plate number. should be fun haha
Oh no! You should take a look at the super resolution models!
hey bro can u explain why text = result [0] [-2]. I didnt understand why it's "-" and why "2".
The -2 grabs the second last value from the array!
Good day, Nicholas can i use opencv contour detection to detect square number plates used in Zimbabwe
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?
Nicholas, great job. How do I apply EasyOCR on a camera stream?
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.
Sure can, check out the drug extraction video I did for PaddleOCR. I show how to do it there.
Hi nic anyway to edit the code such that it can better detect images of black license plates with white text? (Singaporean License Plate)
Heya @Giggs! Try out the new workflow, it's way more accurate and can do different types of plates!
it's not working on Pakistani number plates like a dual-line on the number plate
i.e:
FD-13
388
here is only detect FD not other text on the number plate
how i can fix it
????
Try using the updaed version of the model, it's a 2hr tutorial on the channel!
Great video!! i have a doubt can do the same thing by using visual studio code ??
Sure can, just need to install a Python interpreter into VSC.
Great tutorial !!!!
Thank you
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?
Thank you so much for this code! Is there any way to do a performance evaluation of the code?
Can I use this code to detect number plate from videos
Really great 👍 thank you 🙂
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 explanation!!!
Thanks a bunch @01bit, so glad you enjoyed it!
I successfully installed easyocr but my kernel is dead when I'm importing it..I don't know why
Any errors in the terminal @Varun?
@@NicholasRenotte Nope..I didn't had any
@@VarunSingh-hb7zg possibly try running it in a virtual environment?
I have another question how can I detect a plate in a video instead of a high-quality picture I modified the code to take frames from a video but the plate is not really clear. In another video I used, the plate in it was very clear, but could not detect, and even I tried your original code with a screenshot of the scene but it could not detect the picture anyway. Any suggestions?
Heya @H-Electronics, it might take some additional processing to detect. What I would suggest is using a DL model to identify the region with the plate, single out the region, apply perspective transformation (www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/) THEN applying OCR.
@@NicholasRenotte Oops!
The page you are looking for no longer exists. Perhaps starting from the site's homepage will get you on the right track.
XD That what I found
@@NicholasRenotte I am thinking of an algorithm to detect all the possible rectangles in the frame and then by machine learning try to identify whether this rectangle is a plate or not. Like the algorithm that recognize if this animal is cat or dog.The problem I think it will not be efficient because the processing time will belong. What do you think?
@@h-electronics602 from what I've seen, it's normally a little slower than using non-deep learning powered OCR. It should be a lot more resilient to different styled plates though!
Is it work for Bike??
Like a motorbike?
@@NicholasRenotte yes yes
@@sudhanshusrivastava4173 should work, but again might require some tweaking due to the size of the plate.
@@NicholasRenotte where should I change for motorcycle plate?
I get an error when installing torch, windows 10
"Could not find a version that satisfies the requirement"
Heya @Gimantha, what command did you use to run the install?
@@NicholasRenotte hey thanks for the reply, the command i used is,
pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio===0.8.1 -f download.pytorch.org/whl/torch_stable.html
@@gimanthadesilva And you're running Python 3.x? I'd check this and make sure that the machine you're running meets the dependencies: pytorch.org/get-started/locally/
@@gimanthadesilva make sure you are running 64 bit python, I had this issue too
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?
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.
@@NicholasRenotte I had the same question. Thanks for clarifying Nick! Keep them coming - you're a GREAT teacher! :)
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!
Definitely, going to try for deep learning @Luis!
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 :)
easyocr cannot be installed on a raspberry pi 4. I have spent hrs trying to fix it but I gave up and tried a different package pytesseract or something which seem to work now.
I have managed to get this to work on Jetson Nano until I got to easyOCR where I m getting the following error:
CUDA not available - defaulting to CPU. Note: This module is much faster with a GPU.
Illegal instruction (core dumped)
Another rabbit hole
How to make this able to read 7 segment display?
would this work on a raspberry pi? with raspberry pi OS
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
Nice thanks bro!
Thanks so much @Kronos!
when I run the import cell , my kernel is keep on dying .what should I do to recover from this problem ?@Nicholas Renotte
Nich Sir, what if I dont have External Graphics card can it still work?
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
Would it be able to capture at least 2 plates at the same time?
How to perform the same operation using a video file. kindly update regarding that?
Heya Ram, take a look at my latest ANPR video. All you need to do is sub out cv2.VideoCapture(0) for cv2.VideoCapture('path/to/your/file')
Great tutorial! What about to implement usign live videos!
is it possible to make it as a realtime video detection?
Thank you for the detail
Glad you enjoyed it @232nate, this is the updated version if you're interested: ruclips.net/video/0-4p_QgrdbE/видео.html
how to store those number plate recognized like in mysql?
You could connect to a DB using something like pypi.org/project/MySQL-python/ and push those results out!
I want to make a executable file with a GUI for this project. How can I do that? Please help me.
Check out PySimpleGUI, you could probably wrap the code into something like that!
Can it detect plate with oblique angled?
This particular model isn't that great at it but this one can do it: ruclips.net/video/0-4p_QgrdbE/видео.html
@@NicholasRenotte thanks for answeer
Hey, bro! In the current license plate recognition system, which method can I think of to locate the license plate using opencv that you mentioned or deep learning such as yolo, which one is more useful in practical application?
Check this out: ruclips.net/video/0-4p_QgrdbE/видео.html
Thanks a lot brother🙌
Anytime @Sakshi!
sir can this be applied in a video MP4?
How to make use of deep learning to improve it's accuracy.. I'm actually new to this do i don't really know much
Nah no stress man, welcome to the fam! You can do it in a few ways:
1. Use a one step model to identify the frame (deep learning can improve the plate detection) then use standard OCR
2. Use a two step model to both identify the frame and extract the text!
Thank you so much bruhh!!! I'll research on this and get better at it.. and your video really helped me alot
@@psybertron2650 awesome stuff, let me know how you go!
can u do this with deep learning ?
@@meriljayasinghe9292 EasyOCR, is actually using PyTorch in the background to perform the detection!
it is not working for me
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-wvn_it83\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
it is showing me this no matter how many times i am editing
Hey, amazing video first of. I do have one problem with the mask, it does not mask out the numberplate but instead masks out the window, any clue how i can fix this?
Hold up on it, I've actually got a significantly better version of it coming this week!
@@NicholasRenotte Oh that is great to hear? Does it use something like TensorFlow?
@@jaap6384 sure does!
Awesome vid Nick, surprised you don't have more subs. Any chance of considering doing semantic segmentation, particularly with the human body.
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 (ruclips.net/video/KAaXbGr9o0s/видео.html), Python is defs coming!
@@NicholasRenotte Wow thanks!
@@Andy-rq6rq anytime hombre!
Hi Nick, Great Video!!
One question, Is it possible to run this on a mp4 file.
To add on, i have some images of carplates where they dont detect the carplates but detect something else instead of the carplates not sure why pls help me thanks!
Heya, try walking through the new tutorial. It's way more accurate: ruclips.net/video/0-4p_QgrdbE/видео.html