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.5.tar.gz (4.5 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: img2bw-0.1.5.tar.gz
  • Upload date:
  • Size: 4.5 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.5.tar.gz
Algorithm Hash digest
SHA256 f6a0c85bbb0be3a57ef9d936e585d85e31157f8a586e320c48d1562336af7dc2
MD5 ca5a062d1913176f88c2af40de634aa0
BLAKE2b-256 f83eac70dad96a9127ad4d440fec035b7426343b753ed54019cd07b0cd0c9dec

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