1. A system for determining bounding boxes, comprising: an input interface configured to receive an image; and a processor configured to: detect a line associated with connected components in the image; determine gap sizes within the line, wherein determining the gap sizes within the line comprises determining a line angle; determine a word structuring element size using the gap sizes; and determine bounding boxes for the line based at least in part on the word structuring element size.