Smoothing colormap of plotted image
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Minseo Jeong
el 1 de Mzo. de 2022
Comentada: Constantino Carlos Reyes-Aldasoro
el 1 de Mzo. de 2022
I want to make radial profile of this image and differentiate it.
The result is supposed to be like second image, but the radial image and result image are like third and fourth image
The problem seems to be resulted from pixel stuff. Does anyone know how to solve this problem?
Here's the code used to make the original image, radial image, and differentiated radial image.
theta = 0:1:359; % [Degree]
theta_rad = theta*pi/180; % [Radian]
x = -600:600; % [um] 1 px = 1 um
y = -600:600; % [um] 1 px = 1 um
sw = 100; % FWHM of source size : 100 um
% Making source image on the source plane
s = zeros([1201,1201]);
for n = 1:1201 % Index for x coordinate
for l = 1:1201 % Index for y coordinate
s(l,n) = exp(-4*log(2)*(x(n)^2/sw^2 + y(l)^2/sw^2)/2);
end
end
figure(1)
imagesc(s)
title('Source image'); colorbar()
% Maing aperture with size of 500 um
aper = zeros([1201,1201]);
for n = 1:1201 % Index for x coordinate
for k = 1:1201 % Index for y coordinate
if x(n)^2 + y(k)^2 <= 250^2
aper(k,n) = 1;
end
end
end
figure(2)
imagesc(aper)
title('Aperture'); colorbar()
%% 2D FFT
S = fftshift(fft2(s)); % Source in spatial frequncy domain
AP = fftshift(fft2(aper)); % Aperture in spatial frequency domain
% H1 and H2 should be replaced with proper function
H1 = 1; % Free space propagation transfer function from source to aperture
H2 = 1; % Free space propagation transfer function from aperture to detector
OBJ = H2.*AP.*H1.*S; % Penumbra image on detector plane in spatial frequency domain
obj = ifftshift(ifft2(OBJ)); % Penumbra image on detector plane in real space domain
figure(3)
imagesc(abs(obj))
Nprofile=length(theta_rad);
rho_start=0;
rho_end=600;
[x_start, y_start]=pol2cart(theta_rad,repelem(rho_start,1,Nprofile));
xs=x_start+600;
ys=y_start+600;
[x_end, y_end]=pol2cart(theta_rad, repelem(rho_end,1,Nprofile));
xe=x_end+600;
ye=y_end+600;
Npoint=600;
profile=zeros(Npoint,1,Nprofile);
for k=1:Nprofile
profile(:,:,k)=improfile(obj,[xs(k) xe(k)],[ys(k) ye(k)],Npoint);
end
display_profile=permute(flipud(profile), [1 3 2]);
figure
imagesc(abs(display_profile));
abdis=abs(display_profile);
%differentiation of radial profile image
figure
Y=diff(abdis,1,1);
imagesc(abs(Y));
0 comentarios
Respuesta aceptada
Constantino Carlos Reyes-Aldasoro
el 1 de Mzo. de 2022
If you only want to smooth the final data, you can try with filters, e.g.
imagesc(medfilt2(abs(Y),[5 5 ]))
imagesc(imfilter(abs(Y),ones(5),'replicate'))
Is this what you are after?
4 comentarios
Constantino Carlos Reyes-Aldasoro
el 1 de Mzo. de 2022
I am glad! Could you please accept the answer?
Más respuestas (0)
Ver también
Categorías
Más información sobre Blue en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!