Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Computer Vision

Homework 1

1) Upload the image “peppers.png” into variable X.

X = imread(‘peppers.png’);

2) Display the image saved in X.

3) What is the size of X?

Size(X) = 384 x 512 x 3

4) Save X as “New_image.png”

imwrite(X, “New_image.png’);

5) Convert New_image.png to grayscale and save it as “New_image_gray”

New_image_gray = rgb2gray(X);

6) What is the class of New_image_gray?

uint8

7) Display side by side New_image.png and New_image_gray


8) Write a program to horizontally flip New_image_gray, save it as H_flip

I=New_image_gray;

[M, N]=size(I);

oo=zeros(M,N);

for i = 1: M

for j=1:N

oo(i,j) = I(i, j);

end;

end;

imshow(oo);

9) Display side-by-side New_image_gray and H_flip

10) Write a program to generate the negative of New_image_gray and display New_image_gray and
its negative side-by-side.

You might also like