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:
- for each detected bounding box (d_bbox), define search range centre of bounding box ± 2 * s
- in search area, other bounding box centres (o_bbox), other detected characters
- 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
Post a Comment