How to get diffraction pattern (fft2) from image of double slit(jpeg image)
8 ビュー (過去 30 日間)
古いコメントを表示
I would like to obtain the diffraction pattern from double slit. How can I set all blacks to 0 and all white to 1 so that the image fairly represents double slit? Thank you.
clear all; close all; clc;
x = imread('double_slit.jpg');
x = imrotate(x,-48.9);
figure(2)
imagesc(x)
x1 = rgb2gray(x);
x1 = im2double(x1);
X =ifftshift(ifft2(fftshift(x1)));
figure(1)
imagesc(log(abs((X)).^2))
% shading interp
colormap('jet')

0 件のコメント
採用された回答
Mikhail
2014 年 11 月 11 日
編集済み: Mikhail
2014 年 11 月 11 日
After you get grayscale (2D array) Image, in order to get binary image you can use im2bw function. So you should choose threshold, and this function will set all values above it to 1, and all values below to zero. For example:
threshold=mean(mean(x));
x=im2bw(x,threshold);
You should figure out what formula for threshold is better in your particular case.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!