博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Projection the 2D spectrum of an image to 1D with MATLAB
阅读量:7067 次
发布时间:2019-06-28

本文共 983 字,大约阅读时间需要 3 分钟。

I = imread('cameraman.tif');imagesc(I); colormap gray; title('Original image'); pause;% Fourier transformF = 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 coordinatesth = atan2(uy,ux);r = sqrt(ux.^2 + uy.^2);% Convert to polar coordinatesFr = 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 projectionF1D = sum(Fp);plot(rcoords,F1D); title('Projection onto 1D'); xlim([0 0.5]);

转载于:https://www.cnblogs.com/xwolfs/p/3512957.html

你可能感兴趣的文章
Python编程笔记(第三篇)【补充】三元运算、文件处理、检测文件编码、递归、斐波那契数列、名称空间、作用域、生成器...
查看>>
获取用户信息
查看>>
洛谷P3952 时间复杂度
查看>>
Leetcode | Parentheses 相关
查看>>
Ajax分页问题
查看>>
如何禁止内部viewPager滑动
查看>>
简单的转义字符
查看>>
RabbitMQ入门-Topic模式
查看>>
poj 2777 Count Color(线段树区间更新)
查看>>
Java数据结构与算法(5) - ch05链表(LinkList)
查看>>
CLR Via CSharp读书笔记(21):自动内存管理(垃圾回收)
查看>>
刚刚接触python的感想
查看>>
modelsim使用常见问题及解决办法集锦 ②
查看>>
常用的第三方库
查看>>
java 操作elasticsearch之搭建测试项目环境
查看>>
iOS-图文表并茂,手把手教你GCD
查看>>
python之logging模块
查看>>
让Android Studio支持系统签名
查看>>
3.5 Templates -- Binding Element Attributes(绑定元素属性)
查看>>
jquery常用技巧及常用方法列表集合
查看>>