This model calculates the histogram, PMF and CMD of a given matrix fast.
Project description
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:
Histogram of the sample image:
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
imhist-0.0.4.tar.gz
(176.4 kB
view details)
Built Distribution
File details
Details for the file imhist-0.0.4.tar.gz
.
File metadata
- Download URL: imhist-0.0.4.tar.gz
- Upload date:
- Size: 176.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b92218bde95780e60fb5030d48b82d7cda57c3275397f4a070f166df6a77412 |
|
MD5 | 4abeb2446f93e698f1e1a778764781f8 |
|
BLAKE2b-256 | 049c2a4f04aab4e18cdd6251ee0c040ea2b5229cc3c47ad9b8e2a3891eb213d6 |
File details
Details for the file imhist-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: imhist-0.0.4-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01179e7db8d135bf60576a1e2a51c663cc781fa693d25ae8362d248686312e6a |
|
MD5 | 77b73b71299b0c788d237a2cd79d151a |
|
BLAKE2b-256 | 7977fa41252751afeaff464bc4315ef2f057c7dec2aee2c158c497171f952b45 |