0% found this document useful (0 votes)
21 views2 pages

DIP Report With Code

Uploaded by

Vijith Satish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

DIP Report With Code

Uploaded by

Vijith Satish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Course: Digital Image Processing

Date: October 28, 2024


Submitted by: Vijith. S
U.S.N: 1JB21EC095
Digital Image Processing Subject: MATLAB-based Digital
Image Processing Operations
Activity - Based Learning Report

1. Introduction
This report focuses on the implementation of key digital image processing
operations using MATLAB. The practical exercise explores fundamental techniques,
including intensity slicing, gamma correction, image histogram analysis, and the
creation of a negative image. These techniques demonstrate the impact of pixel-level
manipulation and enhancement on grayscale images.

2. MATLAB Code and Output

2.1 MATLAB Code

% Load the grayscale image


image = imread('photo.jpeg');
if size(image, 3) == 3
image = rgb2gray(image); % Convert to grayscale if the image is RGB
end
% Define parameters
L = 255;
conditions = [0, L/2; L/2, 3*L/4; 3*L/4, L];
gamma_values = [0.2, 0.8];
% Initialize figure
figure;
% Display original image
subplot(4,2,1);
imshow(image);
title('Original Grayscale Image');
% Apply intensity slicing for each condition and display
for i = 1:3
low = conditions(i, 1);
high = conditions(i, 2);

% Intensity slicing
sliced_image = zeros(size(image), 'uint8');
sliced_image(image >= low & image <= high) = L;

subplot(4,2,i+1);
imshow(sliced_image);
title(['Intensity Slicing: Condition ' num2str(i)]);
end
% Perform gamma correction and display
for j = 1:length(gamma_values)
gamma = gamma_values(j);
gamma_corrected_image = uint8(255 * (double(image) / 255).^gamma);

subplot(4,2,j+4);
imshow(gamma_corrected_image);
title(['Gamma Correction, \gamma = ' num2str(gamma)]);
end
% Display histogram of the original image
subplot(4,2,7);
imhist(image);
title('Histogram of Original Image');
% Create and display the negative image
negative_image = L - image;
subplot(4,2,8);
imshow(negative_image);
title('Negative Image');

2.2 MATLAB Code

You might also like