Search for a tool
Image Histogram

Tool to calculate the grayscale histogram of an image. An histogram is a graphical representation of the distribution of colours among the pixels of a numeric image.

Results

Image Histogram -

Tag(s) : Image Processing

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Image Histogram' tool for free! Thank you!

Image Histogram

Image Histogram Generator

  [X]





Answers to Questions (FAQ)

What is an image histogram? (Definition)

An image histogram is a type of statistical graph distribution of color intensities in an image. It uses the abscissa of the colors and the number of pixels for each color for the ordinate, which makes it possible to quickly evaluate the distribution of the colors within the image image.

In practice, the colors are usually limited to 255 levels of gray, the image is previously converted into grayscale (luminance).

How to compute an histogram?

Iterate over each pixel in the image and calculate the gray level of the pixel. Increment a counter corresponding to each gray level.

The histogram is the summary table of these values, which can then be displayed in graphic form.

On dCode, this work is done automatically, upload an image file (JPG, PNG, etc.) and click on Analyze.

Example: <dfn>histogram</dfn>

On the horizontal axis are the 256 gray/luminance values.

On the vertical axis the number of pixels in the image having this luminance value.

Why calculate a histogram?

A histogram can be used to determine whether an image is underexposed or overexposed, in order to adjust the brightness and contrast of the image.

It is potentially possible to hide information in the histogram, such as a drawing/silhouette.

Example: <dfn>histogram</dfn>-new-york-skyline has its own drawing as a histogram (Credit: joshmillard)

How to compute a grayscale value?

Histogram is based on the frequency of luminance in the image from 0 (black) to 255 (white). The luminance is computed for each pixel with the formula 0.2126*R+0.7152*G+0.0722*B (ITU BT.709).

NB: to speed up the calculations, sometimes the formula (R + G + B) / 3 is used (not recommended)

How is organised an histogram?

The colors are organized according to their tone, blacks are on the left and on the right are whites, in the middle are gray tones.

Gray levels or color values are usually normalized to a scale of 0 to 255.

How to display an Histogram in Matlab?

Use the imread function to load an image, then imhist to display its histogram.

Example: imhist(imread(image));

How to interpret a histogram to evaluate the contrast?

To assess contrast from a histogram, observe the distribution of values along the horizontal axis.

A histogram with a distribution spread over the entire range of grayscale or color indicates good contrast, while a histogram concentrated in a narrow range may indicate poor contrast.

How to differentiate an overexposed image and an underexposed image from the histogram?

An overexposed image will tend to have a histogram pushed to the right, with an accumulation of pixels towards higher grayscales or color values.

An underexposed image will show a shifted histogram to the left, with pixels mostly concentrated towards grayscale or low color values.

How to calculate lumens from the histogram?

Lumens are a measure of the total amount of visible light emitted by a light source. A histogram does not directly calculate lumens, but only the distribution of light intensities in an image. If this image is (back-)lit, then it is the power of this lighting which will provide lumens.

Source code

dCode retains ownership of the "Image Histogram" source code. Except explicit open source licence (indicated Creative Commons / free), the "Image Histogram" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Image Histogram" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Image Histogram" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

Cite dCode

The copy-paste of the page "Image Histogram" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Image Histogram on dCode.fr [online website], retrieved on 2024-12-21, https://www.dcode.fr/image-histogram

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Image Histogram' tool for free! Thank you!


https://www.dcode.fr/image-histogram
© 2024 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.
 
Feedback