How to detect text orientation in an image?
It doen\'t matter if the orientation is upside down (180 deg).. But if the text lines is vertical (90 or 270 deg) I need
You can use the Hough Transform to detect the longest lines in your image and then find the predominant slope of those lines. If the slope is close to zero, your text is horizontal; if it's close to infinity, your text is vertical.
You don't mention if you're using a library to do this, but in OpenCV you could use HoughLinesP. I used this tutorial on an image found on wikimedia:
to get this image:

Then I rotated the original image:

to get this:

Since you're only interested in horizontal or vertical, you can just test whether the difference in the x-coordinates of the line endpoints is close to zero (vertical) or the difference in the y-coordinates is close to zero (horizontal).