How can I smooth pixelated images in MATLAB?

  • Context: MATLAB 
  • Thread starter Thread starter rolotomassi
  • Start date Start date
  • Tags Tags
    Matlab Pixel
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
rolotomassi
Messages
52
Reaction score
0
Hi. I have this code in matlab:

/ /
I=dlmread('C:\Users\rshah\Desktop\Polymer Project\monteCarloCode\E=1e8.txt');

F=fft2(I); F = fftshift(F); % Center FFT

F = abs(F); % Get the magnitude since F is complex

F = log(F+1); % Use log, for perceptual scaling, and +1 since log(0) is undefined

[avg, s]=radialavg(F,30);
subplot(2,2,1);imshow(F,[]);
subplot(2,2,[3,4]);plot(s,avg);
subplot(2,2,2);imshow(I,[]) //

F is the Fourier transform of my matrix of 1's and 0's which is 'I'. I would like to smooth both images so they do not appear pixelated like how in gnuplot we use interpolate.
Im new to MATLAB and the syntax so sorry if this is something really easy. Thanks in advance
 
rolotomassi said:
I would like to smooth both images so they do not appear pixelated like how in gnuplot we use interpolate.
Im new to MATLAB and the syntax so sorry if this is something really easy. Thanks in advance

The code cannot be run by anyone except you, since the text file you import is in a folder on your desktop. It would have been advisable to either attach the text file or the plots to the post. If you do that, you might be able to get a more detailed answer.

In MATLAB the interpolation functions are interp1, interp2, interp3, and interpn. You probably just need to use interp1:

http://www.mathworks.com/help/matlab/1-d-interpolation.html