Skip to content

Latest commit

 

History

History
66 lines (41 loc) · 1.88 KB

File metadata and controls

66 lines (41 loc) · 1.88 KB

stbithresgrad

Grad (aka Gradient Snip) threshold an image based of Gauss blur. Used:

    O = (I < T) ? BLACK : WHITE

      T = B * k + TG * (1 - k) + delta

        B = blur(I)

        TG = sum(I * G) / sum(G)

          G = |I - B|

    bounds:
            BLACK, if I < lower,
            WHITE, if I > upper.

This filter was first applied in STEX (2024) in a single-component version (Y).

Here this filter is implemented in a full-color version.

Usage

./stbithresgrad [-h] [-i] [-s sigma] [-k coeff] [-d delta] [-l lower] [-u upper] input-file output.png

-s sigma The sigma of the gauss normal distribution (number >= 0.5). Larger values result in a stronger blur.

-k coeff The coefficient local threshold.

-d delta The regulator threshold.

-l lower The bound lower threshold.

-u upper The bound upper threshold.

-i Info to stdout.

-h display this help and exit.

You can use either sigma to specify the strengh of the blur.

The performance is independent of the blur strengh (sigma). This tool is an implementation of the paper "Recursive implementaion of the Gaussian filter" by Ian T. Young and Lucas J. van Vliet.

stb_image and stb_image_write by Sean Barrett and others is used to read and write images.

Installation

  • Clone the repo or download the source git clone --recurse-submodules https://github.com/ImageProcessing-ElectronicPublications/stbithresgrad
  • Execute make
  • Done. Either use the stbithresgrad executable directly or copy it somewhere in your PATH.

Links