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

Assignment 1

1) The student converted a RGB image (pepper.png) to grayscale and produced a histogram, which indicated the overall brightness and tonal range of the image. 2) Median and smooth filtering were applied to a noisy image, with median filtering being more effective at reducing salt-and-pepper noise while preserving edges compared to smooth filtering. 3) Median filtering was applied to specific pixels in a 4x4 test image, replacing pixel values with the median of neighboring pixels. 4) A football image was converted to grayscale, multiplied by 4 to increase brightness and contrast, and histograms were produced to compare the original and multiplied images.
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)
47 views7 pages

Assignment 1

1) The student converted a RGB image (pepper.png) to grayscale and produced a histogram, which indicated the overall brightness and tonal range of the image. 2) Median and smooth filtering were applied to a noisy image, with median filtering being more effective at reducing salt-and-pepper noise while preserving edges compared to smooth filtering. 3) Median filtering was applied to specific pixels in a 4x4 test image, replacing pixel values with the median of neighboring pixels. 4) A football image was converted to grayscale, multiplied by 4 to increase brightness and contrast, and histograms were produced to compare the original and multiplied images.
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
You are on page 1/ 7

Assignment 1

CSC566
Student Name: MUHAMMAD ZAKWAN ARIF BIN MUHAMMAD TAJUDDIN
Student Id: 2021106387
Group: M3CS2306A
Semester: PART 6
Submission Date 1st December 2023, Friday
Task 1.1: Pixel Write a MATLAB program to:
operations
a) Convert an RGB image (pepper.png) into a grayscale
(10 marks) image using the luminance transformation;
b) Produce a histogram of the image in a) after has been
converted to a grayscale image.
c) Write a conclusion based on the histogram produced.

Task 1.2: Local Write a MATLAB program to:


operations
a) Apply a 3x3 median filtering to a noisy grayscale image
(10 marks) (noisy_image.jpg).
b) Apply a 3x3 smooth filtering to the noisy grayscale image
(noisy_image.jpg).
c) Give your interpretation of (a) versus (b) in terms of
processing results.
d) Apply a 3x3 Laplacian filtering to a grayscale image
(noisy_image.jpg).

Task 1.3 Order statistics Write a MATLAB program to:


filtering
a) Construct a 4 x 4 image with values as follows 100, 110,
(10 marks) 120, 130, 15, 16, 130, 140, 110, 120, 22, 23, 111, 111, 140,
150.
b) Perform 3 x 3 median filtering on pixel 15.
c) Perform3 x 3 median filtering on pixel 22.

Task 1.4 Arithmetic Write a MATLAB program to:


operation
a) Read an image name football.jpg.
(10 marks) b) Convert image in a) to grayscale image.
c) Produce histogram from b).
d) Multiply the grayscale image in b) with 4.
e) Produce histogram of image in d).
f) Write your description to compare between image in b)
and image in d).
ANSWERS

TASK SOURCE CODE, SCREENSHOT OF OUTPUT


WRITING ANSWER

CSC566/ Image Processing


Faculty of Computer and Mathematical Sciences,
Universiti Teknologi MARA Cawangan Melaka Kampus Jasin
Task 1.1: >> pepper =
Pixel imread('pepper.jpg');
operation >> imshow(pepper);
s >> gray =
rgb2gray(pepper);
>> imshow(gray);
>> figure;
>> imhist(gray);
>> title('Histogram of
Grayscale Image');
>> xlabel('Pixel Value');
>> ylabel('frecuency');

Brightness and Overall


Tone: The overall
position of the histogram
can also indicate the
image's brightness and
tonal range. If the
histogram is shifted to
the left, the image is
generally darker, while a
shift to the right indicates
a brighter image.

CSC566/ Image Processing


Faculty of Computer and Mathematical Sciences,
Universiti Teknologi MARA Cawangan Melaka Kampus Jasin
Task 1.2: >> noisyImage =
Local imread('pepper.jpg');
operation >> noisyImage =
s rgb2gray(noisyImage);
>> medianFiltered =
medfilt2(noisyImage,
[3,3]);
>> subplot(1,2,2);
>>
imshow(medianFiltered
);
>> title('Median Filtered
Image');
>> figure;
>> subplot(1,3,1);
>> imshow(noisyImage);
>> title('Original Noisy
Image')
>> subplot(1,3,2);
>>
imshow(medianFiltered);
>> title('Median Filtered
Image');
>> subplot(1,3,3);
>>
imshow(smoothFiltered);
>> title('Smooth Filtered
Image');
Median Filtering (a) :
 Effective at
reducing the
impact of salt-
and-pepper
noise.
 Replaces pixel
values with the
median of
neighboring
pixels.
 Preserves edges
and fine details
better.
 Robust against
outliers in the
image, making it
suitable for noisy
images.
 Suitable for
images with
impulse noise,
where a few
pixels have
CSC566/ Image Processing
Faculty of Computer and Mathematical Sciences,
Universiti Teknologi MARA Cawangan Melaka Kampus Jasin
extreme values.
Smooth Filtering (b):
 Effective at
reducing the
impact of salt-
and-pepper
noise.
 Replaces pixel
values with the
median of
neighboring
pixels.
 Preserves edges
and fine details
better.
 Robust against
outliers in the
image, making it
suitable for noisy
images.
 Suitable for
images with
impulse noise,
where a few
pixels have
extreme values.
>> laplacianFiltered =
imfilter(noisyImage, [0 -1
0; -1 4 -1; 0 -1 0],
'replicate');
>> figure;
imshow(laplacianFiltered
);
title('Laplacian Filtered
Image');

CSC566/ Image Processing


Faculty of Computer and Mathematical Sciences,
Universiti Teknologi MARA Cawangan Melaka Kampus Jasin
Task 1.3 >> image = [100, 110, 120,
Order 130; 15, 16, 130, 140; 110,
statistics 120, 22, 23; 111, 111, 140,
filtering 150];
>> neighborhood_15 =
image(1:3, 1:3);
filtered_15 =
median(neighborhood_15(:)
);
>> neighborhood_22 =
image(2:4, 2:4);
filtered_22 =
median(neighborhood_22(:)
);
>> subplot(1, 3, 1);
imshow(image,
[min(image(:)),
max(image(:)]);
title('Original Image');

subplot(1, 3, 2);
imshow(filtered_15,
[min(image(:)),
max(image(:)]);
title('Filtered Pixel 15');

subplot(1, 3, 3);
imshow(filtered_22,
[min(image(:)),
max(image(:)]);
title('Filtered Pixel 22');
imshow(image,
[min(image(:))

CSC566/ Image Processing


Faculty of Computer and Mathematical Sciences,
Universiti Teknologi MARA Cawangan Melaka Kampus Jasin
Task 1.4 >> imshow(ball);
Arithmeti >> grayball = rgb2gray(ball);
c >> imshow(grayball);
operation >> imshow(ball);
>> figure;
>> subplot(2,2,1);
>> imshow(grayball);
>> title('Grayscale Image
ball');
>> subplot(2,2,2);
>> imhist(grayball);
>> title('Histogram of
Grayscale Image Ball');
>> multipliedImage =
grayball * 4;
>> figure;
subplot(2,2,1);
imshow(grayball);
title('Grayscale Image ball');
subplot(2,2,2);
imhist(grayball);
title('Histogram of Grayscale
Image Ball');
>> subplot(2,2,3);
>> imshow(multipliedImage,
[0,255]);
>> title('MultipliedImage');
>> subplot(2,2,4);
>> imhist(multipliedImage);
>> title('Histogram of
multiplied Image');
f) Description to compare
between the grayscale and
multiplied images
 The grayscale image
(b) is the original
image converted to
grayscale, which
 typically results in a
loss of color
information. The
histogram of the
grayscale
 image (c) shows the
distribution of pixel
intensities in the
grayscale image.
a) The multiplied
image (d) is obtained by
multiplying the
grayscale image by 4.
CSC566/ Image Processing
Faculty of Computer and Mathematical Sciences,
Universiti Teknologi MARA Cawangan Melaka Kampus Jasin
b) This process
increases the overall
brightness and contrast
of the image, and the
c) histogram of the
multiplied image (e)
reflects this change. The
pixel values are
d) scaled by a factor
of 4, leading to a wider
distribution of
intensities.
-In summary, the
multiplied image (d) is a
brighter version of the
grayscale image
-(b) with a stretched
histogram, indicating an
increase in intensity
values.

CSC566/ Image Processing


Faculty of Computer and Mathematical Sciences,
Universiti Teknologi MARA Cawangan Melaka Kampus Jasin

You might also like