0% found this document useful (0 votes)
3 views7 pages

Histogram Modification Techniques

The document outlines a procedure for modifying histograms of images using techniques like brightness adjustment and contrast stretching in MATLAB. It describes the effects of adding constants to pixel values, the use of the imadjust function for histogram stretching, and the importance of understanding image intensity ranges. Additionally, it covers the visualization of transformation functions and the application of gamma correction for customized intensity transformation.

Uploaded by

Arofath
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)
3 views7 pages

Histogram Modification Techniques

The document outlines a procedure for modifying histograms of images using techniques like brightness adjustment and contrast stretching in MATLAB. It describes the effects of adding constants to pixel values, the use of the imadjust function for histogram stretching, and the importance of understanding image intensity ranges. Additionally, it covers the visualization of transformation functions and the application of gamma correction for customized intensity transformation.

Uploaded by

Arofath
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
You are on page 1/ 7

Name: Sles Rofath

ID: B20232459

AB-ASSIGNMENT: HISTOGRAM MODIFICATION TECHNIQUES

Procedure

1. Display original image and prepare subplot

2. Obtain a brighter version of input image by adding 0.1 to each pixel

I. After the brightness adjustment (adding a constant like 0.1 or 0.5 to the image), the
histogram shifts to the right.

3. Produce another brighter image by adding 0.5 to original image

II. The variable bad_values contains the indices of pixels in the image I3 whose
intensity values exceed 1 after adding the constant 0.5.
II. The variable bad_values contains the indices of pixels in the image I3 whose

intensity values exceed 1 after adding the constant 0.5.

III. The third plot shows an excessive number of pixels with a value of 1 because
many pixel values exceeded the maximum allowed value after adding 0.5. These
values were clipped to 1, creating a large peak at that intensity level in the histogram.

4. This step ensures that all previously opened figure windows are closed
before new plots are generated, to avoid clutter or confusion when
displaying new images and histograms. Syntax: close all;

IV. After the adjustment using imadjust, the histogram is stretched across a wider
intensity range. This results in improved image contrast and more even distribution of
pixel values across the full dynamic range.

V. The stretchlim function is used to calculate the limits for contrast stretching of an
image. It determines appropriate values for low_in and high_in, which are used by the
imadjust function to remap image intensities. However, the explanation in the text
clarifies that:

• The imadjust function by default performs histogram stretching.

• This means the low_in, high_in, low_out, and high_out parameters are optional
if the goal is basic contrast stretching.

• Therefore, calling imadjust with just the image as a parameter already achieves
the stretching without needing stretchlim.
6. Histogram stretching using imadjust(I) with default parameters produced a
result identical to the previously stretched image. The difference image,
computed using imabsdiff, was entirely black, and both min and max values
of the difference image were 0. This confirms that using imadjust alone
(without explicitly setting limits) performs the same operation as using it
with stretchlim.
Result:

VI. The difference image likely appears completely black, confirming that imadjust
with default parameters gives the same result as using specific stretch limits,
demonstrating that stretchlim isn’t strictly necessary for basic histogram stretching.

VII. Inspecting the maximum and minimum values of an image's histogram allows us
to understand the dynamic range of intensity values present in the image. This
information is crucial when we want to shrink the histogram because we need to
explicitly specify which part of the intensity range we want to map into a smaller
output range. By providing these explicit values (e.g., [0.25 0.75]), we control the
intensity scaling and reduce the spread of pixel values, effectively compressing the
contrast of the image.

7. This step ensures a clean working environment in MATLAB before running


the new code. You would typically use:
• close all;
• clear;
• clc;

9. Display the transformation function for the adjustment performed in the


previous step.
This code visualizes the transformation function that was applied to the pixel
values:

• X is the original image pixel intensities (reshaped to a 1D array).

• Y is the adjusted image pixel intensities (also reshaped).

• plot(X, Y, '.') plots how each original pixel value was transformed.

VIII. These two lines reshape the images into 1D vectors so they can be plotted
against each other:

• X becomes a 1D vector of original image pixel values.

• Y becomes a 1D vector of the adjusted (shrunk) image pixel values.

This setup is used to create a scatter plot (with plot(X, Y, '.')) that visualizes the
transformation function applied to the pixel values during histogram adjustment.
IX. xlabel and ylabel are used in MATLAB to label the x-axis and y-axis of a plot.

10. This instruction ensures a clean workspace by closing any previously


opened figures. You do this in MATLAB with: close all;
11. This code performs histogram shrinking and applies a gamma correction
with a value of 2.
• A gamma value of 2 compresses bright intensities and emphasizes
darker ones.
• It changes the shape of the transformation curve, making it non-
linear.
• Combining this with shrinking [0.25 0.75] results in a more
customized intensity transformation.

Result:

X. This happens because:

• The input image (I) does not have any pixel values between 0 and 12.

• As a result, when plotting the transformation (plot(X, Y, '.')), there are no X


values in that range.

• This gap in the transformation function plot indicates that the original image’s
pixel values start from a higher intensity, skipping the lower range.

You might also like