0% found this document useful (0 votes)
4 views13 pages

Document 12

This lab report focuses on histogram analysis of images, detailing objectives such as analyzing pixel intensity distribution and understanding image brightness and contrast. It includes implementation tasks using OpenCV and Python, demonstrating how to draw histograms for grayscale and color images, as well as manual calculations and thresholding effects. The report concludes that histogram analysis is essential for evaluating and enhancing digital images.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views13 pages

Document 12

This lab report focuses on histogram analysis of images, detailing objectives such as analyzing pixel intensity distribution and understanding image brightness and contrast. It includes implementation tasks using OpenCV and Python, demonstrating how to draw histograms for grayscale and color images, as well as manual calculations and thresholding effects. The report concludes that histogram analysis is essential for evaluating and enhancing digital images.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 of 13

DHAKA INTERNATIONAL UNIVERSITY


Satarkul, Badda, Dhaka, Bangladesh
Department of Computer Science & Engineering

Lab Report (04)


Topic: Histogram Analysis of an Image
Couse Number: CSE – 420
Couse Name: Image Processing
2 of 13

Submitted by, Submitted to,

Name:Md. Jamil Ibn Jaman Name: Md. Manirujjaman


Roll: 01 Designation: Lecturer
Department: CSE Department: CSE
Batch: 69th Dhaka International University
Batch Semester: 12th
Submission Date: 20-11-2025

1. Objectives:
▪ To analyze the distribution of pixel intensity values in a digital image.
▪ To understand the brightness and contrast characteristics of an image
using its histogram.
▪ To identify whether an image is dark, bright, or evenly balanced through
histogram interpretation.
▪ To apply histogram plotting techniques using image processing tools for
better image analysis.
3 of 13

2. Introduction:
In image processing, a histogram is a graphical representation that shows
how pixel intensity values are distributed within an image. It displays the
number of pixels at each brightness level, ranging from dark to bright.
Histogram analysis is used because it helps in understanding the overall
brightness, contrast, and tonal distribution of an image. By studying the
histogram, we can easily determine whether an image is too dark, too bright,
or well balanced. This analysis also guides various image enhancement
techniques such as contrast adjustment, thresholding, and segmentation,
making it an essential tool in digital image processing.

3. Implementation (OpenCV + Python)


Task-01: Draw a histogram of a given grayscale image.
Input Image:
4 of 13

Source Code:

Histogram:
5 of 13
6 of 13

Task-02: Draw the histograms of the three color channels (Red, Green, and
Blue) of the given original color image.

Source Code:
7 of 13

Histogram output:
8 of 13

Task-03: Calculate the histogram of a grayscale image manually (without


using any OpenCV built-in functions).
Source Code:
9 of 13

Histogram Output:
10 of 13

Task-04: Convert a grayscale image (with intensity levels 0–255) into a binary
image such that all pixel values less than or equal to 150 are set to 0, and all
pixel values greater than 150 are set to 255. Then observe how the histogram
changes accordingly.

Source Code:

Histogram Output:
11 of 13
12 of 13

4. Performance Comparison:SS
• The histogram of the original grayscale image shows a continuous
distribution of intensity values based on the brightness and contrast of the
image.

• The histogram of the manually calculated version matches the


OpenCV-generated one, confirming correctness.
• After thresholding, the histogram changes drastically:
• Most pixels move to 0 (black) or 255 (white).
• The middle intensity range disappears completely. This
demonstrates how threshold-based segmentation simplifies the
pixel distribution into two major classes.
5. Conclusion:
Histogram analysis helps us understand the overall brightness and
contrast of an image. It clearly shows how pixel values are
distributed from dark to bright regions. By comparing different
histograms, we can easily observe how image processing improves
13 of 13

clarity and detail. Overall, histogram analysis is a simple yet


powerful method for evaluating and enhancing digital images.

You might also like