Find a baseline from Image containing Arabic Text - image-processing

How can I find baseline from image containing Arabic Text:
I have tried with histogram (vertical and horizontal) but unable to find generic code which can give me absolute value.

Related

OpenCV: Add text to image and get the bounding box of each letter

I read the documentation of the OpenCV function putText(). I could not find there any parameter or returned value that tells where each printed letter is located.
Is there some OpenCV API that gives this data while adding text to images, or maybe in some different library?
You can calculate the width and height of the text you're putting on image by:
cv::Size textSize = cv::getTextSize(text, fontFace, fontScale, thickness, &baseline);
Check for example here.
Take a look at my answer, the code may be interesting for your purpose: Detect space between text (OpenCV, Python)
It is used to recognize handwriting text and do ROI on given image.

How to check if an image contains horizontal or vertical text region

I have images with text written vertically in some cases and horizontally in others. I need to process horizontal and vertical text images differently. Hence, for that I need to first check if the image contains a vertical text or not.If someone can suggest some way of finding if an image contains vertical text or not, it will be helpful. For example see the following imageshttps://i.stack.imgur.com/A5txz.jpg and https://i.stack.imgur.com/7LU28.jpg. The first one contains a vertical text and the second one contains a horizontal text.

Segmentation/Matching arabic characters

I have many pictures like this and i want to segment each character alone by using any matching technique.
So I manually segmented a letter of this word , and i used a simple image difference of this image with slide in the original image of the same size.
This didn't work for all the words due to the variation of the character in the word itself as sometimes the window of the original image includes other characters.
So what's the optimum technique to match or to get the characters of the original image ?

Math Latex horizontally aligned with text

So I am using the flashcard software Anki which uses LaTex for its math equation formatting
So when I write an equation with a fraction in the same line as standard text, it automatically allignts the lowest point of the equation, in the case the denomitor of the fraction, with the bottom the normal text. How can I get the equation and text to be horizontally aligned.
Some text before an equation: [$]\frac{x^2}{y}[/$]
What I did was to make the equation itself a bit smaller to better match the text around it.
To add it for all equations go to: Tools > Manage Note Types > Options > Header
Or you could place it inline: [$]\tiny[/$]
An excellent writeup on sizing text this way can be found at tex.stackexchange
And you may be able to get better results by changing the font itself.
As the LaTeX snippets are finally rendered as images, this is a CSS issue. The equations become centered when you add the following rule to your card CSS:
img[src*="latex"] {
vertical-align: middle;
}
This CSS rule matches all images whose file name contains the string latex and centers them in their respective line of text. It thus matches all anki-generated latex images.
If needed, I can supply info on how to edit the card CSS or on how to make Anki and Latex work together.

iOS recognize text and text separators

I am using Tesseract for text recognition.
How can I simply recognize padding between text and create e.g. pdf or .doc file with the same padding?
Let's say that the source page contains 3 columns with some text (like a news paper). How can I recognize this text with appropriate padding and margin to each other and to page?
Maybe you can suggest example or library that does the same or just algorithm?

Resources