Matrix 2 Chessboard
Matrix 2 Chessboard
% Now, we write 8*8 matrix named CB that has 8 rows and 8 columns
CB = [1 0 1 0 1 0 1 0; 0 1 0 1 0 1 0 1; 1 0 1 0 1 0 1 0; 0 1 0 1 0 1 0 1; 1 0
1 0 1 0 1 0; 0 1 0 1 0 1 0 1; 1 0 1 0 1 0 1 0; 0 1 0 1 0 1 0 1]
% Now, we use imshow function to apply values for each pixel's intensity
% Thus we plot 8*8 pixel image of chessboard.
imshow(CB)
% BONUS
% Load the image(you can tweak image path in your code environment)
imageFile = '/MATLAB Drive/chessboard_matrix/willsmitheats spaghetti.jpg';
img = imread(imageFile);
subplot(1, 3, 2)
imshow(greenChannel)
title('Green Channel')
subplot(1, 3, 3)
imshow(blueChannel)
1
title('Blue Channel')
% We turned RGB image into matrices, then divided it into three intensity
% R, G, B channels
CB =
1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1
2
Published with MATLAB® R2024b