clear all

close all

%Create Dark Canvas

canvas = 100*ones(320,320);

imshow(canvas, [])

% white squares in a 40 pixels dimension

white = 200*ones(40,40);

imshow(canvas, [])

% start applying white squares to the canvas

for row=1:2:8

for col=1:2:8

% rows and columns from beginning square

row0 = 40*(row-1) + 1;

col0 = 40*(col-1) + 1;

canvas(row0:row0+39, col0:col0+39) = white;

end

end

for row=2:2:8

for col=2:2:8

% rows and columns skipping the first square

row0 = 40*(row-1) + 1;

col0 = 40*(col-1) + 1;

canvas(row0:row0+39, col0:col0+39) = white;

end

end

imshow(canvas,[])