# Smoothing colormap of plotted image

5 views (last 30 days)
Minseo Jeong on 1 Mar 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]
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)) rho_start=0;
rho_end=600;
xs=x_start+600;
ys=y_start+600;
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);
figure
Y=diff(abdis,1,1);
imagesc(abs(Y)); 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?