why the image is not display in the output?

조회 수: 3 (최근 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 CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by