Professional Documents
Culture Documents
1. Read an RGB image and extract each color component and display
it.
rgbImage = imread('flamingos.jpg');
subplot(1, 3, 1);
imshow(redComponent);
title('Red Component');
subplot(1, 3, 2);
imshow(greenComponent);
title('Green Component');
subplot(1, 3, 3);
imshow(blueComponent);
title('Blue Component');
OUTPUT:
2. Repeat Q1 using SIMULINK.
3. Read an RGB image. Convert it into YIQ format. [Use rgb2ntsc()].
originalImage = imread('flamingos.jpg');
yiqImage = rgb2ntsc(originalImage);
yComponent = yiqImage(:,:,1);
yComponentEqualized = histeq(yComponent);
yiqImageEqualized = yiqImage;
yiqImageEqualized(:,:,1) = yComponentEqualized;
rgbImageEqualized = ntsc2rgb(yiqImageEqualized);
subplot(1, 2, 1);
imshow(originalImage);
title('Original Image');
subplot(1, 2, 2);
imshow(rgbImageEqualized);
title('Equalized Image');
imwrite(rgbImageEqualized, 'equalized_image.jpg');
OUTPUT:
4. Repeat Q3 using SIMULINK.
OUTPUT:
5. Read a color image. Corrupt the image by salt and pepper noise.
figure;
subplot(1, 2, 1);
imshow(originalImage);
title('Original Image');
subplot(1, 2, 2);
imshow(corruptedImage);
title('Corrupted Image');
filteredImage = corruptedImage;
figure;
subplot(1, 2, 1);
imshow(corruptedImage);
title('Corrupted Image');
subplot(1, 2, 2);
imshow(filteredImage);
title('Filtered Image');
OUTPUT:
6. Repeat Q5 using Simulink.
7. Read an RGB image. Convert it into YIQ format. Apply high pass-
Filtering on Y component only. Convert it to RGB and display the
originalImage = imread('flamingos.jpg');
yiqImage = rgb2ntsc(originalImage);
filteredYIQImage = yiqImage;
filteredYIQImage(:,:,1) = filteredYComponent;
filteredRGBImage = ntsc2rgb(filteredYIQImage);
figure;
subplot(1, 2, 1);
imshow(originalImage);
title('Original Image');
subplot(1, 2, 2);
imshow(filteredRGBImage);
title('Filtered Image');
OUTPUT: