当前位置: 首页 > 工具软件 > Paperwork OCR > 使用案例 >

SWT for OCR

皇甫飞跃
2023-12-01

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.

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
 类似资料:

相关阅读

相关文章

相关问答