Description
NOTE: You may use Python in place of Matlab, but you must use the
same/similar step-by-step procedures for each part.
1) Test the MATLAB image functions to read, display, and write images. Use
buckeyes_gray.bmp and buckeyes_rgb.bmp from the class webpage. [2 pts]
grayIm = imread(‘buckeyes_gray.bmp’);
imagesc(grayIm);
axis(‘image’);
colormap(‘gray’);
imwrite(grayIm, ‘buckeyes_gray.jpg’);
pause;
rgbIm = imread(‘buckeyes_rgb.bmp’);
imagesc(rgbIm);
axis(‘image’);
imwrite(rgbIm, ‘buckeyes_rgb.jpg’);
2) Read and convert the rgb image to grayscale using the NTSC conversion formula via
the MATLAB function rgb2gray. Display your image to verify the result. [1 pt]
grayIm = rgb2gray(rgbIm); % Python: see skimage.color.rgb2gray()
3) Test more fully by creating, writing, and reading a checker-board image. [2 pts]
zBlock = zeros(10,10);
oBlock = ones(10,10)*255;
pattern = [zBlock oBlock; oBlock zBlock];
checkerIm = repmat(pattern, 5, 5);
imwrite(uint8(checkerIm), ‘checkerIm.bmp’);
Im = imread(‘checkerIm.bmp’);
imagesc(Im)
colormap(‘gray’)
axis(‘image’);
4) Turn in all code, test images, printouts of images, and discussion of results. Make a
HW1.m (or HW1.py) script to do the above tasks and call needed functions. Upload
your code and selected images to Carmen. [2 pts]