opencv - OCR: Exponent detection, super/subscripts(C++) -


i have been able recognize characters, such 1, 2, 3, ..., n.

i have been having trouble thinking of way detect number exponent of another.

for example, after running program this picture should return (5/6)^2, can't figure way or idea number exponent.

any suggestions? using opencv in c++.

when detecting characters, have respective bounding boxes. there assumptions made, knowing approximate scale of characters, let's call s - infer size of detected bounding boxes.

based on try following:

  1. for each detected bounding box (d_bbox), define search range centre of bounding box ± 2 * s
  2. in search area, other bounding box centres (o_bbox), other detected characters
    1. for each centre found in search region, compute ratio between d_bbox , o_bbox. exponent character size should smaller number => d_bbox/o_bbox > 1.

i'd should around 1.5 depends on font etc. play values , see get.

some other heuristics might help:

  • d_bbox_centre_x < o_bbox_centre_x
  • d_bbox_centre_y < o_bbox_centre_y

the number left of exponent , it's centre lower on page exponent's centre.

i wouldn't try detect parentheses because there can instances in don't use them write exponent.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -