I am doing some post-hoc analysis of a dataset consisting of a series of movie frames that are contaminated by a strongly periodic artifact. I would like to remove this artifact from my frames.
For ease of plotting I've just reshaped my array M
of pixel values to [nframes, npixels]
, then averaged over all pixel values to give me a 1D vector m
. Here's what this signal looks like in the time domain. You can see the oscillation quite clearly in the zoomed inset.
I then made a periodogram by taking Fm = rfft(m)
, and plotted abs(Fm)**2
against frequency. I see a very sharp peak at ~1.5Hz:
As well as the temporal periodicity, there also seems to be a weaker spatial component to this artifact, since at the exact peak frequency value there seems to be a smooth variation in phase across the x-axis of my frames, so that pixels on the right tend to lag pixels on the left:
As a brute force approach, I've tried just filtering each pixel in the time domain using a notch filter centred on 1.5Hz. I used an order 4 Butterworth filter with critical frequencies 1.46 and 1.52Hz (I'm not well versed in filter design, so I'm sure there may be more appropriate choices).
Here's what the mean pixel signal looks like after filtering:
And the corresponding periodogram:
The notch filter does a reasonably good job of reducing the artifact, but since it basically looks like a pure stationary sinusoid I can't help but think that I could do better than just attenuating that part of frequency space.
My initial (very naive) idea was to do something like:
- Get the frequency, phase and amplitude of the oscillation from the Fourier spectrum for each pixel in the movie
- Reconstruct the oscillation in the time domain
- Subtract it from the movie frames
I realise this isn't something people usually do, since interference usually isn't so spectrally pure and temporally stationary, but I wonder if it might make sense in my case?
Data
Full 16bit TIFF stack (~2GB uncompressed)
Spatially decimated 8bit version (~35MB uncompressed)
x
, then I takeFx = rfft(x)
, and get the power asabs(Fx)**2
$\endgroup$