A Python package for calculating Benford's Law statistics on images
Project description
benstats
A Python package for calculating Benford's Law statistics on images
Table of Contents
Installation
pip install benstats
Usage
Importing the package
import benstats
Read an image
image = benstats.read("path/to", "image.png")
Supported image formats: bmp, dib, jpeg, jpg, jpe, jp2, png, webp, pbm, pgm, ppm, pxm, pnm, sr, ras, tiff, tif, exr, hdr, pic
Calculate Benford's Law statistics
benstats.benstats(image, channels=['rgb', 'gray'], scale=1, min=0, max=255)
channels
: list of channels to calculate statistics for. Possible values:rgb
,hsv
,gray
,lab
,luv
,xyz
,ycbcr
scale
: scale factor for the image. Ifscale
is less than 1, the image will be downsampled. Ifscale
is greater than 1, the image will be upsampled.min
: new range min to map pixel values into. Default: 0max
: new range max to map pixel values into. Default: 255
Returns a dictionary of channelwise statistics.
Plotting Benford's Law statistics
benstats.benplot(image, channels=['rgb'], scale=1, min=0, max=255)
Same parameters as above.
License
benstats
is distributed under the terms of the MIT license.
Built by @gv-sh @bhaumikdebanshu
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
benstats-0.0.2.tar.gz
(460.0 kB
view hashes)