MATLAB How can I smooth pixelated images in MATLAB?

  • Thread starter Thread starter rolotomassi
  • Start date Start date
  • Tags Tags
    Matlab Pixel
Click For Summary
The discussion revolves around a MATLAB code snippet that performs a Fourier transform on a binary matrix and aims to smooth the resulting images to reduce pixelation. The user seeks advice on how to achieve a smoother appearance similar to interpolation methods used in gnuplot. It is noted that the provided code cannot be executed by others due to the absence of the text file required for input. Suggestions include using MATLAB's built-in interpolation functions such as interp1, interp2, interp3, and interpn to achieve the desired smoothing effect. The importance of sharing the text file or plots for more tailored assistance is also highlighted.
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
 

Similar threads

Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K