viphough
Open this model

# Rotation Correction

This demo takes rotating text and aligns it horizontally using the Hough Transform and Polyfit blocks. The techniques illustrated by this demo can be used in video stabilization and optical character recognition (OCR).

## Contents

- Demo Model
- Text Alignment Using Hough Transform Subsystem
- Post-Processing: Text Alignment Using Polynomial Fit Subsystem
- Rotation Correction Results
- Available Demo Versions

## Demo Model

The following figure shows the Rotation Correction demo model:

## Text Alignment Using Hough Transform Subsystem

The morphological operators in the Smudge text subsystem blur the letters to create a binary image with two distinct lines. You can see the result of this process in the Smudged Video window.

By transforming the binary image into the Hough parameter space, the demo determines the theta and rho values of the lines created by the Smudge text subsystem. Once the theta values of the text lines are known, the demo uses the Rotate block to eliminate the large angular variations.

## Post-Processing: Text Alignment Using Polynomial Fit Subsystem

The demo uses the Polyfit block, in the slope correction subsystem, and the Rotate block to eliminate small angular variations in the text. The Polyfit block fits a straight line to the smudged text. Then the slope correction subsystem calculates the slope of the line and its angle of inclination. The Rotate block uses this angle to correct for the small rotations.

## Rotation Correction Results

The Input Video window shows the original video. The Smudged video window shows the result of blurring the letters to create a binary image with two distinct lines. In the Hough Matrix window, the x- and y-coordinates of the two dominant yellow dots correspond to the theta and rho values of the text lines, respectively. The Corrected video window shows the result of the rotation correction process.

## Available Demo Versions

Windows® only: viphough_win.mdl

Platform independent: viphough_all.mdl

Windows-only demo models might contain compressed multimedia files or To Video Display blocks, both of which are only supported on Windows platforms. The To Video Display block supports code generation, and its performance is optimized for Windows.