why the image is not display in the output?

1 visualización (últimos 30 días)
SAHIL SAHOO
SAHIL SAHOO el 30 de Ag. de 2022
Respondida: Mathieu NOE el 30 de Ag. de 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)
  1 comentario
Ankit
Ankit el 30 de Ag. de 2022
I think you need to normalize your image by dividing 255.

Iniciar sesión para comentar.

Respuestas (1)

Mathieu NOE
Mathieu NOE el 30 de Ag. de 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

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by