Rotation correction of image by detecting text box based on text detection model

  1. Rotate the image by 0 degrees, 22.5 degrees, 45 degrees, 67.5 degrees, and 90 degrees, and save these 5 pictures.
  2. Use a (lightweight) text detection model to perform text detection on these 5 pictures.
  3. Then select the angle with the largest long text box and the largest aspect ratio, as the approximate rotation angle judgment, and get the angle θ 1 ∈ (0, 22.5, 45, 67.5, 90) \theta1 \in (0, 22.5, 45, 67.5, 90)θ 1(0,22.5,45,67.5,90)
  4. Using the text box obtained in the previous step, count the largest long side inclination angles of the text box to obtain the angle θ 2 \theta2θ 2
  5. Through θ 1 \theta1θ 1 andθ 2 \theta2θ 2 to rotate the original image.

The original image on the left, the corrected image on the right, use 0 padding around, and the corrected image detection text box is drawn on the top.
Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/sdlypyzq/article/details/109260598