How to distinguish between different license plates using OpenCV

335 Views Asked by At

Currently working on licentiate detection system and need some guidance on how to proceed. I can capture (via video playback) and with the help of an open source library called OpenALPR display the license plates directly to the terminal, now the issue is it capture on a frame by frame basis so it capture the same license plate multiple times. I added a frame skip variable and now it skips however many number of frames I want it to but the issue is still there.

Furthermore, I'd like to distinguish between different license plates if possible but don't know how to work around that, I've attempted employing basic object detection and detection but failed miserably.

Below is an image of the program running, as seen it detects a single license plate and display multiple instance of it, now the issue is I expect it to move on to the next car and display Plate#1, unfortunately it does not and continues feeding into Plate #0 Program Running

Program Running

The function that actually helps display the license plate text is below, really the first line does all the work. OpenALPR is a pretty powerful.

results = alpr.recognize_ndarray(frame)         
    for i, plate in enumerate(results['results']):             
    best_candidate = plate['candidates'][0]             
    print('Plate #{}: {:} ({:}%)'.format(i, 
          best_candidate['plate'].upper(),   
          best_candidate['confidence']))

I'd like some guidance towards how I can solve this problem? Which is basically distinguish between different license plates.

1

There are 1 best solutions below

2
On

It is a general problem without general solution, because it highly depends on context. Some thoughts:

If it is a video feed you can track the plate movement, the track will "jump" when it detects another plate. Let say the maximum optical flow velocity is 100 px/frame, if it jumps more than this threshold, you can suppose it is a new plate.

Depending on you video quality and detector, may there be spurious jumps, I would add a Kalman filter or any simple filter.

Perhaps there is a minimum time lapse between a plate goes out the image and the next arrives. You can use a time threshold to trigger the "changed plate alert" event.