Skip to main content

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

PyPI - Version PyPI - Python Version


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. If scale is less than 1, the image will be downsampled. If scale is greater than 1, the image will be upsampled.
  • min: new range min to map pixel values into. Default: 0
  • max: 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


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.3.tar.gz (746.0 kB view hashes)

Uploaded Source

Built Distribution

benstats-0.0.3-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

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