https://github.com/sunsided/stroke-width-transform
Python implementation of and experiments with the Stroke Width Transformation and connected components filtering.
https://github.com/sunsided/stroke-width-transform
computer-vision image-processing ocr python stroke-width
Last synced: 10 months ago
JSON representation
Python implementation of and experiments with the Stroke Width Transformation and connected components filtering.
- Host: GitHub
- URL: https://github.com/sunsided/stroke-width-transform
- Owner: sunsided
- License: mit
- Created: 2018-05-10T15:34:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-15T17:32:49.000Z (over 5 years ago)
- Last Synced: 2025-03-17T00:08:41.679Z (10 months ago)
- Topics: computer-vision, image-processing, ocr, python, stroke-width
- Language: Python
- Homepage:
- Size: 1.92 MB
- Stars: 17
- Watchers: 2
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Stroke Width Transform
A test implementation of the Stroke Width Transform algorithm
described in the paper [Detecting Text in Natural Scenes with Stroke Width Transform](https://www.microsoft.com/en-us/research/publication/detecting-text-in-natural-scenes-with-stroke-width-transform/) (PDF [here](paper/201020CVPR20TextDetection.pdf)):
> We present a novel image operator that seeks to find the value of stroke width for each image pixel, and demonstrate its use on the task of text detection in natural images. The suggested operator is local and data dependent, which makes it fast and robust enough to eliminate the need for multi-scale computation or scanning windows. Extensive testing shows that the suggested scheme outperforms the latest published algorithms. Its simplicity allows the algorithm to detect texts in many fonts and languages.
## Example
To run SWT with connected components against the `text.jpg` example image, execute
```bash
python main.py images/text.jpg
```
Given the following image ...

... it will find these connected components:

## Conda environment
A conda environment is available in `environment.yaml`. To create and activate it, run
```bash
conda env create -f environment.yaml
conda activate swt
```
## Original publication
```bibtex
@InProceedings{epshtein2010detecting,
author = {Epshtein, Boris and Ofek, Eyal and Wexler, Yonatan},
title = {Detecting Text in Natural Scenes with Stroke Width Transform},
year = {2010},
month = {June},
abstract = {We present a novel image operator that seeks to find the value of stroke width for each image pixel, and demonstrate its use on the task of text detection in natural images. The suggested operator is local and data dependent, which makes it fast and robust enough to eliminate the need for multi-scale computation or scanning windows. Extensive testing shows that the suggested scheme outperforms the latest published algorithms. Its simplicity allows the algorithm to detect texts in many fonts and languages.},
publisher = {IEEE - Institute of Electrical and Electronics Engineers},
url = {https://www.microsoft.com/en-us/research/publication/detecting-text-in-natural-scenes-with-stroke-width-transform/},
}
```
## License
The code in this repository is made available under the MIT license (see [LICENSE.md](LICENSE.md)).