python - OpenCV: Isolating licence plate characters for OCR -


i attempting automatically read license plates. have trained opencv haar cascade classifier isolate license plates in source image reasonable success. here example (note black bounding rectangle). haar cascade classifier following this, attempt clean license plate either:

  • isolating individual characters classification via svm.
  • providing cleaned license plate tesseract ocr whitelist of valid characters.

to clean plate, perform following transforms:

# assuming 'plate' sub-image featuring isolated license plate height, width = plate.shape # enlarge license plate cleaned = cv2.resize(plate, (width*3,height*3)) # perform adaptive threshold cleaned = cv2.adaptivethreshold(cleaned ,255,cv2.adaptive_thresh_gaussian_c, cv2.thresh_binary,11,7) # remove residual noise elliptical transform kernel = cv2.getstructuringelement(cv2.morph_ellipse,(3,3)) cleaned = cv2.morphologyex(cleaned, cv2.morph_close, kernel) 

my goal here isolate characters black , background white while removing noise.

using method, find 1 of 3 results:

image noisy.

noisy

too removed (characters disjointed).

blotchy

reasonable (all characters isolated , consistent).

okay

i've included original images , cropped plates in album.

i realise due inconsistent nature of license plates, need more dynamic clean method, i'm not sure started. i've tried playing parameters of threshold , morphology functions, leads over-tuning towards 1 image.

how can improve clean function?

what trying pretty challenging , samples show still among easy ones.

in first place, important obtain delimitation of main characters area.

for vertical delimitation, try , find horizontal white lines act separators. harder cases such "too noisy", can compute statistics along horizontal lines, such distribution of white , black runs - count, average length, deviation of lenghts -, , find discriminating parameters between lines across true characters , features (by way, implicitly detect white lines).

doing so, obtain rectangles formed rows of same type, may accidentally fragmented. try merge rectangles seem belong true characters. next step of processing limited rectangle.

for vertical delimitation, things aren't easy because wil see cases characters split vertical lines can traverse them, , cases distinct characters joined dirt or other clutter. (in terrible cases, characters can touching on extended area.)

by technique similar above, find candidate vertical lines. have little other choice forming several hypothesis, , enumerate possible combinations of these separators, constrained fact characters have minimum spacing (between axes).

after have formed hypothesis, can decide best combination performing character recognition , computing overall score. (at stage, don't think possible perform segmentation without knowing possible shapes of characters, , why recognition enters play.)


Comments

Popular posts from this blog

Add new key value to json node in java -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

javascript - Highcharts Synchronized charts with missing data points -