Projection the 2D spectrum of an image to 1D with MATLAB
2014-01-09 23:38
344 查看
I = imread('cameraman.tif'); imagesc(I); colormap gray; title('Original image'); pause; % Fourier transform F = ifftshift(fft2(I))./rows./cols; % Show spectrum (log) imagesc(log(abs(F))); title('Fourier transform (abs log)'); pause; % Grid of FFT coordinates [rows, cols] = size(F); [ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ... ([1:rows]-(fix(rows/2)+1))/(rows-mod(rows,2))); % Convert to polar coordinates th = atan2(uy,ux); r = sqrt(ux.^2 + uy.^2); % Convert to polar coordinates Fr = F .* r; imagesc(abs(Fr)); title('Fourier transform x radius'); pause; rcoords = linspace(0,sqrt(ux(1,1)^2 + uy(1,1)^2),rows); thcoords = linspace(0,2*pi,cols); [ri,thi] = meshgrid(rcoords,thcoords); [x,y] = pol2cart(thi,ri); Fp = interp2(ux,uy,abs(Fr),x,y); imagesc(Fp); title('Fourier transform in polar coordinates'); pause; % Sum columns to give 1D projection F1D = sum(Fp); plot(rcoords,F1D); title('Projection onto 1D'); xlim([0 0.5]);
相关文章推荐
- How to sort an array of hashes into hashes with multiple values for a key?
- An Introduction to Language Processing with Perl and Prolog: An Outline of Theories, Implementation,
- Error with Stsadm Command-Object reference not set to an instance of an object
- An iterative image registration technique with an application to stereo vision笔记
- Effects with the Pixel Bender Toolkit – Part 5: Applying a filter to an image in Flash
- An Example of Pre-Query and Post-Query Triggers in Oracle Forms With Using Display_Item to Highlight Dynamically
- How to solve the problem "A project with an Output Type of Class Library cannot be started directly "
- ASP.NET: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. on Win7 64bit
- The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List
- An iterative image registration technique with an application to stereo vision
- [Yii Framework] How to develop an extension with image, css and js
- Effects with the Pixel Bender Toolkit – Part 5: Applying a filter to an image in Flash
- Joining an array of keys to a hash with key value pairs like excel vlookup
- BadImageFormatException or An attempt was made to load a program with an incorrect format
- Err:The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array
- #713 – 在拖拽操作中使用控件预览图作为鼠标(Setting the Cursor to an Image of an UIElement While Dragging)
- How to mount an ISO Image with AIX 6.1 TL4
- 用Python和OpenCV创建一个图片搜索引擎的完整指南 The complete guide to building an image search engine with Python and
- What are the 3 dimensions of an RGB image in MATLAB?
- Creating An Instance Of The Com Component With Clsid {b9425246-4131-11d2-be48-004005a04edf} From The Iclassfactory Failed Due To The Following Error