Skip to content

Mamdasn/imhist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI Latest Release Package Status Downloads License Repository Size

imhist

This model calculates the histogram, PMF and CMD of a given image fast.

Installation

Run the following to install:

pip install imhist

Usage

import cv2
import numpy as np
from imhist import imhist, imcdf
import matplotlib.pyplot as plt

img = cv2.imread('assets/Plane.jpg')
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
v = hsv[:, :, 2].copy()

v_hist = imhist(v)
v_pmf = imhist(v, PMF=True)
v_cdf = imcdf(v)

plt.figure(num=1)
plt.plot(np.arange(256), v_hist, 'b', label='Histogram')
plt.ylabel('Number of Occurrences')
plt.xlabel('Brightness')
plt.grid(which="both")
plt.legend()
plt.show()

Output

This is a sample image:
Sample Image
Histogram of the sample image:
Histogram of the Sample Image

About

This module calculates the histogram of a given image fast.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages