How can I smooth pixelated images in MATLAB?

  • Context: MATLAB 
  • Thread starter Thread starter rolotomassi
  • Start date Start date
  • Tags Tags
    Matlab Pixel
Click For Summary
SUMMARY

The discussion focuses on smoothing pixelated images in MATLAB using Fourier transforms and interpolation techniques. The user employs the FFT (Fast Fourier Transform) to analyze an image represented as a matrix of 1's and 0's. To achieve smoother images, it is recommended to utilize MATLAB's built-in interpolation functions, specifically interp1, interp2, and interp3, which provide various methods for image interpolation. The user is encouraged to share their data files for more tailored assistance.

PREREQUISITES
  • Familiarity with MATLAB syntax and environment
  • Understanding of Fourier transforms, specifically fft2 and fftshift
  • Knowledge of image processing concepts, particularly interpolation
  • Basic experience with MATLAB's plotting functions, such as imshow and subplot
NEXT STEPS
  • Research MATLAB's interp2 function for 2D image interpolation
  • Explore the radialavg function for analyzing Fourier transform data
  • Learn about advanced image smoothing techniques, such as Gaussian filtering
  • Investigate how to properly share MATLAB data files for collaborative troubleshooting
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those involved in image processing, data visualization, and anyone seeking to enhance image quality through interpolation techniques.

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
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · 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
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K