why the image is not display in the output?

1 visualizzazione (ultimi 30 giorni)
SAHIL SAHOO
SAHIL SAHOO il 30 Ago 2022
Risposto: Mathieu NOE il 30 Ago 2022
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)

Risposte (1)

Mathieu NOE
Mathieu NOE il 30 Ago 2022
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

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by