Histogram Modification Techniques
Histogram Modification Techniques
ID: B20232459
Procedure
I. After the brightness adjustment (adding a constant like 0.1 or 0.5 to the image), the
histogram shifts to the right.
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
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:
• 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.
• 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:
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.
Result:
• The input image (I) does not have any pixel values between 0 and 12.
• This gap in the transformation function plot indicates that the original image’s
pixel values start from a higher intensity, skipping the lower range.