2

我有一组来自 611 个图像(尺寸 3x611)的 ROI 的平均 RGB 像素值。这些图像的拍摄时间超过 64 秒。我将每个颜色流的平均值解释为随时间变化的信号,并将其绘制在 Matlab 中。我还使用 fft() 绘制功率谱。在这个功率谱中,我在低频范围内获得了巨大的价值。我想删除这些值,因此想要一个截止频率为 0.2 Hz 的高通滤波器。此外,我希望这个滤波器非常锐利,完全抑制低于 0.2 Hz 的频率的功率,并保持高于 0.2 Hz 的频率的功率。请提出一种方法来做到这一点。

编码直到我得到绿色流的功率谱

imageFiles = dir('*.png');      
noFiles = length(imageFiles);    % Number of files found
avgVals = zeros(noFiles,3);

noise = 0;                       %Boolean for noise: if 1, then ROI moves randomly

noiseV = 0;
noiseH = 0;

for i=1:noFiles
   curFileName = imageFiles(i).name;
   curImage = imread(curFileName);

   temp1  = curImage(175:215 , 290:385, 1);
   avgVals(i,1) = (sum(sum(temp1)'))/3936;

   temp2  = curImage(175:215 , 290:385, 2);
   avgVals(i,2) = (sum(sum(temp2)'))/3936;

   temp3  = curImage(175:215 , 290:385, 3);
   avgVals(i,3) = (sum(sum(temp3)'))/3936;
end

Rstream = avgVals(:,1);
Gstream = avgVals(:,2);
Bstream = avgVals(:,3);

%plot actual signal with respect to time
xAxis = (0:64/610:64);
plot(xAxis,Rstream,'r');
hold on;
plot(xAxis,Gstream,'g');
hold on;
plot(xAxis,Bstream,'b');

nfft = 1024;

R = fft(Rstream,nfft);
R = R(1:nfft/2);
mR = abs(R);
G = fft(Gstream,nfft);
G = G(1:nfft/2);
mG = abs(G);
B = fft(Bstream,nfft);
B = B(1:nfft/2);
mB = abs(B);

f=(0:nfft/2-1)*(611/64)/nfft;

figure(2);
plot(f,mG,'g');

谢谢。任何帮助,将不胜感激。

4

1 回答 1

1

If you're not familiar with Matlab filters you can use the filterbuilder GUI by typing filterbuilder in the console.

Once you made your settings you'll get a filter object that you can use in combination with the filter function.

http://www.mathworks.de/de/help/signal/ref/filterbuilder.html

http://www.mathworks.de/de/help/matlab/ref/filter.html

If you are working on what I think you're doing you can also do a simple detrending using detrend, in order to get rid of the "DC" part of you signal.

于 2012-10-01T09:25:07.690 回答