why the image is not display in the output?

1 回表示 (過去 30 日間)
SAHIL SAHOO
SAHIL SAHOO 2022 年 8 月 30 日
回答済み: Mathieu NOE 2022 年 8 月 30 日
lambda=500e-9;
k=(2*pi)/lambda;
a=1e-6;
Io=100.0;
R=1.0e-3;
Y=(-0.25e-2:1e-5:0.25e-2); Z=Y ;
I(1:length(Y),1:length(Z))=0;
for i=1:length(Y)
for j=1:length(Z)
q=(Y(i).^2+Z(j).^2).^0.5;
w = 0.05;
I(i,j)=Io.*exp(-((q.^2)./w^2));
end
end
imshow(I)
  1 件のコメント
Ankit
Ankit 2022 年 8 月 30 日
I think you need to normalize your image by dividing 255.

サインインしてコメントする。

回答 (1 件)

Mathieu NOE
Mathieu NOE 2022 年 8 月 30 日
hello
Your I array has not much delta between min (99.5) and max value (100), so you need to help imshow autoscale its range to these min / max values;
figure(1),imshow(I,[]) % grayscale display , zoomed in min / max I range
% IMSHOW(I,[]) displays the grayscale image I scaling the display based
% on the range of pixel values in I. IMSHOW uses [min(I(:)) max(I(:))] as
% the display range, that is, the minimum value in I is displayed as
% black, and the maximum value is displayed as white.
%% alternative
figure(2),imagesc(I) ; % automatic image scaling

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by