This module attempts to enhance contrast of a given image by equalizing its two dimensional histogram.
Project description
im2dhisteq
This module attempts to enhance contrast of a given image by equalizing its two dimensional histogram. An easy way to enhance quality of a given image is to just equalize its histogram, but despite using minimum resources and a very short process time, there are a lot of drawbacks to it.
One of the ways to tackle drawbacks of histogram equalization method
is to instead equalize the image's two dimensional histogram
, as one dimensional histogram of a given image does not contain the image's contextual information. Tests on a multitude of images has shown, by taking contextual information of an image in addition to the image's histogram into account when attempting to enhance contrast, output images are significantly better in quality in compare to histogram equalizaion and a handful of other known methods.
You can access the article that came up with this method here.
Two Dimensional Histogram
Here is the source code for the im2dhist python library with a short description on how it's done.
Installation
Run the following to install:
pip install im2dhisteq
Usage
For images
im2dhisteq --input 'cloudy-day.jpg' --output 'assets/cloudy-day-2dhisteq.jpg' --w 6
For videos
vid2dhisteq --input 'video-input.mp4' --output 'video-output-enhanced.mp4' --w 6
Speed up
The speed of the program can be significantly increased if the go library lib-im2dhist.go
in src/go_libs in the package is compiled and moved to a dir in the system path. To compile, simply install go
. Then run
go mod init lib-im2dhist.go
go mod tidy
followed by running the script make-library
.
Showcase
- A one minute comparative video: https://youtu.be/7LrzX2ZpLAQ
- This is a sample image and its corresponding 2d-histogram equalized image.
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
Built Distribution
Hashes for im2dhisteq-1.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 120f0f5637a31116e6bd9f0f17ec187cacaa92b199ff4d29164036829cdc4204 |
|
MD5 | ad3d9300cf968c0dc6d016d0b2d21abd |
|
BLAKE2b-256 | 8b8f0eb399e79c18261f0a6b8be22ad87e23a494d07a051226987697eb485ab7 |