Skip to content
/ swt.h Public

minimal, header only implementation for detcting text via Stroke Width Transform (SWT)

License

Notifications You must be signed in to change notification settings

Aadv1k/swt.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stroke Width Transform

Zero-dependency, public domain header-only library that implements Stroke Width Transform

See:

Quickstart

Grab a copy of swt.h and load it in your project as a stb-style lib

The documentation for functions is also contained within the header file

#define SWT_IMPLEMENTATION
#include "swt.h"

Examples

Here is how you would use this with stb

  /* ... */

    SWTImage image = { image_data, width, height, channels };
    SWTData *data = swt_allocate(width * height);

    swt_apply_stroke_width_transform(&image, data->components, data->results);
    
    // optionally visualize the points on the image
    swt_visualize_text_on_image(&image, data->results, 4);

    swt_free(data);

  /* ... */

this will produce the following output

Gallery

Original image Detected text (Highlighted in Gray)
original image detected text in gray
original image detected text in gray
original image detected text in gray

Tests

The tests are written using µnit find them at tests/

.\build.bat TEST
.\swt_test.exe

About

minimal, header only implementation for detcting text via Stroke Width Transform (SWT)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published