• Remix
  • Share
  • New Entry

  • Ratul Das

  • /
  • Look Closely: Those Lines are Straight

on 22 Oct 2021
  • 5
  • 32
  • 0
  • 0
  • 280
% Checkerboard optical illusion
% Ratul Das - rd608@cam.ac.uk
n=50; % width of each b/w cell
g=750; % width of checkerboard
m=@mod;
% checkerboard creation (shortest possible method)
o=ones(1,g);
o(m(0:749,100)<n)=0;
q=repmat(2*o-1,[g,1]);
a=.5-q'*q/2;
% smaller checkerboard dots creation
for c=6:n
h=m(c,2);
[r,d]=ind2sub([7 7],c);
x=[r;d]-8;
e=n*r;
f=n*d;
if x*x'<n
if r<7
a=p(e+35:e+48,f+3:f+16,h,a);
end
if d<7
a=p(e+3:e+16,f+35:f+48,h,a);
end
end
end
imshow(a);
function a=p(u,v,w,a)
l=751;
a([u l-u],[v l-v])=w;
end
Remix Tree