% let the image size to be 1200x1800
% cd c:\mydocu~1\psych221\project\morepic

vert = 1200;
hori = 1800;
temp = zeros(vert,hori,3);

line = 0.5+0.5*sin(2*pi*([1:1:hori]/75).^2);
temp(:,:,1) = repmat(line,1200,1);
temp(:,:,2) = temp(:,:,1);
temp(:,:,3) = temp(:,:,1);
image(temp);
pause(1);
imwrite(temp,'sinfast.jpg','jpg');

line = [];
line(1:2:1800) = 1;
line(2:2:1800) = 0;
line(1:4:1200) = 1;
line(2:4:1200) = 1;
line(3:4:1200) = 0;
line(4:4:1200) = 0;
for i = 1:4
   line(i:8:600) = 1;
   line(i+4:8:600) = 0;
end
temp(:,:,1) = repmat(line,1200,1);
temp(:,:,2) = temp(:,:,1);
temp(:,:,3) = temp(:,:,1);
image(temp);
pause(1);
imwrite(temp,'linefast.jpg','jpg');

line = [];
line(1:2:1200) = 1;
line(2:2:1200) = 0;
line(1:4:280*3) = 1;
line(2:4:280*3) = 1;
line(3:4:280*3) = 0;
line(4:4:280*3) = 0;
for i = 1:4
   line(i:8:480) = 1;
   line(i+4:8:480) = 0;
end
temp(:,:,1) = repmat(line',1,1800);
temp(:,:,2) = temp(:,:,1);
temp(:,:,3) = temp(:,:,1);
image(temp);
pause(1);
imwrite(temp,'horlinefast.jpg','jpg');

t = imread('linefast.jpg','jpg');
t = double((double(t)/256)>0.5);
t = temp+t;
pause(1);
imwrite(t/2,'crossgrayfast.jpg','jpg');

t = double(t>1);
pause(1);
imwrite(t,'crossBWfast.jpg','jpg');
