How to auto crop a car image to get the license plate

19 views (last 30 days)
I want this code to be able to crop a number plate within the bounding box. It has to be done manually atm.

Accepted Answer

Image Analyst
Image Analyst on 19 Jan 2016
Perhaps this demo will help:
If you get the letters like it shows, then you can use bwconvhull() and regionprops() to get the bounding box of all the letters it found. Then use imcrop() to crop it out.
  2 Comments
robo kit
robo kit on 20 Jan 2016
The bounding box did detect each letter on the license plate.. But I have to crop out the license plate first, then the bounding box will specifically detect the numbers. I'll try to do as you said. Get the bounding box of all the letters first, then use imcrop() to crop it out.
Image Analyst
Image Analyst on 20 Jan 2016
Be sure to use bwconvhull() first (after individual letter segmentation) otherwise you'll have a whole bunch of bounding boxes - one for each letter - instead of just one for the whole plate.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 19 Jan 2016
That is not possible as phrased. See http://uk.mathworks.com/matlabcentral/answers/232793-how-to-extract-license-plate and read all of the comments.
  7 Comments
Thorsten
Thorsten on 20 Jan 2016
Edited: Thorsten on 20 Jan 2016
@Walter: You forgot to add: ... and in absolute darkness... Honestly, license plates are meant to be read. I don't think that there is any legal license plate around in the whole wide world with black letters on a black plate, but you may prove me wrong.
Image Analyst
Image Analyst on 20 Jan 2016
I'm not exactly sure how it works but the automatic plate readers attached to the front of police cars might rely on the police car's headlights to illuminate it. Or maybe they have their own light source to shine out in a particular direction (towards parked cars or straight ahead).

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!