Home

Awesome

awesome-text-deskew

A curated list of awesome projects for image text skew detection/correction.

Let’s categorize according to solutions:

OpenCV rectangle

Get angle from minimum bounding rectangle of text contours.

  1. Detect the contours in the image, which includes text
  2. Obtain the minimum bounding rectangle based on the contours
  3. Retrieve the angle of the bounding rectangle

Hough Transform

Get angle from line by the hough transform.

  1. Calculate Hough lines in the image
  2. Find the angle of the majority of lines

EAST model

Get angle from text regions detected by the EAST model.

  1. Detect the position of text regions,
  2. Retrieve the angle of the region bounding box,
  3. Calculate the average tilt angle.

Pixel projection

Get angle with the minimum pixel density projection

same like Radon transform

  1. Rotate the image at multiple angles
  2. Calculate the cumulative sum of pixel values along each row
  3. Find the angle with the highest cumulative sum

Radon transform

Get angle with alternating pixel density projection

  1. Rotate the image at multiple angles
  2. Calculate the cumulative sum of pixel values along each row
  3. Find the angle with the highest cumulative sum or alternating cumulative sums

Detecting rotation and line spacing of image of page of text using Radon transform - gist @github

"River" detection in text - question @stackoverflow

Fourier projection

just like Pixel projection but use DFT not image

  1. DFT magnitude of image
  2. Collect the pixels that the center point to the edge point at each angle from magnitude
  3. Calculate the cumulative sum of pixel values along each angle
  4. Find the angle with the highest cumulative sum