Given an image consisting of text in both horizontal and vertical orientation, I want to detect in which bounding box vertical text is present and what is the orientation of the corresponding box's text itself (top to bottom or horizontal stacked vertical). So far what i have come up with helps only in detecting box's orientation:
Use sobel edge detector to get edges of the text and then dilate them. I can then perform connected component analysis to get the bounding of each component. By comparing the bounding box's width and height, I could tell if the box's orientation is horizontal or vertical(assuming the text is written close so that after dilation i would get the whole text as a single component and not only one character per bounding box).[Sample Output of dilated edge mask]
But this only works for the case when text is written close to be detected as a single component (what if the text is of large size and has big spaces among characters) and only tells the orientation of box.
I have seen a lot of posts and research papers but most of them are concerned about the case where the whole document is rotated at some angle or are using ml. I just need some heuristics using image processing, which would help me in detecting the above with some reasonable accuracy.