layout | title | description | keywords | parent | grand_parent | nav_order | permalink | github-path |
---|---|---|---|---|---|---|---|---|
newocr |
Separation |
How character separation works during training in NewOCR. |
Separation, Character Separation, Line Separation |
Training |
Explanation |
2 |
/explanation/training/separation |
explanation/training/separation.md |
Character separation is the very first step in how the OCR works, where a similar process occurs during scanning. character separation allows each character to be broken into a separate group to perform future data calculation on.
Please note that this process does happen after binarization of the image, where in many OCRs would be paired with other preprocessing (Usually for dealing with natural images, which NewOCR does not support).
{% include line-separation.md %}
After each line is separated, the characters can be extracted. From a line, all touching black pixels are grouped together, and all vertically overlapping groups are grouped together in a list for each overlapping group. Each list is then ordered by Y value, and iterated through where each part is given an incrementing modifier, which is the same for every part of a character. It is also given the character from the known string in the training file later on.
If any characters require distance checks, such as the distance between a dot of a character and its base, the space between an =
, :
, etc. then it is calculated by the distance of the part and the base, divided by the height of the base. This allows for the distance to be highly scalable, as fonts' spacing ratios don't change when scaled. This calculated value is set as a meta value, which is averaged and put in the database in the future.