why the image is not display in the output?

1 次查看(过去 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 个)

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