Skip to main content

Command-line application to binarize images

Project description

img2bw

img2bw is a simple command-line application to binarize images.

Binarization algorithms: otsu, isodata, li, local, mean, minimum, multiotsu, niblack, sauvola, triangle, yen.

Requirements

  • Python3

Installation

Open the terminal, go to the folder of this package and type:

pip install img2bw

Usage

To binarize a single image, type:

img2bw image.jpg --method otsu

To binarize all the images in a directory, type:

img2bw input_dir/ --output output_dir/

If no method is specified, otsu will be used.

You can try all the methods using --method try-all

More options

To view all the available options, type img2bw --help in the terminal:

usage: img2bw [-h] [-o OUTPUT] [-e {jpg,jpeg,jfif,png,tiff,bmp,pnm}]
              [-m {otsu,isodata,li,local,mean,minimum,multiotsu,niblack,sauvola,triangle,yen,try-all}]
              [-b BLOCK_SIZE] [-c NUM_CLASSES]
              input

positional arguments:
  input                 Input file or directory

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Output file or directory
  -e {jpg,jpeg,jfif,png,tiff,bmp,pnm}, --output-ext {jpg,jpeg,jfif,png,tiff,bmp,pnm}
                        Output file extension
  -m {otsu,isodata,li,local,mean,minimum,multiotsu,niblack,sauvola,triangle,yen,try-all}, --method {otsu,isodata,li,local,mean,minimum,multiotsu,niblack,sauvola,triangle,yen,try-all}
                        Method used to perform the binarization
  -b BLOCK_SIZE, --block-size BLOCK_SIZE
                        Odd size of pixel neighborhood which is used to
                        calculate the threshold value (local threshold)
  -c NUM_CLASSES, --num-classes NUM_CLASSES
                        Number of classes to be thresholded (multiotsu)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img2bw-0.1.4.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file img2bw-0.1.4.tar.gz.

File metadata

  • Download URL: img2bw-0.1.4.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for img2bw-0.1.4.tar.gz
Algorithm Hash digest
SHA256 656ed70b2027e4e3d18a2df75a78f26f7c143375a285ee15b88c5c1890c7896a
MD5 d2fa7b85b19e2c1e1d95a52937859c61
BLAKE2b-256 2073b5567dd5bbe734e790b9a39b08d26d890f422492e7237c2aefa41b6cc47d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page