A Python package for calculating Benford's Law statistics on images
Table of Contents
pip install benstatsimport benstatsimage = 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
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,ycbcrscale: scale factor for the image. Ifscaleis less than 1, the image will be downsampled. Ifscaleis 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.
benstats.benplot(image, channels=['rgb'], scale=1, min=0, max=255)Same parameters as above.
benstats is distributed under the terms of the MIT license.
Built by @gv-sh @bhaumikdebanshu