Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
789 views
in Technique[技术] by (71.8m points)

algorithm - De-skew characters in binary image

I'm working on number plate recognition. The problem is that I have to de-skew the characters in a binary image to increase the accuracy of template matching.

I have done a lot of pre-processing to remove unnecessary pixels of the image and I could segment the characters out. But unfortunately they are skewed.

From... converting to greyscale to binary

enter image description here

Then.. pre-processing techniques..

enter image description here

After segmentation..

enter image description here

As can be observed in the last image, the characters are skewed and this will lead to inaccuracy for template matching to perform recognition purposes.

Most of the researchers are using Hough transform to perform the de-skew operation but is there an easier way to do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are ways to deal with this. Some on the matching part to avoid the unskew operation itself like this:

But you want to unskew so:

  1. detect the rotation angle/skew slope

    Obtain bounding box, then cast vertical scan lines and remember first hit point and last regress line through all of them

    algo overview

  2. rotate/skew back by it

    So either use atan2 to obtain the angle or directly construct 2D homogenous 3x3 transform matrix based on basis vectors (one is the line and second is its perpendicular vector). For more info see:

  3. Now the rotated/unskew image will be still skewed bud in much much lower rate

    so you can apply #1,#2 in the horizontal axis too but this time you need to unskew only (do not use rotation). Usually the remnant skew ratio is small so this step is not necessary.

[notes]

You can boost the precision by filtering out wrong points or by carefully selecting the start point of scan lines so they hit in the right place of characters (you obviously know the characters count).

[edit1] small example

Here small example of output for your image (Negative as my functions are expecting white paper and black font):

example

As you can see the rotation and skew is much much smaller.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...