Skip to content

Instantly share code, notes, and snippets.

@kphilipp
Last active October 6, 2016 09:00
Show Gist options
  • Save kphilipp/141f26594a37a0f0ae572c922cb9bab0 to your computer and use it in GitHub Desktop.
Save kphilipp/141f26594a37a0f0ae572c922cb9bab0 to your computer and use it in GitHub Desktop.
simulation of fully developed speckle pattern
L = 400;
D = 80;
speckleSize = L/D
img = zeros(L, L);
pad = L/2; % padding
for k=pad-D:D+pad
for l=pad-D:D+pad
if abs((pad-k)^2+(pad-l)^2) < D^2/4
img(k,l) = exp(unifrnd(-pi,pi));
end
end
end
mfft = fft2(img);
img = mfft.*conj(mfft);
subimg = img(20:380, 20:380);
figure; imshow(subimg, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment