LAb07DIPtasks
LAb07DIPtasks
DIP Lab
Submitted By:
Shaista (22-SE-90)
Submitted To:
Section:
Omega (Ω)
Date:
04-03-2024
TASK # 01:
Without using Matlab built-in functions for applying and creating smoothing filters create
an averaging filter and apply on a noisy image to smooth it.
CODE:
subplot(1, 2, 2);
imshow(smoothed_img);
title('Smoothed Image (Averaging Filter)');
OUTPUT:
TASK # 03:
Read a video file and apply averaging on it by using image addition. Observe the results
and mention in your findings.
CODE:
% Display result
figure, imshow(frame_avg), title('Averaged Video Frame');
OUTPUT:
TASK # 05:
Create a mask and by applying it on image, extract a particular area of image (using
threshold) and implement logical operations (OR, NOT) by referencing example.
CODE:
% Display results
figure;
subplot(2, 3, 1), imshow(img), title('Original Image');
subplot(2, 3, 2), imshow(mask), title('Masked Image (Thresholding)');
subplot(2, 3, 3), imshow(not_mask), title('NOT Operation on Mask');
subplot(2, 3, 4), imshow(or_mask), title('OR Operation on Mask');
subplot(2, 3, 5), imshow(extracted_region), title('Extracted Region Using
Mask');
LAB 06 tasks
Task 01
Implement negation
transform
A=imread('rice.png');
figure,imshow(A);title('Original Image');
%Image Negative
L=256;
s= (L-1)-A;
figure,imshow(s);title('Image negative -> S = L - 1 - r')
TASK 2 Implement
Logarithmic transform.
A=imread('rice.png');
figure,imshow(A);title('Original Image');
%Log Transformation
%Input Image in type double
r=double(A);
C=1;
S=C*log(1+r);
%maximum value of r is 255, log(256) ensures that the transformed imagescales
properly to fit within the displayable range.
Temp=255/(C*log(256)); %This step calculates a normalization factor.
%Display image range [0 255]
B=uint8(Temp*S);
figure,imshow(B);title('Log Transformation -> S = clog(1+r)');
% Display results
figure;
subplot(1,2,1);
imshow(img);
title('Original Image');
subplot(1,2,2);
imshow(sliced_img);
title('Gray Level Slicing (Without Background Removal)');
for i = 1:length(GRng)
X = C * (R .^ GRng(i)); % Apply Power-law transformation
Temp = 255 / max(X); % Normalize output range
s = Temp * X;