{"id":19972780,"url":"https://github.com/as567652/histogram-equilization","last_synced_at":"2026-04-15T21:31:42.668Z","repository":{"id":106470831,"uuid":"407903394","full_name":"as567652/Histogram-Equilization","owner":"as567652","description":"Code snippet to adjust image contrast using Histogram Equalization with the help of OpenCV and Matplotlib library.","archived":false,"fork":false,"pushed_at":"2021-11-22T19:29:08.000Z","size":899,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T18:27:08.456Z","etag":null,"topics":["computer-vision","digital-image-processing","histogram","histogram-equalization","matplotlib","opencv","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/as567652.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-18T15:54:11.000Z","updated_at":"2021-11-24T04:02:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"2195f6a4-7cfd-4b86-9060-31d8ae5f7fa7","html_url":"https://github.com/as567652/Histogram-Equilization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/as567652/Histogram-Equilization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/as567652%2FHistogram-Equilization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/as567652%2FHistogram-Equilization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/as567652%2FHistogram-Equilization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/as567652%2FHistogram-Equilization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/as567652","download_url":"https://codeload.github.com/as567652/Histogram-Equilization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/as567652%2FHistogram-Equilization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31861302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","digital-image-processing","histogram","histogram-equalization","matplotlib","opencv","python3"],"created_at":"2024-11-13T03:09:13.222Z","updated_at":"2026-04-15T21:31:42.435Z","avatar_url":"https://github.com/as567652.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Histogram Equilization\n\nCode snippet to adjust image contrast using Histogram Equalization with the help of **OpenCV** and **Matplotlib** library in python 3.\n\n![](https://img.shields.io/badge/OpenCV-v3.4-%23006cff?style=for-the-badge\u0026logo=opencv)\n![](https://img.shields.io/badge/Python3-v5.4-yellow?style=for-the-badge\u0026logo=python)\n![](https://img.shields.io/badge/Matplotlib-v5.4-%236610f2?style=for-the-badge\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAB2lBMVEUAAAD///////////////////+xs7Pl6OiHh4eOjo7s7Oz09PScnJympqatra27u7vOzs7BwcHCwsLHx8fn5+e6urvIyMicnJyxsbHX2NnAwMDJycnCwsKxs7O6urq7u7vJycmsrKxIZatUa6Vue2BxbGd0va55i3Z5jsWXcU6Y2pacrpagoKCoqKiq2Kivr6+wdU6wttGxu7Gzvb2z1rK0uaC4sLO5ubm72Lu8t7W8uLe8yLy9vMC9wMHA0YvBwcHCrqXCz7HDw8PEq6DEyczEzaLF3U7Iz9HI2MvI41vLx8XLycjLy8vMuHvMy9DMzMzOs0HO0cnP1dfQgUTQkGvRs6fSjmLSvG/S1dbTwbnT09PUfgDU0MfU0tHV1dXV19jV4NTWuQDWycTW1tbY2N7Z2dnZ2drc3Nzc3d3c3uDdyKbd3d3ekVje3t7e4OXfikTfy4Xf4OHg4eDg4ePhwEHh4ODh4eHjxD/j4+Pk5OTp6+7qkUrq7PLr6+3r7fPs7Ozt7e3u7e7u7u7v7+/v8/byk0Hz8/b08/H1jyb19fX41Ef4+Pj4+Pn5+fn61kP7kh77+Pv7+/v7+/z8/Pz9/f39/v79///+/v7/oFb/o1n/pmX/3mD/3mb///+K1by6AAAAInRSTlMAAChERmKjpaapq62vtL2+vr+/v8fP0N/f4urs7e/w9PT9ASJnrgAAAPZJREFUeNocjgNTBHAcBX+nbNu2zclNtm27iadsXG6/a/9u9N7uaEVEo9E4BkenhTqrI3Z2qJ0axALtrsoo9lhY+ep+NwGvQcpoXO4G+r6PumY7617mbr2UaIGG9c/Ri4qmtg+m9eLEyOZh+XnvTH3ZHuAuYXTctC4W9FTnc22FEMk83f/9edhIjsuOZfXZVinpa5M7/UupifFJMZdDJmuhRLB9fJaQO9GYNf5mhEhxA3a3yCs6GS4GvEU7BsvLTykZlFzVcKATjSezNsylOWaqHpsDVJgm8P6/2gz8zVsW4hmRdKAA0HMVojDvsggrOJkrCLGC+AA9MlD6ac5sNAAAAABJRU5ErkJggg==)\n\n![](https://img.shields.io/badge/Digital\u0026nbsp;Image\u0026nbsp;Processing-Histogram\u0026nbsp;Equilization-green?style=for-the-badge)\n![](https://img.shields.io/badge/Digital\u0026nbsp;Image\u0026nbsp;Processing-Computer\u0026nbsp;Vision-green?style=for-the-badge)\n\n## Table of contents\n* [Introduction](#introduction)\n* [Technologies](#technologies)\n* [Setup](#setup)\n* [Launch](#launch)\n* [Working](#working)\n* [Illustrations](#illustrations)\n* [Status](#status)\n* [Sources](#sources)\n* [Other](#other)\n\n\n## Introduction\nHistograms are the basis for numerous spatial domain processing techniques. Histogram manipulation can be used for image enhancement. Information inhereted from histogram is quite useful in other image processing applications, such as image compression and segmentation. Histograms are simple to calculate in software and also lend themselves to economic hardware implementations, thus making them a popular tool for real-time image processing.\n\u003cbr\u003e\nIn this code i have tried to implement histogram equilization where image with low contrast or high contrast can be modified to look like new and refreshing image just by application of simple mathematics.\n\u003cbr\u003e\n\u003cbr\u003e\n**Histograms of an image before and after equalization.**\n\u003cp align = 'center'\u003e\n  \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/c/ca/Histogrammeinebnung.png\" width=50%\u003e\n\u003c/p\u003e\n\n\n## Technologies\n  #### Software Used :\n  * VS Code 1.60.1\n  #### Languages Used :\n  * Python 3\n  #### OS used :\n   * Ubuntu 20.04.3 LTS 64-bit\n\n\n## Setup\nFirst you must have these libraries and languages installed on your system -\n  * [Python 3](https://www.python.org/)\n  * [OpenCV](https://opencv.org/)\n  * [Matplotlib](https://matplotlib.org/)\n\n\n## Launch\nTo run the code, run this commands in terminal with main.py as in current directory and images in Images folder along with main.py\n```\n$ python3 main.py\n```\nWindow will pop-up with resultant images and their histograms.\n\n\n## Working\nModified image is obtained by mapping each pixel in the input image with intensity r k into a corresponding pixel with level *sk* in the output image.\nUsing this formula we can calculate new intensity of image based on intensities of whole image.\n\u003cbr\u003e\n\u003cp align = 'center'\u003e\n  \u003cimg src=\"Readme Images/formula_used.png\" width=50% title=\"Formula Used\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\nHere,\nMN is the total number of pixels in the image, nk is the number of pixels that have intensity rk and L is the number of possible intensity levels in the image\n\n\u003cbr\u003e\nSource :- Digital Image Processing (Third Edition) by Rafael C. Gonzalez and Richard E. Woods Topic - 3.3.1 (Pg 120)\n\n## Illustrations\n\n### Test-0\n\nImage Type - Low Contrast Image\n\n\u003cp\u003e\n  \u003cimg src=\"Readme Images/Test-0/Original.png\" width=48% title=\"Original Image\"\u003e\n  \u003cimg src=\"Readme Images/Test-0/Hist_Original.png\" width=48% title=\"Histogram Of Original Image\"\u003e\n\u003c/p\u003e\n\u003cp\u003e\n  \u003cimg src=\"Readme Images/Test-0/Equalized.png\" width=48% title=\"Equalized Image\"\u003e\n  \u003cimg src=\"Readme Images/Test-0/Hist_Equalized.png\" width=48% title=\"Histogram Of Equalized Image\"\u003e\n\u003c/p\u003e\n\n### Test-1\n\nImage Type - High Contrast Image\n\n\u003cp\u003e\n  \u003cimg src=\"Readme Images/Test-1/Original.png\" width=48% title=\"Original Image\"\u003e\n  \u003cimg src=\"Readme Images/Test-1/Hist_Original.png\" width=48% title=\"Histogram Of Original Image\"\u003e\n\u003c/p\u003e\n\u003cp\u003e\n  \u003cimg src=\"Readme Images/Test-1/Equalized.png\" width=48% title=\"Equalized Image\"\u003e\n  \u003cimg src=\"Readme Images/Test-1/Hist_Equalized.png\" width=48% title=\"Histogram Of Equalized Image\"\u003e\n\u003c/p\u003e\n\n## Project status\n  ***Completed***\n\n\n## Sources\n  * Images used in this project may be subject to copyright.\n  * [Digital Image Processing (Third Edition) by Rafael C. Gonzalez and Richard E. Woods](https://www.amazon.com/Digital-Image-Processing-Rafael-Gonzalez/dp/013168728X)\n  * [OpenCV Documentation](https://docs.opencv.org/2.4/opencv_tutorials.pdf)\n  * [Matplotlib Documentation](https://matplotlib.org/stable/contents.html)\n  \n\n## Other\n  By Abhinav Sharma.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas567652%2Fhistogram-equilization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fas567652%2Fhistogram-equilization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas567652%2Fhistogram-equilization/lists"}