Hi, everyone!❤🧡💛💚💙💜
This is my first project!✔
This is the project of license plate location and segmentation. Actually, this is my experiment with digital image processing course. Through thinking about some basic algorithm ideas and the process of constantly adjusting parameters, I successfully completed this project.
- The "test.jpg" is the original image, and the "bin_img.jpg" is a picture that I preprocessed.
- When you run script
"segment.py"
,you can see two windows as follow,also every character will be saved in your directory.
The second window shows the characters of the license plate segmentation. If you want to display each character separately, you can modify my code to achieve.
This setp includes gray conversion
, threshold processing
and orphological operation
.
If the sum of a certain column of pixels is 0
, it can be used as the position of the dividing line
.
Since only one dividing line needs to be located between the characters, the difference method
is used here to remove the continuous lines: all continuous values with a difference less than D
are set to the first value in the range, and then the duplicates are removed.
Through the difference
, we can successfully cut the characters, but there is an annoying separator
. I used a special judgment. Traverse the lines, extract the ROI of each part, display and save characters through formatting control.
Tips: The above is the character segmentation, and the next is the positioning of the license plate.😛😛
Are you ready?
Low-Pass Filtering
: to remove noise;OTSU and Canny
: to detect edges;
Remove some black holes in the characters and noise.
What's the most important thing is to find the correct ratio of the liscense?
Through testing here, I found that the ratio of 3.5 to 4
is the best.
In addition, the size of the license plate of a small car is 440mm×140mm
in our country.
When you run script "locate.py", you will see windows as follow:
When you run script main.py
, you will see every character
as follow:
A character will appear every time you enter!
Finally,we will see the windows of such liscense plate!
**Tips:**You can adjust the parameters to observe the positioning effect.
I integrated "segment.py" with "locate.py", that called "main.py"
.
Since it is the first time for me to work on a project, I don't have much experience.
So, If there is any unreasonable description, please correct me~~ Thank you very much!!😂😂