SWT for OCR

来源:互联网 发布:电路板绘制软件 编辑:程序博客网 时间:2024/06/18 17:04

Introduction

SWT stands for Stroke Width Transform which is an algorithm often used for text detection in an OCR application.

Resources

Primarily two online resources have been particularly appealing to me due to its open source nature. Both implementations are C/C++ based.

  • TextDetection
  • VCC

Algorithm Description

TextDetection

Overview

TextDetection is a direct implementation of the original SWT algorithm published in a CVPR paper Detecting text in natural scenes with stroke width transform 1

The related resources can be found in the following web page:
Text Detection on Nokia N900 Using Stroke Width Transform

Key steps

1). Extract the stroke width at every pixel

  • the key insight is that letters have roughly parallel side
  • the algorithm depends on the gradient pointing into the letters

Main differences from the original work

  • allowing the gradient directions to be up to 90 apart, instead of 30
  • cannot detect light-on-dark and dark-on-light text simultaneously. Run twice to achieve the effect
  • The original mentions some capacity for doing this, but it’s unclear how its done
  • considering two pixels as neighbouring if the ratio of their stroke widths is between 1/3 and 3.
  • Boost graph library is used
  • use some of the heuristic rules from [original work] for filtering.

Main difference

  • original work seems to do some kind of tracing of the rays formed in the first stage
  • height threshold of 300 pixels is discarded
  • the ratio of the diameter of a component to its SW mean

3). Chaining

  • Use heuristics to find eligible pair
  • the pairs are sorted by distance and then merged if they share an end (i.e. a component) and have a similar direction

Main difference

  • vastly different results from the paper!

VCC


  1. www.math.tau.ac.il/~turkel/imagepapers/text_detection.pdf ↩
0 0
原创粉丝点击