Dip University Question Paper Problems
Dip University Question Paper Problems
Whos
3. Write the Image
imfinfo('figure2.jpg')
5. Colour conversion
RGB_label = rgb2gray('figure2.jpg');
imshow(RGB_label);
R=RGB(:,:,1);
G=RGB(:,:,2);
B=RGB(:,:,3);
figure, imshow(R)
figure, imshow(G)
figure, imshow(B)
8. Adding Images
I = imread('figure1.jpg');
J = imread(''figure2.jpg');
K = imadd(I,J);
imshow(K)
I = imread('rice.tif');
J = immultiply(I,1.2);
imshow(I);
figure, imshow(J)
I = imread('rice.tif');
I2 = imread('cameraman.tif');
K = imdivide(imadd(I,I2), 2); % not recommended
figure, imshow(K)
I = imread('saturn.tif');
imshow(I2,[]), colorbar
level = graythresh(I3);
bw = im2bw(I3,level);
figure, imshow(bw)
[X1,map1]=imread(‘figure1.jpg’);
[X2,map2]=imread(‘figure2.jpg’);
imshow(X1,map1),figure,imshow(X2,map2);
17. Displaying Multiple Images in the Same Figure
[X1,map1]=imread(‘figure1.jpg’);
[X2,map2]=imread(figure2.jpg’);
subplot(1,2,1), imshow(X1,map2)
subplot(1,2,2), imshow(X2,map2)
zoom on
zoom out
zoom off
I = imread(‘figure1.jpg’);
J = imresize(I,1.25);
imshow(I)
figure, imshow(J)
Y = imresize(X,[100 150])
I = imread(‘figure1.jpg’);
J = imrotate(I,35,'bilinear');
imshow(I)
figure, imshow(J)
imshow (‘figure1.jpg’)
I = imcrop;
imshow(I)
I = imread(‘figure1.jpg’);
BW1 = edge(I,'sobel');
BW2 = edge(I,'canny');
imshow(BW1)
SE = strel('square',3)
BW2 = imdilate(BW,SE)
25. Eroding an Image
BW1 = imread(‘figure1.jpg’);
SE = strel('arbitrary’,eye(5));
BW2 = imerode(BW1,SE);
imshow(BW1)
figure, imshow(BW2)
27. This removes all of the lines, but also shrinks the rectangles.
BW3 = imdilate(BW2,SE);
imshow(BW3)
28. Skeletonization
BW1 = imread(‘figure1.jpg’);
BW2 = bwmorph(BW1,'skel',Inf);
imshow(BW1)
figure, imshow(BW2)
BW1 = imread(‘figure1.jpg’);
BW2 = bwperim(BW1);
imshow(BW1)
figure, imshow(BW2)