Optimized OCR black/white pixel algorithm

前端 未结 7 1905
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 06:30

I am writing a simple OCR solution for a finite set of characters. That is, I know the exact way all 26 letters in the alphabet will look like. I am using C# and am able to easi

7条回答
  •  时光说笑
    2021-02-06 07:09

    You could create a tree.

    Pick a pixel, and divide the letters into two buckets, based on the pixel being white or black. Then pick a second pixel, split the buckets into two buckets each based on that pixel and so on.

    You could try to optimize the depth of the tree by choosing pixels which give buckets which are approximately equal in size.

    Creating the tree is a one time preprocess step. You should not have to do it multiple times.

    Now when you get an alphabet to match, follow the tree based on the pixels set/not set and get your letter.

提交回复
热议问题