ghnmqdtg / image_histogram_equalization

A project to implement the histogram equalization with Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Histogram Equalization with Python

Introduction

This project is to implement histogram equalization with Python. You can put the target image in folder ./src and set the configurations in ./config. For details, please refer to the comments in the codes.

Results

Input and Output

For the example image, I decreased the brightness of the original image and converted it to grayscale.

Input image Output image

Analysis

The following two plots compare the PDF (Probability Density Function) and CDF (cumulative distribution function) of input and output images.

As you can see, after applying the histogram equalization, the pixel intensity distribution (PDF) becomes more dispersed. And the CDF is uniformly distributed.

PDF CDF

Development Environment

Python 3.9.6
MacOS 12.6

How to use it?

  1. Install the dependencies

    pip install -r requirements.txt
  2. Update the config.py if needed

  3. Run the main.py

    python main.py
<style> td { /* border:black thin solid; */ max-width:50%; width:50%; } table { width:100%; } </style>

About

A project to implement the histogram equalization with Python

License:MIT License


Languages

Language:Python 100.0%