Professional Documents
Culture Documents
Processing Processing(2181102)
Practical List – 2023-240
Sr.
List Date Sign
No
1 a) To read color image and convert it into gray scale.
(b) To read gray scale image and convert it into binary image.
(c) Convert binary image into negative image.
(d) Apply spatial resolution on original image by sampling
1/2, 1/4, 1/16 & 1/32 .Resize the output image again into the
orginal image with the same sampling level & comment the
result.
Apply different interpolation (Nearest Neighbourhood,
Bilinear & Bicubic) and comment on result.
2 Read an 8 bit image and then apply different image
enhancement techniques:
(a) Brightness improvement
(b) Brightness reduction
(c) Thresholding
(d) Negative of an image
(e) Log transformation
(f) Power Law transformation
3. a) Implement Gray level slicing (intensity level slicing) in
MATLAB to read cameraman image,
(b) To read an 8 bit image and to see the effect of each bit on
the image.
(c) To read an image and to extract 8 different planes i.e. ‘bit
plane slicing’.
4 To read an image, plot its histogram then do histogram
equalization and histogram specification. Comment in the
result. (With and Without using inbuilt functions)
5 To Implement Smoothing spatial filter.
Read an image and then corrupt it by ‘Salt and Pepper’,
‘Gaussian’, ‘Speckle’ noise then apply
(a) AVERAGING filter with 3x3 mask and 5x5 mask.
(b) MEDIAN filter with 3x3 and 5x5 mask.
(c) Max, Min, Midpoint filter with 3x3.
Comment on the results.
6 To read an image and apply (1) Gaussian 3x3 mask for burring
(2) High pass filter mask with different masks (3) Laplacian
operator with centre value positive and negative (4) High
boost filtering.
7 Implement various noise models and their
Histogram
Noise models are
i)Gaussian ii)Rayleigh iii)Erlang
iv) Salt and Pepper v)Exponential vi)Uniform
8 Write a MATLAB program for erosion and dilation and
opening & closing using inbuilt and without inbuilt function.
9 Analyse Effect of Different Mask (Sobel, Prewitt and Roberts,
Canny and Log ) on Edges of square with diagonals, as shown
in figure (plot it using MATLAB commands) Also apply
gaussian noise and then apply various edge operators and
comment on result
Theory:
1. Cropping:
Cropping involves selecting a specific region of interest within an image,
eliminating unwanted portions. This operation is fundamental for focusing on
particular details or resizing images.
2. Arithmetic Operations:
Arithmetic operations like addition and subtraction are applied to images for
various purposes, such as adjusting brightness or contrast. Multiplication and
division can be used for scaling or normalization.
3. Rotation:
Rotating an image involves transforming its orientation. This operation is
employed for correcting alignment issues, achieving a desired perspective, or
facilitating further analysis.
4. RGB to Gray Conversion:
Converting an RGB (Red, Green, Blue) image to grayscale simplifies its
representation to a single intensity channel, useful for certain analyses where color
information is unnecessary or counterproductive.
5. Linspace Resizing:
Linspace resizing involves resizing an image by interpolating pixel values along
specified lines. This method is useful for achieving smooth transitions during size
adjustments, preserving image quality.
These operations collectively contribute to the manipulation and enhancement of
images, supporting a wide range of applications from computer vision to medical
imaging. The choice and combination of these operations depend on the specific
requirements of the task at hand.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Questions:
1. Importance of Double precision, uint8 and im2double.
Double Precision:
Importance: Double precision uses 64 bits to represent a number, providing a wide
range and high precision. In image processing, where accuracy is crucial, double
precision can help avoid rounding errors and loss of information during
calculations.
Use Cases: Double precision is often used in algorithms that require high accuracy,
such as scientific computations or processing images with high dynamic range.
uint8:
Importance: uint8 is an 8-bit unsigned integer data type commonly used to
represent pixel values in digital images. It has a range from 0 to 255, making it
suitable for storing grayscale or color images with 8 bits per channel.
Use Cases: uint8 is widely used in image processing for storage and basic
operations like addition, subtraction, and multiplication. It is memory-efficient
and sufficient for many applications where high precision is not necessary.
im2double:
Importance: im2double is a function in MATLAB (and some other image
processing libraries) used to convert images from other data types (such as uint8)
to double precision.
Use Cases: When performing image processing operations that require double
precision accuracy, it is common to convert images from their original data types
(like uint8) to double precision using im2double before processing. This ensures
that calculations are performed with the desired precision.
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: A
Algorithm:
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Step-3: Convert any coloured image into gray image using function rgb2gray().
Step-4: Perform different arithmetic operations on image.
Step-5: Rotate the image using the function imroate().
Code:
Reading an image.
P1 = imread('C:\Users\Priyanshi\Desktop\mountain.jpg');
P1 = imresize(P1,[256 256]);
[X,map]=imread('C:\Users\Priyanshi\Desktop\mountain.jpg');
Cropping image.
P2 = imcrop(P1,[89 35 190 200]);
subplot(1,2,1);
imshow(P1);
title('Not croped');
subplot(1,2,2);
imshow(P2);
title('croped');
figure;
RGB to Gray.
P3 = rgb2gray(P1);
imshow(P3);
title('RGB2Gray');
figure;
Arithmetic operations.
P4 = imread('C:\Users\Priyanshi\Desktop\butterfly.jpeg');
P4 = imresize(P4,[256 256]);
P5 = imadd(P1,P4);
subplot(2,2,1);
imshow(P5);
title('addition');
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
P6 = immultiply(P1,P4);
subplot(2,2,2);
imshow(P6);
title('Multiplication');
P7 = imsubtract(P1,P4);
subplot(2,2,3);
imshow(P7);
title('Subtraction');
P8 = imdivide(P1,P4);
subplot(2,2,4);
imshow(P8);
title('Division');
figure;
Rotate.
P9 = imrotate(P1,270);
imshow(P9);
title('Rotation');
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Output:
Reading an image
Cropping image
Page | 6
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
RGB to Gray
Arithmetic operations
Page | 7
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Rotate
Page | 8
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: B
Algorithm:
Code:
clc;
close all;
clear all;
%% Reading image
i = imread('C:\Users\Priyanshi\Desktop\tree.jpg');
imshow(i);
subplot(2,2,2);
imshow(i1);
Page | 9
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
title('double image');
subplot(2,2,3);
imshow(i2);
title('im2double for uint8 image');
subplot(2,2,4);
imshow(i3);
title('im2double for double image');
figure;
i5 = uint8(i1);
subplot(1,3,2);
imshow(i5);
title('double to uint8 of i1');
i6 = uint8(i3);
subplot(1,3,3);
imshow(i6);
title('double to uint8 of i2');
figure;
%% Mathemetical operation.
i7 = imadd(i,30);
subplot(1,2,1);
imshow(i7);
title('imadd(i,30)');
i8 = imsubtract(i,30);
subplot(1,2,2);
imshow(i8);
title('imsubtract(i,30)');
figure;
Page | 10
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
%% Image multiplication.
K=immultiply(I,2);
figure,imshow(K);
%% Plotting histograms.
K1=histeq(K);
figure,imhist(K1);
I1=histeq(I);
figure,imhist(I1);
J1=histeq(J);
figure,imhist(J1);
Page | 11
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Output:
%% Reading image
Page | 12
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Function used:
i1 = double(i);
i2 = im2double(i);
i3 = im2double(i1);
%% Conversion of double to uint8 and plotting image.
Function used:
i5 = uint8(i1);
%% Mathematical operation.
Page | 13
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
i9 = reshape(uint8(linspace(1,255,25)),[5,5]);
i10 = im2double(i9);
Page | 14
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
%% Plotting histograms.
Conclusion:
Here we have observed the different operations on the image. Every operation
changes the Matrix value of the image and due to change in the value of different
pixels we can visualize our image in many different ways. We can crop, rotate, make
Black and white of any image. We can also plot the histograms for the images. Also
we can make images bright or dark also.
Page | 15
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Aim: Apply inbuilt function for image resize for the different scale 1/2/, 1/4/, 1/8
and 1/16. Similarly reconstruct the image with the scale 2,3,8,16. Apply Nearest
neighborhood, Bicubic and Bilinear methods. Compare the perceptual quality by
calculating MSE and PSNR.
Theory:
Image resizing is the process of changing the dimensions of an image. This can be
done by either increasing or decreasing the number of pixels in the image. When
an image is resized, the pixel information is manipulated to create a new image
that is the desired size.
There are two main types of image resizing:
Down sampling: This is the process of reducing the number of pixels in an
image. When an image is down sampled, some of the pixel information is
lost. This can result in a loss of image quality, especially if the image is
down sampled by a large amount.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Up sampling image
There are a number of different algorithms that can be used to resize images. The
best algorithm to use will depend on the specific requirements of the application.
Some of the most common image resizing algorithms include:
Nearest neighbor interpolation: This is a simple algorithm that replaces each
pixel in the resized image with the nearest pixel in the original image. This
algorithm is fast and efficient, but it can result in a blocky appearance in the
resized image.
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Code:
clc;
clear all;
close all;
%% Reading an image.
i = imread('tire.tif');
i = imresize(i,[256 256]);
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
i1 = imresize(i,2,'nearest');
subplot(3,3,2);
imshow(i1);
title('2x Zooming using NN');
I1 = imresize(i,1/2,'nearest');
subplot(3,3,3);
imshow(I1);
title('2x shrinking using NN');
subplot(3,3,4);
imshow(i);
title('Original Image');
i2 = imresize(i,4,'nearest');
subplot(3,3,5);
imshow(i2);
title('4x Zooming using NN');
I2 = imresize(i,1/4,'nearest');
subplot(3,3,6);
imshow(I2);
title('4x Shrinking using NN');
subplot(3,3,7);
imshow(i);
title('Original Image');
i3 = imresize(i,8,'nearest');
subplot(3,3,8);
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
imshow(i3);
title('8x Zooming using NN');
I3 = imresize(i,1/8,'nearest');
subplot(3,3,9);
imshow(I3);
title('8x Shrinking using NN');
figure;
i4 = imresize(i,2,'bilinear');
subplot(3,3,2);
imshow(i4);
title('2x Zooming using bilinear');
I4 = imresize(i,1/2,'bilinear');
subplot(3,3,3);
imshow(I4);
title('2x shrinking using bilinear');
subplot(3,3,4);
imshow(i);
title('Original Image');
i5 = imresize(i,4,'bilinear');
subplot(3,3,5);
imshow(i5);
title('4x Zooming using bilinear');
I5 = imresize(i,1/4,'bilinear');
subplot(3,3,6);
Page | 6
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
imshow(I5);
title('4x Shrinking using bilinear');
subplot(3,3,7);
imshow(i);
title('Original Image');
i6 = imresize(i,8,'bilinear');
subplot(3,3,8);
imshow(i6);
title('8x Zooming using bilinear');
I6 = imresize(i,1/8,'bilinear');
subplot(3,3,9);
imshow(I6);
title('8x Shrinking using bilinear');
figure;
i7 = imresize(i,2,'bicubic');
subplot(3,3,2);
imshow(i7);
title('2x Zooming using bicubic');
I7 = imresize(i,1/2,'bicubic');
subplot(3,3,3);
imshow(I7);
title('2x shrinking using bicubic');
subplot(3,3,4);
imshow(i);
Page | 7
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
title('Original Image');
i8 = imresize(i,4,'bicubic');
subplot(3,3,5);
imshow(i8);
title('4x Zooming using bicubic');
I9 = imresize(i,1/4,'bicubic');
subplot(3,3,6);
imshow(I9);
title('4x Shrinking using bicubic');
subplot(3,3,7);
imshow(i);
title('Original Image');
i10 = imresize(i,8,'bicubic');
subplot(3,3,8);
imshow(i10);
title('8x Zooming using bicubic');
I10 = imresize(i,1/8,'bicubic');
subplot(3,3,9);
imshow(I10);
title('8x Shrinking using bicubic');
i = imresize(i,[64 64]);
squared_diff = (i - I5).^2;
Page | 8
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
mse_bl = mean(squared_diff(:))
R = 10;
psnrValue_bl = 10 * log10((R^2) / mse_bl)
i = imresize(i,[64 64]);
squared_diff = (i - I9).^2;
mse_bc = mean(squared_diff(:))
R = 10;
psnrValue_bc = 10 * log10((R^2) / mse_bc
Output:
Page | 9
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 10
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
mse_n = 30.8198
psnrValue_n = 5.1117
mse_bl = 3.8554
psnrValue_bl = 14.1393
mse_bc = 0
psnrValue_bc = Inf
Conclusion:
We have applied image zooming and shrinking using resizing of an image. Here we
verified 2 times, 4 times and 8 times zooming and 2 times, 4 times and 8 times
shrinking also. All these different operations on the image are observable in the
above images. The MSE and PSNR values show that for this image that the bicubic
methods of the interpolation is the best for this image.
Page | 11
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Aim: Read an 8-bit image and then apply different image enhancement techniques:
(a) Negative of an image
(b) Log transformation
(c) Power Law transformation
Theory:
Image enhancement techniques are used to improve the quality and clarity of images.
They involve altering the visual representation of an image to provide a better
depiction but maintaining important details.
Negative of an Image
The negative of an image is achieved by inverting the colors. Dark areas become
light and vice versa. This technique can be used to enhance contrast and bring out
hidden details in the original image.
Log Transformation
Log transformation is a method used to expand the range of dark intensities in an
image, making them more distinguishable. It's particularly effective for images
with low contrast or non-uniform lighting.
1. Contrast Adjustment
Log transformation helps to enhance the contrast in images to make
them visually more appealing.
2. No Loss of Information
It allows for the enhancement of dark pixels without losing important
image details.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: A
Algorithm:
1. Read the image you want to perform enhancement on using imaread().
2. Convert image into grayscale if it is colored image.
3. Apply negative transformation by subtracting the original image from 255.
4. Apply log transformation according to formula log(1-r).
5. Apply gamma transformation according to the formula c(image)^gamma.
6. Show all images using imshow() function.
7. Plot the original image Vs enhanced image.
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Code:
clc;
clear all;
close all;
imshow(original_image);
figure;
title('Original Image');
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
subplot(2, 2, 1);
imshow(negative_image);
title('Negative Image');
subplot(2, 2, 2);
imshow(log_transformed_image, []);
title('Log Transformation');
subplot(2, 2, 3);
imshow(inverse_log_transformed_image);
title('Inverse log Transformation');
subplot(2, 2, 4);
imshow(power_law_transformed_image);
title('Power Law Transformation');
figure;
plot(original_image, negative_image);
hold on
plot(original_image, log_transformed_image);
hold on
plot(original_image, inverse_log_transformed_image);
hold on
plot(original_image, power_law_transformed_image);
hold off
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Output:
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: B
Algorithm:
1. Read the image using imread() function.
2. convert the image into double precision.
3. Ask for the choice of the user.
4. According to the 3 choices , if choice= 1 then use gamma image enhancement
technique.
5. If choice=2 then use negetive image enhancement technique.
6. If choice= 3 then use log image enhancement technique.
Code:
clc;
clear all;
close all;
I2=imread('tire.tif');
I=im2double(I2);
fprintf('for gamma press 1 \n for neg press 2 \n for
log press 3');
Page | 6
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
choice=input(':');
if choice == 1
c=input('enter value of C :');
gamma=input('enter gamma :');
gammaim=c*I^gamma;
imshow(gammaim)
end
if choice == 2
neg=256-1-I2
imshow(neg)
end
if choice == 3
c=input('enter value of C');
logim=c*log(I+1);
imshow(logim)
end
Output:
Page | 7
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Conclusion:
These techniques are commonly used for basic image enhancement tasks and can be
applied to grayscale as well as color images. Each technique has its own
characteristics and applications, and they can be combined with other enhancement
techniques for more complex image processing tasks.
Page | 8
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Aim: To read an image, plot its histogram then do histogram equalization. Comment
in the result. (With and Without using inbuilt functions)
Theory:
Histogram:
A histogram is a graphical representation of the distribution of numerical
data. It consists of a series of adjacent rectangles, or bins, that represent the
frequency or probability of occurrences of values within specified ranges in the
data. The x-axis of the histogram represents the range of values in the dataset,
while the y-axis represents the frequency or probability of those values occurring.
Histogram Equalization:
Histogram equalization is a technique used to adjust the contrast of an image
by redistributing the intensity values in the image's histogram. The goal is to obtain
a more uniform distribution of intensity values, which can improve the visual
appearance of the image. This technique is particularly useful for images with low
contrast or uneven lighting conditions.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: A
Algorithm:
1. Read the image using imaread().
2. Convert into grayscale if it is in RGB format.
3. Define the number of levels.
4. Create an empty vector name histogram which only have zeroes.
5. Go to each and every pixel using for loops and count occurrence of the pixel value.
6. Plot the histogram using bar plot.
Code:
clc;
clear all;
close all;
%% Initialize histogram
histogram = zeros(1, numLevels);
%% Calculate histogram
[rows, cols] = size(img);
for i = 1:rows
for j = 1:cols
pixel_value = img(i, j);
histogram(pixel_value + 1) = histogram(pixel_value + 1)
+ 1;
end
end
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
figure;
subplot(2,1,1);
bar(0:(numLevels-1), histogram, 'BarWidth', 1.0);
title('Image Histogram (user made)');
xlabel('Pixel Value');
ylabel('Frequency');
grid on;
Output:
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: B
Algorithm:
1. Read the image using imread().
2. Calculate the histogram equalization using histeq() function.
3. Plot the new images using imshow().
4. Plot the histograms using imhist().
Code:
clc;
clear all;
close all;
subplot(1,2,2);
imshow(j);
title('Equalized image');
%% plot histograms.
figure;
subplot(2,1,1);
imhist(i)
title('Histogram of original image');
subplot(2,1,2);
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
imhist(j);
title('Histogram of equalized image');
Output:
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: C
Algorithm:
1. Read the image using imaread().
2. Convert into grayscale if it is in RGB format.
3. Define the number of levels.
4. Create an empty vector name histogram which only have zeroes.
5. Go to each and every pixel using for loops and count occurrence of the pixel value.
6. Calculate CDF and create the equalized image by redefining the value using CDF.
7. Plot the image and histogram for equalized and normal images.
Code:
clc;
clear all;
close all;
%% Calculate histogram
[rows, cols] = size(img);
histogram = zeros(1, numLevels);
for i = 1:rows
for j = 1:cols
pixel_value = img(i, j);
histogram(pixel_value + 1) = histogram(pixel_value + 1)
+ 1;
end
end
%% Normalize histogram
Page | 6
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
title('Original Image');
subplot(1, 2, 2);
imshow(equalizedImage);
title('Equalized Image');
%% Plot histograms.
figure;
subplot(2,1,1);
imhist(img)
title('Histogram of original image');
subplot(2,1,2);
imhist(equalizedImage);
title('Histogram of equalized image');
Output:
Page | 7
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Conclusion:
Using inbuilt functions for reading an image, plotting its histogram, and performing histogram
equalization is more convenient and efficient, especially for tasks that require these operations
frequently or in real-time applications.
Page | 8
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Theory:
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Important notes:
Modifying bits directly can be complex and might require specific image
processing tools.
Changing certain bits might have unintended consequences due to
interactions with other bits and image formats.
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: A
Code:
clc;
clear all;
close all;
I=imread('trees.tif');
imshow(I),figure();
title('Original image')
[x,y]=size(I);
histarr=zeros(1,256)
for i=1:x
for z=1:y
if I(i,z)>=70 && I(i,z)<=200;
I(i,z)=255;
end
end
end
imshow(I);
Output:
Page | 6
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: B
Code:
clc;
clear all;
close all;
I=imread('trees.tif');
imshow(I);figure();
[x,y]=size(I);
B=bitget(I,1);subplot(3,3,1);
imshow(logical(B));
B1=bitget(I,2);subplot(3,3,2);
imshow(logical(B1));
B2=bitget(I,3);subplot(3,3,3);
imshow(logical(B2));
B3=bitget(I,4);subplot(3,3,4);
imshow(logical(B3));
B4=bitget(I,5);subplot(3,3,5);
imshow(logical(B4));
B5=bitget(I,6);subplot(3,3,6);
imshow(logical(B5));
B6=bitget(I,7);subplot(3,3,7);
imshow(logical(B6));
Page | 7
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
B7=bitget(I,8);subplot(3,3,8);
imshow(logical(B7));
out7=immultiply(B,1);
out6=immultiply(B1,2);
out5=immultiply(B2,4);
out4=immultiply(B3,8);
out3=immultiply(B4,16);
out2=immultiply(B5,32);
out1=immultiply(B6,64);
out=immultiply(B7,128);
finout1=imadd(out1,out);
finout2=imadd(finout1,out2);
finout3=imadd(finout2,out3);
finout4=imadd(finout3,out4);
finout5=imadd(finout4,out5);
finout6=imadd(finout5,out6);
finout7=imadd(finout6,out7);
subplot(3,3,9);
imshow(finout7);
Output:
Page | 8
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
PART: C
Code:
clc;
clear all;
close all;
I=imread('trees.tif');
[x,y]=size(I);
B=bitget(I,1);
B1=bitget(I,2);
B2=bitget(I,3);
B3=bitget(I,4);
B4=bitget(I,5)
B5=bitget(I,6);
B6=bitget(I,7);
B7=bitget(I,8);
Page | 9
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
out7=immultiply(B,1);
out6=immultiply(B1,2);
out5=immultiply(B2,4);
out4=immultiply(B3,8);
out3=immultiply(B4,16);
out2=immultiply(B5,32);
out1=immultiply(B6,64);
out=immultiply(B7,128);
finout1=imadd(out1,out);
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out5);
finout1=imadd(finout1,out6);
finout1=imadd(finout1,out7);
subplot(3,3,1);
imshow(finout1);
finout1=imadd(out1,out);
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out5);
finout1=imadd(finout1,out6);
subplot(3,3,2);
imshow(finout1);
finout1=imadd(out1,out);
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out5);
finout1=imadd(finout1,out7);
subplot(3,3,3);
imshow(finout1);
finout1=imadd(out1,out);
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out6);
finout1=imadd(finout1,out7);
Page | 10
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
subplot(3,3,4);
imshow(finout1);
finout1=imadd(out1,out);
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out5);
finout1=imadd(finout1,out6);
finout1=imadd(finout1,out7);
subplot(3,3,5);
imshow(finout1);
finout1=imadd(out1,out);
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out5);
finout1=imadd(finout1,out6);
finout1=imadd(finout1,out7);
subplot(3,3,6);
imshow(finout1);
finout1=imadd(out1,out);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out5);
finout1=imadd(finout1,out6);
finout1=imadd(finout1,out7);
subplot(3,3,7);
imshow(finout1);
finout1=out1;
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out5);
finout1=imadd(finout1,out6);
finout1=imadd(finout1,out7);
subplot(3,3,8);
imshow(finout1);
finout1=out;
finout1=imadd(finout1,out2);
finout1=imadd(finout1,out3);
finout1=imadd(finout1,out4);
finout1=imadd(finout1,out5);
Page | 11
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
finout1=imadd(finout1,out6);
finout1=imadd(finout1,out7);
subplot(3,3,9);
imshow(finout1);
Output:
Conclusion:
Gray level slicing is a technique in image processing where specific ranges of pixel
intensities are selected and highlighted in the output image. By using gray level
slicing, we can effectively highlight regions of interest based on their intensity
levels. In an 8-bit image, each pixel is represented by 8 bits, allowing for 256
different intensity levels (0 to 255). we can see how changing individual bits alters
the pixel intensity and, consequently, the appearance of the image. Bit plane slicing
is a technique used to extract specific bit planes from the binary representation of
pixel intensities in an image.
Page | 12
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Aim: To read an image and apply blurring effect and then apply
(1) Laplacian operator with center value positive and negative
(2) Composite Laplacian operator with center value positive and negative
(3) High boost filtering
Theory:
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
When the center value of a composite Laplacian operator is positive and the
surrounding values are negative, it indicates a focus on enhancing edges and
features that exhibit rapid intensity changes. This operator can be particularly
useful in edge detection and image sharpening tasks, as it highlights regions with
significant intensity gradients.
Algorithm:
Step1: Read an image using imread command.
Step2: Convert to grayscale if needed using rgb2gray().
Step3: Create an empty blurred image using command ones(), and apply averaging
mask blur the image.
Step4: Define the Laplacian mask for center value of 4 and 8.
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
%% Blur masking
blurKernel = 1/9 * ones(3, 3);
%% image dimensions
[rows, cols, ~] = size(img);
blurredImage = uint8(zeros(rows, cols, 3));
%% Blurring image
for i = 2:rows-1
for j = 2:cols-1
for k = 1:3
blurredImage(i,j,k) = sum(sum(double(img(i-1:i+1,j-1:j+1)) .*
blurKernel));
end
end
end
subplot(2,1,2);
imshow(rgb2gray(blurredImage));
title('Blurred Image');
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
laplacian_Negative = [0 1 0; 1 -4 1; 0 1 0];
laplacianImagePositive = conv2(double(grayImage), laplacian_Positive);
laplacianImageNegative = conv2(double(grayImage), laplacian_Negative);
figure;
subplot(2, 3, 1);
imshow(grayImage);
title('Original Image');
subplot(2, 3, 2);
imshow(uint8(abs(laplacianImagePositive)));
title('Laplacian Filter (Positive Center)(ceneter=4)');
subplot(2, 3, 3);
imshow(uint8(abs(laplacianImageNegative)));
title('Laplacian Filter (Negative Center)(center=4)');
subplot(2, 3, 4);
imshow(grayImage);
title('Original Image');
subplot(2, 3, 5);
imshow(uint8(abs(laplacianImagePositive)));
title('Laplacian Filter (Positive Center)(center=8)');
subplot(2, 3, 6);
imshow(uint8(abs(laplacianImageNegative)));
title('Laplacian Filter (Negative Center)(center=8)');
figure;
subplot(2, 3, 1);
imshow(grayImage);
title('Original Image');
subplot(2, 3, 2);
imshow(uint8(abs(cl_pos_img)));
title('Composite Laplacian Filter (Positive Center)(center=9)');
subplot(2, 3, 3);
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
imshow(uint8(abs(cl_neg_img)));
title('Composite Laplacian Filter (Negative Center)(center=9)');
subplot(2, 3, 4);
imshow(grayImage);
title('Original Image');
subplot(2, 3, 5);
imshow(uint8(abs(cl_pos_img)));
title('Composite Laplacian Filter (Positive Center)(center=5)');
subplot(2, 3, 6);
imshow(uint8(abs(cl_neg_img)));
title('Composite Laplacian Filter (Negative Center)(center=5)');
A = 1.5;
highBoostedImage = double(grayImage) + A * (double(grayImage) -
double(imfilter(grayImage, fspecial('average', 3), 'replicate')));
figure;
subplot(2, 2, 1);
imshow(grayImage);
title('Original Image');
subplot(2, 2, 2);
imshow(uint8(highBoostedImage));
title('High Boost Filtered Image (A=1.5)');
A = 1.2;
highBoostedImage = double(grayImage) + A * (double(grayImage) -
double(imfilter(grayImage, fspecial('average', 3), 'replicate')));
subplot(2, 2, 3);
imshow(grayImage);
title('Original Image');
subplot(2, 2, 4);
imshow(uint8(highBoostedImage));
title('High Boost Filtered Image (A=1.2)');
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Output:
Page | 6
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Conclusion:
This project aimed to demonstrate image processing techniques. The blurring effect
was applied to smooth the image, followed by the Laplacian operator for edge
detection, composite Laplacian for customized effects, and high boost filtering for
sharpness enhancement. These methods showcase the versatility and utility of image
enhancement techniques.
Page | 7
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Theory:
Noise models are essential in understanding and simulating various types of noise
that can affect signals or data in communication systems or image processing.
Each noise model has distinct characteristics that can help in analyzing and
processing noisy signals or images. Here's a brief overview of some common noise
models:
1. Gaussian Noise: Also known as white noise, it is characterized by a probability
density function (PDF) that follows a Gaussian distribution. It is commonly used
to model thermal noise in electronic systems.
2. Rayleigh Noise: This noise model is often used to describe the amplitude of
signals that have passed through a dispersive medium or encountered multipath
fading. It is characterized by a PDF that is proportional to the square of the
amplitude and an exponential term.
3. Erlang Noise: Erlang noise is a generalization of the exponential distribution
and is often used to model queuing processes. It is characterized by a PDF that
describes the time between events in a Poisson process with a rate parameter.
4. Salt and Pepper Noise: This type of noise is commonly seen in images and is
characterized by random occurrences of very bright (salt) or very dark (pepper)
pixels. It is often caused by errors in data transmission or storage.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Algorithm:
Step1: Read an image using imread command.
Step2: Using function imnoise() apply the noise like guassian, rayliegh, erlang,
uniform, salt & pepper and exponential.
Step3: Plot the images with the noise.
Step4: Plot the histograms for these noisy image using imhist().
Step5: Calculate the Probability Distribution Function (PDF) for all noisy images.
Step6: Plot the PDF for all noisy images.
Code:
clc;
clear all;
close all;
a=imread('F:\PD\Z Drive\IP\ip_noise_test.png');
a=rgb2gray(a);
a=double(a);
b=size(a);
%noisy_image=imnoise(a,'salt & pepper');
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
mmax=max(max(Re));
mmin=min(min(Re));
const=100/(mmax-mmin);
for x=1:1:r
for y=1:1:c
ne(x,y)=const*(Re(x,y)-mmin);
end
end
noisy_imagee=a+ne;
figure;
subplot(1,3,1);
imshow(uint8(a));
title('Original image');
subplot(1,3,2);
imhist(uint8(noisy_imagee));
title('Histogram of image with exponential
noise');
subplot(1,3,3);
imshow(uint8(noisy_imagee));
title('Original image with exponential noise');
%adding erlang noise to an image
e=2;
f=5;
k=-1/e;
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Rer=zeros(r ,c);
for j=1:f
Rer=Rer+k*log(1-rand(r,c));
end
mmax=max(max(Rer));
mmin=min(min(Rer));
const=100/(mmax-mmin);
for x=1:1:r
for y=1:1:c
noiseer(x,y)=const*(Rer(x,y)-mmin);
end
end
noisy_imageer=a+noiseer;
figure;
subplot(1,3,1);
imshow(uint8(a));
title('Original image');
subplot(1,3,2);
imhist(uint8(noisy_imageer));
title('Histogram of image with erlang noise');
subplot(1,3,3);
imshow(uint8(noisy_imageer));
title('Original image with erlang noise');
%adding gaussian noise to an image
Page | 6
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 7
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Output:
Page | 8
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 9
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Conclusion:
We analyzed the histograms of different noise models provides a clear visualization
of their distributions, aiding in the selection of appropriate noise models for specific
applications and in developing effective noise reduction strategies.
Page | 10
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Theory:
Erosion and dilation are fundamental operations in image processing,
particularly in the field of morphological image processing. They are used to
manipulate the shapes and sizes of objects in an image. Here's a breakdown of
their concepts and how they differ:
Erosion:
Concept: Erosion shrinks or thins the foreground objects in an image.
Imagine sliding a small structuring element (a shape like a square or
circle) over the image. A pixel in the original image is considered part of
the eroded image only if the structuring element completely fits on top of
it, and all corresponding pixels in the structuring element align with
foreground pixels in the image. This removes pixels at object boundaries
and small protrusions.
Effect: Erosion reduces the size of foreground objects, removes noise and
small details, and separates touching objects.
Applications: Erosion can be used for:
o Feature extraction (finding edges by eroding away irrelevant details)
o Object segmentation (separating connected objects)
o Noise reduction (removing small isolated bright or dark spots)
Dilation:
Concept: Dilation expands or thickens the foreground objects in an image.
Similar to erosion, we slide a structuring element over the image. A pixel
is considered part of the dilated image if at least one pixel in the
structuring element overlaps with a foreground pixel in the original image.
This adds pixels to the boundaries of objects and fills small holes within
them.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Algorithm:
1: Read an image using imread command.
2: Using strel() command, set the width you want to increase or decrease.
3: Apply erosion using the inbuilt command imerod().
4: Apply dilution using the inbuilt command imdilate().
5: Apply opening using the inbuilt command imopen().
6: Apply closing using the inbuilt command imclose().
7: Plot all the images using subplot and imshow() commands.
Code:
clc;
clear all;
close all;
%% Morphological Operations
%% imerode() function.
se = strel('disk',11);
erodedBW = imerode(i,se);
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
subplot(1,5,1);
imshow(i);
title('Original Image');
subplot(1,5,2);
imshow(erodedBW);
title('Edge Thikness increaed');
%% imdilate() function.
dilateImage = imdilate(i,se);
subplot(1,5,3);
imshow(dilateImage);
title('Edge Thikness decreased');
%% imopen() function.
openImage = imopen(i,se);
subplot(1,5,4);
imshow(openImage);
title('Opening of image');
%% imopen() function.
closeImage = imclose(i,se);
subplot(1,5,5);
imshow(closeImage);
title('Closing of image');
Output:
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Conclusion:
By applying the erosion, we have observed that the darker portion being thick compare to
original image. Dilution showed that the darker portion’s thickness is decreased compare
to the original. Opening is kind of similar to the erosion bur here we are not having
merging of the shapes. And closing of the image decreasing the thickness as much so that
the connection line in the image just disappeared but shapes remain almost same.
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Theory:
The Sobel, Prewitt, Roberts, Canny, and Laplacian of Gaussian (LoG) edge
detection masks are commonly used in image processing to detect and enhance
the edges in an image. Each of these masks has its own unique characteristics
and effects on the edges of an image.
1. Sobel Operator:
- The Sobel operator is a discrete differentiation operator that approximates the
gradient of the image intensity function.
- It is sensitive to both horizontal and vertical edges, and it produces thicker
edges compared to other operators.
- When applied to a square with diagonals, the Sobel operator will highlight
the edges of the square, including the diagonals, but the edges may appear
slightly thicker and more pronounced.
2. Prewitt Operator:
- The Prewitt operator is similar to the Sobel operator, but it uses a slightly
different kernel.
- It is also sensitive to both horizontal and vertical edges, but it tends to
produce thinner edges compared to the Sobel operator.
- When applied to a square with diagonals, the Prewitt operator will also
highlight the edges of the square, including the diagonals, but the edges may
appear slightly thinner compared to the Sobel operator.
3. Roberts Operator:
- The Roberts operator is a simple and fast edge detection algorithm that uses a
2x2 kernel.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
let's explore the application of Gaussian noise to a square with diagonals and
then apply various edge detection operators to observe the results.
1. Adding Gaussian Noise:
Gaussian noise is a type of electronic noise that has a normal
(Gaussian) distribution of random values.
When applied to an image, it can introduce random variations in
pixel intensities, simulating the effect of sensor noise or other
environmental factors.
Adding Gaussian noise to the square with diagonals will introduce
random variations in the pixel values, making the edges less distinct
and more difficult to detect.
Algorithm:
1: Read an image using imread command.
2: Convert to grayscale if needed using rgb2gray().
3: Add Gaussian noise using imnoise() command.
4: Apply Roberts filter using edge() command.
5: Apply Prewitt filter using edge() command.
6: Apply Sobel filter using edge() command.
7: Apply LOG filter using edge() command.
8: Apply Canny filter using edge() command.
9: Show the resultant images.
Code:
clc;
clear all;
close all;
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
%% Apply Noise
noisyImage = imnoise(img, 'Gaussian', 0.05);
subplot(2,3,1);
imshow(noisyImage);
title('Noisy Image');
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Output:
Conclusion:
the different edge detection operators have varying effects on the edges of a square
with diagonals, both with and without the presence of Gaussian noise. The Canny
edge detector and the LoG operator generally provide the most accurate and well-
defined edge representations, making them more suitable for applications where
edge detection is critical, even in the presence of noise.
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Theory:
To count the number of objects in an image, you can utilize various image
processing and computer vision techniques. Here's a comprehensive breakdown
of the theoretical concepts involved:
1. Image Preprocessing:
- Grayscale Conversion: Convert the RGB image into a grayscale image to
simplify the subsequent processing s.
- Noise Reduction: Apply techniques like Gaussian blurring to reduce noise and
smoothen the image.
2. Thresholding:
- Global Thresholding: Determine a global threshold value to create a binary
image, where pixels are classified as either object or background.
- Adaptive Thresholding: In scenarios where lighting conditions vary across the
image, adaptive thresholding is employed to determine the threshold for each local
region.
3. Contour Detection:
- Utilize contour detection algorithms to identify and extract the contours or
boundaries of objects in the binary image.
4. Object Counting:
- Counting Contours: Calculate the number of contours detected, which
corresponds to the number of distinct objects in the image.
5. Machine Learning Techniques (Optional):
- Object Detection Models: Utilize pre-trained object detection models such as
YOLO (You Only Look Once) or SSD (Single Shot MultiBox Detector) for
accurate and efficient object counting.
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
When evaluating the efficiency of an algorithm for counting the number of objects
in an image, several dependent parameters can be varied to assess its performance.
Here's a detailed breakdown on the parameters to consider:
1. Image Resolution:
- Vary the resolution of the input image to evaluate the algorithm's scalability
and robustness to images of different sizes.
2. Noise Levels:
- Introduce varying levels of noise in the input image to test the algorithm's
resilience to noise and its ability to accurately count objects in noisy environments.
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Code:
%% Read the image
image = imread('circles.png');
%% Convert the image to grayscale
if size(image, 3) == 3
image = rgb2gray(image);
end
%% Threshold the image to create a binary image
threshold = graythresh(image);
binaryImage = imbinarize(image, threshold);
%% Fill any holes in the binary image
binaryImage = imfill(binaryImage, 'holes');
%% Perform connected component analysis (CCA)
cc = bwconncomp(binaryImage);
numObjects = cc.NumObjects;
%% Display the original image and the binary image with detected
objects
subplot(1, 2, 1);
imshow(image);
title('Original Image');
subplot(1, 2, 2);
imshow(binaryImage);
title(['Binary Image with ', num2str(numObjects), ' objects']);
%% Display the count
disp(['Number of objects: ', num2str(numObjects)]);
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Output:
Conclusion:
This rule-based algorithm offers a fast and effective solution for counting objects in
controlled environments. However, its accuracy can be limited for complex images
with overlapping or touching objects, significant background variations, or non-
uniform illumination. Deep learning methods provide a more robust solution for
such scenarios but require substantial training data and computational resources.
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Theory:
The theory of denoising filters for image restoration is a fundamental concept in
the field of digital image processing. Denoising filters are designed to remove
unwanted noise or artifacts from digital images, while preserving the underlying
image features and details.
The main idea behind denoising filters is to exploit the statistical properties of the
noise and the image signal to separate the two and effectively remove the noise
component. The theory of denoising filters is based on the following key
principles:
1. Noise Model:
- Denoising filters assume a particular noise model, such as additive white
Gaussian noise (AWGN), Poisson noise, or speckle noise, depending on the image
acquisition process and the nature of the noise.
- The noise model helps in understanding the statistical properties of the noise,
which are then used to design the denoising filter.
2. Image Priors:
- Denoising filters often incorporate prior knowledge about the properties of the
underlying image, such as smoothness, sparsity, or texture characteristics.
- These image priors help in distinguishing the desired image signal from the
noise component, enabling more effective denoising.
3. Filtering Techniques:
- Denoising filters can be implemented using various techniques, such as linear
filters (e.g., Gaussian, median, Wiener), nonlinear filters (e.g., bilateral,
anisotropic diffusion), and transform-domain filters (e.g., wavelet, sparse coding).
Page | 1
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Page | 2
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Code:
clc;
close all;
clear all;
Page | 3
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
harmonicFiltered = 1 ./ imfilter(1./(double(noisyImage)
+ eps), fspecial('average', filterSize));
harmonicFiltered = uint8(harmonicFiltered);
subplot(2,3,5);
imshow(harmonicFiltered);
title('Harmonic Mean Filtered Image');
Output:
Page | 4
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Conclusion:
the choice of mean filter depends on the specific characteristics of the noise and the
desired outcome. While Arithmetic Mean Filter is simple and effective for general
noise reduction, Geometric Mean Filter is better at preserving edges. Harmonic
Mean Filter and Contra harmonic Mean Filter can be useful for specific types of
noise but require careful parameter selection to avoid undesirable effects.
Page | 5
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 09-01-2024
Assignment:01
Question: Convert any Gray Scale Image into RGB image without using inbuilt
commands
Code:
i = imread('Desktop/image.jpg');
grayImage = rgb2gray(i);
imshow(grayImage);
figure;
imshow(rgbImage);
Page | 1
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 09-01-2024
Assignment:01
Output:
Page | 2
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 09-01-2024
Assignment:01
Working principle:
Here firstly we have converted an RGB image into gray scale. Map the rows and
columns as per the size of the gray scaled image. Then we have created one empty
RGB image which have all the pixel value as zero. According to the gray value of
the gray scaled image we have divided image into three different part as gray value
<= 64, gray value <= 128, gray value <= 255 and adjusted the RED, GREEN and
BLUE shades according to the need of the image. After applying the RGB shades
we have got our final RGB image.
Conclusion:
Here we have observed that we can convert any grayscale image into RGB image
without using in built command. We can use this technique where we need RGB
image as the output but the grayscale image for processing. This won't give the exact
color as the original image but it provides a visual representation of RGB image.
Page | 3
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
Question:
(1) Identification of Number plate and (2) Detection of Speed from moving vehicle
Code:
PART 1:
%% load Out;
BW3 = bwfill(Out,'holes');
BW3=medfilt2(BW3,[4 4]);
BW3=medfilt2(BW3,[4 4]);
BW3=medfilt2(BW3,[4 4]);
BW3=medfilt2(BW3,[5 5]);
BW3=medfilt2(BW3,[5 5]);
figure;imshow(BW3,[]);
BW3 = bwfill(BW3,'holes');
[L num]=bwlabel(BW3);
STATS=regionprops(L,'all');
Page | 1
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
disp(num);
%% close all;
cc=[];
removed=0;
for i=1:num
dd=STATS(i).Area;
cc(i)=dd;
if (dd < 50000)
L(L==i)=0;
removed = removed + 1;
num=num-1;
end
end
[L2 num2]=bwlabel(L);
figure,imshow(L2);
STATS = regionprops(L2,'All');
if num2>2
for i=1:num2
aa= STATS(i).Orientation;
if aa > 0
imshow(L==i);
end
end
disp('exit');
end
[r c]=size(L2);
Out=zeros(r,c);
k=1;
B=STATS.BoundingBox;
Xmin=B(2);
Xmax=B(2)+B(4);
Ymin=B(1);
Ymax=B(1)+B(3);
LP=[];
LP=b(Xmin+25:Xmax-20,Ymin+10:Ymax-10);
figure,imshow(LP,[]);
Page | 2
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
PART 2:
%% Parameters
fps = videoReader.FrameRate;
scaleFactor = 0.8; % Adjust this based on your video resolution
%% Initialize variables
prevFrame = rgb2gray(readFrame(videoReader));
speeds = zeros(1, videoReader.NumFrames - 1);
%% Process frames
for frameIndex = 2:videoReader.NumFrames
currentFrame = rgb2gray(readFrame(videoReader));
Date: 16-01-2024
Assignment:02
Output:
PART 1:
Original Image
Page | 4
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
Image after number plate area detection
PART 2:
...
c
Frame 757: Speed = 530.4105 units/sec
Frame 758: Speed = 438.8288 units/sec
Frame 759: Speed = 454.0924 units/sec
Frame 760: Speed = 393.038 units/sec
Frame 761: Speed = 282.3768 units/sec
Page | 5
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
Frame 762: Speed = 370.1426 units/sec
Frame 763: Speed = 377.7744 units/sec
Frame 764: Speed = 381.5903 units/sec
Frame 765: Speed = 370.1426 units/sec
Frame 766: Speed = 469.356 units/sec
Frame 767: Speed = 522.7787 units/sec
Frame 768: Speed = 347.2471 units/sec
Frame 769: Speed = 179.3474 units/sec
Frame 770: Speed = 290.0086 units/sec
Frame 771: Speed = 267.1132 units/sec
Frame 772: Speed = 373.9585 units/sec
Frame 773: Speed = 255.6655 units/sec
Frame 774: Speed = 377.7744 units/sec
Frame 775: Speed = 255.6655 units/sec
Frame 776: Speed = 110.6612 units/sec
Frame 777: Speed = 186.9792 units/sec
Frame 778: Speed = 324.3517 units/sec
Frame 779: Speed = 301.4563 units/sec
Frame 780: Speed = 286.1927 units/sec
Frame 781: Speed = 316.7199 units/sec
Frame 782: Speed = 206.0587 units/sec
Frame 783: Speed = 87.7658 units/sec
Frame 784: Speed = 255.6655 units/sec
Frame 785: Speed = 305.2722 units/sec
Frame 786: Speed = 320.5358 units/sec
Frame 787: Speed = 251.8496 units/sec
Frame 788: Speed = 232.7701 units/sec
Frame 789: Speed = 133.5566 units/sec
Frame 790: Speed = 179.3474 units/sec
Frame 791: Speed = 362.5108 units/sec
Frame 792: Speed = 274.745 units/sec
Frame 793: Speed = 335.7994 units/sec
Frame 794: Speed = 385.4062 units/sec
Frame 795: Speed = 461.7242 units/sec
Frame 796: Speed = 484.6196 units/sec
Frame 797: Speed = 301.4563 units/sec
Page | 6
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
Frame 798: Speed = 259.4814 units/sec
Frame 799: Speed = 400.6698 units/sec
Frame 800: Speed = 354.879 units/sec
Frame 801: Speed = 2839.0316 units/sec
Frame 802: Speed = 419.7493 units/sec
Frame 803: Speed = 572.3854 units/sec
Frame 804: Speed = 461.7242 units/sec
Frame 805: Speed = 499.8833 units/sec
Frame 806: Speed = 496.0674 units/sec
Frame 807: Speed = 324.3517 units/sec
Frame 808: Speed = 305.2722 units/sec
Frame 809: Speed = 476.9878 units/sec
Frame 810: Speed = 438.8288 units/sec
Frame 811: Speed = 595.2808 units/sec
Frame 812: Speed = 717.3897 units/sec
Frame 813: Speed = 541.8582 units/sec
Frame 814: Speed = 610.5444 units/sec
Frame 815: Speed = 320.5358 units/sec
Frame 816: Speed = 366.3267 units/sec
Frame 817: Speed = 534.2264 units/sec
Frame 818: Speed = 469.356 units/sec
Frame 819: Speed = 320.5358 units/sec
Frame 820: Speed = 644.8876 units/sec
Frame 821: Speed = 251.8496 units/sec
Frame 822: Speed = 202.2428 units/sec
Frame 823: Speed = 270.9291 units/sec
Frame 824: Speed = 702.1261 units/sec
Frame 825: Speed = 190.7951 units/sec
Frame 826: Speed = 179.3474 units/sec
Frame 827: Speed = 366.3267 units/sec
Frame 828: Speed = 202.2428 units/sec
Frame 829: Speed = 45.7908 units/sec
Frame 830: Speed = 64.8703 units/sec
Frame 831: Speed = 125.9248 units/sec
Frame 832: Speed = 110.6612 units/sec
Frame 833: Speed = 209.8747 units/sec
Page | 7
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
Frame 834: Speed = 133.5566 units/sec
Frame 835: Speed = 61.0544 units/sec
Frame 836: Speed = 404.4857 units/sec
Frame 837: Speed = 206.0587 units/sec
Frame 838: Speed = 114.4771 units/sec
Frame 839: Speed = 156.452 units/sec
Frame 840: Speed = 99.2135 units/sec
Frame 841: Speed = 11.4477 units/sec
Frame 842: Speed = 145.0043 units/sec
Frame 843: Speed = 95.3976 units/sec
Frame 844: Speed = 1106.6118 units/sec
Frame 845: Speed = 156.452 units/sec
Frame 846: Speed = 125.9248 units/sec
Frame 847: Speed = 179.3474 units/sec
Frame 848: Speed = 61.0544 units/sec
Frame 849: Speed = 145.0043 units/sec
Frame 850: Speed = 225.1383 units/sec
Frame 851: Speed = 141.1884 units/sec
Output size exceeds the limit. Displaying partial results.
Page | 8
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-01-2024
Assignment:02
Working principle:
For part one we have provided an image input to check whether there is any number
plate detected or not. It checks for the area in image where it can find the number
plate. For that we convert the image into black and white image. As the color of the
number plate is white it is preferable to convert into black and white image. After
converting black and white image, we go for area detection of number plate. After
getting the perfect parameters about number plate we can directly display number
plate as an image.
For part one we have selected one video (.mp4 formatted) to apply our code on. We
firstly divided our video in many different frames. In each frame code looks for an
object and focus on the movement of the object in different frames. In each frame
we are measuring that how much change in the position of an object and frames we
have set for specific time division. So by applying this concept we have detected the
speed of an object after each and every frame in video.
Conclusion:
By using inbuilt functions and libraries of MATLAB we can do number plate
detection and object speed detection. This type of system is very helpful for
municipal corporations and traffic management departments. We can also generate
E-Challan for the detected number plate if He / She exceeding speed limit.
Page | 9
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 22-02-2024
Assignment:03
Question:
To hide and retrieve the information/image inside the cover image by doing Bit
Plane Slicing Concept.
Code:
%% HIDING PART
%% Read images
coverImage = imread('cameraman.tif');
secretImage = imread('mandi.tif');
%% plot images
subplot(2,2,1);
imshow(coverImage);
Page | 1
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 22-02-2024
Assignment:03
title('Cover Image');
subplot(2,2,2);
imshow(secretImage);
title('Secret Image');
subplot(2,2,3);
imshow(stegoImage);
title('Stego Image');
%% RETRIEVEING PART
%% Loop through each pixel
for row = 1:rows
for col = 1:cols
stegoLSB = bitget(stegoImage(row, col),
bitPlane);
coverLSB = bitxor(stegoLSB,
bitget(stegoImage(row, col), bitPlane));
extractedImage(row, col) = uint8(coverLSB *
2^7); % Set remaining bits to 0
end
end
%% plot image
subplot(2,2,4);
imshow(extractedImage);
title('Extracted Image');
%% plot histograms
figure;
subplot(1,2,1);
imhist(coverImage);
title('Cover image histogram');
subplot(1,2,2);
imhist(stegoImage);
title('Stego image histogram');
Page | 2
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 22-02-2024
Assignment:03
Output:
Page | 3
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 22-02-2024
Assignment:03
Working principle:
The working principle of hiding and retrieving data using bit plane slicing
involves manipulating the least significant bit (LSB) of each pixel in the image to
embed and extract the secret data. The LSB is the rightmost bit in the binary
representation of a number.
Hiding Data:
1. Convert Secret Data to Binary: First, the secret data is converted into
binary. For example, if the secret data is an integer, it is converted into an 8-
bit binary representation using the dec2bin function.
2. Iterate Over Pixels: The algorithm iterates through each pixel in the
grayscale image.
3. Replace LSB with Secret Bit: For each pixel, the least significant bit (LSB)
of the pixel value is replaced with the corresponding bit from the binary
representation of the secret data. This is done by using the bitset function in
MATLAB.
4. Move to the Next Bit: The algorithm proceeds to the next bit of the secret
data and continues the process until all bits are embedded or the entire image
is covered.
Retrieving Data:
1. Iterate Over Pixels: Similar to the hiding process, the algorithm iterates
through each pixel in the stego image.
2. Retrieve LSB: For each pixel, the least significant bit (LSB) is extracted
using the bitget function. This creates a binary string representing the
embedded bits.
3. Reconstruct Binary Data: The extracted binary bits are concatenated to
reconstruct the binary representation of the embedded secret data.
4. Convert to Decimal: The reconstructed binary data is converted back to
decimal using the bin2dec function.
Page | 4
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 22-02-2024
Assignment:03
Conclusion:
By using this code, we can implement the image steganography. We can hide
the data in the image so that no one can know about the data which is supposed to
be private. At the receiver side we can retrieve the data from image to get the original
data.
Page | 5
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-04-2024
Project
Problem Statement: Image Stitching
Code:
import numpy as np
import cv2
import math
import sys
from numpy import ndarray
from typing import List
if len(img2.shape) == 3:
gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
else:
gray2 = img2
# Resize images
scale_factor_1 = scale_factor
scale_factor_2 = scale_factor
if scale_factor is None:
MAX_SIZE = 1000
if np.max(gray1.shape) > MAX_SIZE:
scale_factor_1 = MAX_SIZE / np.max(gray1.shape)
else:
scale_factor_1 = 1
Page | 1
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-04-2024
Project
if np.max(gray2.shape) > MAX_SIZE:
scale_factor_2 = MAX_SIZE / np.max(gray2.shape)
else:
scale_factor_2 = 1
mask2 = np.zeros_like(gray2)
mask2[:,:math.floor(match_max_width_2 * scale_factor_2)] = 255
good_matches = matches
# Get the best matches if needed
if p_best_matches != 1:
good_matches = sorted(good_matches, key=lambda x: x.distance)
n_best_matches = math.floor(len(good_matches) * p_best_matches)
good_matches = good_matches[:n_best_matches]
Page | 2
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-04-2024
Project
src_pts = src_pts / scale_factor_1
dst_pts = dst_pts / scale_factor_2
# Using the homography matrix transform the second image (warping its
perspective)
result = cv2.warpPerspective(img2, homography, (img1.shape[1] +
img2.shape[1], img1.shape[0]))
Page | 3
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-04-2024
Project
match_max_width_2=match_max_width_l
eft,
scale_factor=scale_factor,
p_best_matches=p_best_matches,
cut_black_part=cut_black_part,
ransac_reproj_threshold=ransac_repr
oj_threshold)
# Flip result
result_left = cv2.flip(result_left,1)
result_right = img_list[-1]
match_max_width_right = sys.maxsize - 1
for i in range(len(img_list) - 2,len(img_list) // 2,-1):
result_right,match_max_width_right = computePairPanoramic(img_list[i],
result_right,
match_max_width_2=match_max_width_right
,
scale_factor=scale_factor,
p_best_matches=p_best_matches,
cut_black_part=cut_black_part,
ransac_reproj_threshold=ransac_reproj_t
hreshold)
Page | 4
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-04-2024
Project
import cv2
import matplotlib.pyplot as plt
from panoramic import computePanoramicView
# Read images
img1 = cv2.imread('imgs/img1.jpg')
img2 = cv2.imread('imgs/img2.jpg')
img3 = cv2.imread('imgs/img3.jpg')
img4 = cv2.imread('imgs/img4.jpg')
img5 = cv2.imread('imgs/img5.jpg')
# For n images
result = computePanoramicView([img1,img2,img3,img4,img5])
fig = plt.figure(figsize=(19.2, 10.8), tight_layout=True) # Plot at full screen
(1920x1080)
plt.axis('off')
plt.imshow(result)
plt.show()
Output:
Page | 5
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-04-2024
Project
Conclusion:
Image stitching is the process of combining multiple overlapping images into a
single, larger image. The key conclusion about image stitching can be summarized
as follows:
2. Blending and Seamless Transitions: Once the images are aligned, the next step is
to blend the overlapping regions to create a visually seamless transition between the
images. This may involve techniques such as weighted averaging, gradient domain
blending, or multiband blending to smooth out luminance and color differences.
5. Advances in Deep Learning: Recent advances in deep learning have led to the
development of end-to-end neural network-based image stitching approaches, which
can learn to perform the entire stitching process, including alignment and blending,
directly from data.
Page | 6
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)
FUNDAMENTALS OF IMAGE AND VIDEO PROCESSING (BTEC13603)
Date: 16-04-2024
Project
6. Applications Beyond Photography: While image stitching is most commonly
associated with photography and panorama creation, the techniques have also found
applications in fields such as remote sensing, medical imaging, and computer vision,
where the ability to combine multiple images into a larger, more informative
representation is valuable.
Page | 7
SARTHAK BOSAMIYA (ET21BTEC007)
PRIYANSHI PATEL (ET21BTEC049)