View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Straighten image

5.0 | 2 ratings Rate this file 26 Downloads (last 30 days) File Size: 5.34 KB File ID: #40239 Version: 1.4
image thumbnail

Straighten image


Jan Motl (view profile)


11 Feb 2013 (Updated )

The function finds the document orientation.

| Watch this File

File Information

The function is useful for automatic image straightening.

Three different approaches how to find the image orientation were implemented: Fourier transform, Hough transform and region properties.

The principle of using Fourier transformation for orientation detection is well described at:

Hough transformation finds lines in the picture. The description of Hough transformation is at:

In a similar problem, horizon detection, only the longest line determines the image orientation:

However, in text orientation detection it is beneficial to consider all lines' direction to improve signal-to-noise ratio. This late approach is implemented.

Finally region properties binarizes the image and then uses REGIONPROPS from Image Processing Toolbox to calculate blob's orientation.

Required Products Image Processing Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
08 Jun 2016 Soumya Panda

10 Jun 2014 Matthew

25 Feb 2013 1.1

Added Fast Fourier Transform.

14 Apr 2013 1.4

Improved text description. Added blob detection.

Contact us