Experiment - 2: AIM: To Convert RGB Image To Grayscale Image
Experiment - 2: AIM: To Convert RGB Image To Grayscale Image
clear all
close all
I = imread('C:\Users\Harpreet Kaur\Pictures\newww.jpg');
subplot(2,1,1);
imshow(I)
title('ORIGINAL IMAGE');
j=rgb2gray(I)
subplot(2,1,2);
imshow(j)
title('GRAY SCALED IMAGE');
imwrite (j, 'C:\Users\Harpreet Kaur\Pictures\j.png');
EXPERIMENT 3
AIM: To apply histogram function.
clear all
close all
I = imread('C:\Users\Harpreet Kaur\Pictures\newww.jpg');
a=rgb2gray(I)
subplot(2,2,1);
imshow(a)
title('gray scaled image')
subplot(2,2,2);
imhist(a)
title('histogram')
b=histeq(a)
subplot(2,2,3)
imshow(b)
title('equalised image')
subplot(2,2,4)
imhist(b)
title('equalised histogram')
EXPERIMENT 4
AIM WAP to add noise in the image.
close all
I = imread('C:\Users\Harpreet Kaur\Pictures\newww.jpg');
subplot(2,2,1);
imshow(I)
title('original image')
noise=imnoise(I,'salt & pepper',0.05);
subplot(2,2,2)
imshow(noise)
title('salt & pepper')
noise=imnoise(I,'gaussian',0.05,0.02);
subplot(2,2,3)
imshow(noise)
title('gaussian')
noise=imnoise(I,'poisson');
subplot(2,2,4)
imshow(noise)
title('poisson')
Experiment 5
clear all
close all
I = imread('C:\Users\Harpreet Kaur\Pictures\newww.jpg');
subplot(2,2,1);
imshow(I)
title('ORIGINAL IMAGE');
red=I
blue=I
green=I
red(:,:,2:3)=0
subplot(2,2,2)
imshow(red);
title('RED COMPONENT');
green(:,:,1)=0
green(:,:,3)=0
subplot(2,2,3)
imshow(green)
title('GREEN COMPONENT');
blue(:,:,1:2)=0
subplot(2,2,4)
imshow(blue)
title('BLUE COMPONENT');
Experiment 6
clc;
x=imread ('C:/Users/student/Desktop/Penguins.jpg');
figure();
imshow(x);
title('jpg');
bw=rgb2gray(x);
subplot(2,2,1);
imshow(bw);
title('b/w');
n=edge(bw);
subplot(2,2,2);
imshow(n);
title('sobeledge');
t=edge(bw,'canny');
subplot(2,2,3);
imshow(t);
title('cannyedge');