I just found the solution to Detect and fix text skew and related article OpenCV - Rotation (Deskewing). But the solution is not work for some text rotated 90 degree.
I want to fix text rotated 90 degree like images below, Detect and fix text skew solution works for second image but first image is not work.