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.6.tar.gz
(4.8 kB
view details)
File details
Details for the file img2bw-0.1.6.tar.gz
.
File metadata
- Download URL: img2bw-0.1.6.tar.gz
- Upload date:
- Size: 4.8 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 768ea2db8b7f8bb53d6a089424887df70ee5294aba755a9dbe1e4082a13a206d |
|
MD5 | 63ba39cf46b1db2d7a5653887d4d387f |
|
BLAKE2b-256 | 4237c325174a94edd1d228c61d6629a749ae178686525d4c18c8f3dd2a1cbdd6 |