Matlab 如何用径向平均法从二维噪声功率谱计算一维功率谱
伙计们,我正试图从图像的2D FFT计算一维功率谱。我是用水平平均法来做的,但通过看一张图表,我感觉不到这一点。您能否建议如何对二维数据集进行径向平均,以达到噪声功率谱的一维表示。非常感谢。 我将感谢你的帮助 这是我的密码 $Matlab 如何用径向平均法从二维噪声功率谱计算一维功率谱,matlab,image-processing,fft,noise,Matlab,Image Processing,Fft,Noise,伙计们,我正试图从图像的2D FFT计算一维功率谱。我是用水平平均法来做的,但通过看一张图表,我感觉不到这一点。您能否建议如何对二维数据集进行径向平均,以达到噪声功率谱的一维表示。非常感谢。 我将感谢你的帮助 这是我的密码 $ 您可以编写如下函数: function profile = radialAverage(IMG, cx, cy, w) % computes the radial average of the image IMG around the cx,cy point
您可以编写如下函数:
function profile = radialAverage(IMG, cx, cy, w)
% computes the radial average of the image IMG around the cx,cy point
% w is the vector of radii starting from zero
[a,b] = size(IMG);
[X, Y] = meshgrid( (1:a)-cx, (1:b)-cy);
R = sqrt(X.^2 + Y.^2);
profile = [];
for i = w % radius of the circle
mask = (i-1<R & R<i+1); % smooth 1 px around the radius
values = (1-abs(R(mask)-i)) .* double(IMG(mask)); % smooth based on distance to ring
% values = IMG(mask); % without smooth
profile(end+1) = mean( values(:) );
end
end
我不明白。如何从二维信号中获得一维功率谱?水平平均是没有意义的,因为每行的强度分布可能会有明显的不同,所以平均值不能充分反映行为。google搜索返回并返回。这就是你要找的吗?@rayreng,我想这个想法是,人们不想区分方向不同,但具有相同空间频率或波数的频率成分,因此| k |=sqrtk1^2+k2^2的频谱。谢谢你的回答。@rayreng和a.Donda。假设物体对称的傅里叶变换,我们可以在径向网格上插值,对于每个半径,我们可以计算点击量。所有半径的平均值将给出一维功率谱。
function profile = radialAverage(IMG, cx, cy, w)
% computes the radial average of the image IMG around the cx,cy point
% w is the vector of radii starting from zero
[a,b] = size(IMG);
[X, Y] = meshgrid( (1:a)-cx, (1:b)-cy);
R = sqrt(X.^2 + Y.^2);
profile = [];
for i = w % radius of the circle
mask = (i-1<R & R<i+1); % smooth 1 px around the radius
values = (1-abs(R(mask)-i)) .* double(IMG(mask)); % smooth based on distance to ring
% values = IMG(mask); % without smooth
profile(end+1) = mean( values(:) );
end
end