This is a follow-up of this question.
The problem explained in the linked question has been in part solved by the mean of a windowing function. But my cross-corrleation still exhibits strong edge-effects -I thinks so-, and I often end-up with results like this :
As you can see, it seems that the edge effects really mess with the cross-correlation. I then realised that those problems happen mostly if a peak is present on the edge of the image I analyze, like here :
Which results in input data for the cross correlation like this :
(don't mind the green curve, it's irrelevant here)
I have been able to (mostly) get rid of these effects by placing a diaphragm in front of the camera, and isolating just one peak in the center of the image :
Resulting in data for the cross-correlation like this :
Using this kind of setup I have really good results :
Now the problem is that using a diaphragm is not conceivable as a definitive solution. All the results provided here have been obtained by manually shifting the camera by a known distance, hence it moved in relation to the diaphragm. During the real experiments, neither the camera nor the diaphragm are going to move, the peaks will be shifting "by themselves".
What I can't wrap my head around is this : I have the feeling that using both zero-padding and a windowing function should result in the same effect as the diaphragm. It is not the case, using zero-padding or a windowing function even seems to make it worse. I don't know if there is a problem with my reasoning, so I come seeking your help, because data analysis is not really my thing...
Here is the process my data undergo :
- Isolating one 1024 * 768 image from the camera
- Shifting the camera by a known distance
- Isolating another image from the camera
- Obtaining data from each image by averaging the pixels color of the 768 pixels on each of the 1024 row (I obtain two double array)
- (Optional) Applying a Butterworth 4th order low-pass filter on each double array
- (Optional) Applying a window function on each double array (Itried Hamming, Blackman, Raised Cosine)
- (Optional) Zero-padding both signals : placing each double array in the center of a double array
- Computing the cross correlation of the two signals
- Looking for the Max of the cross-corrleation
- Applying a parabolic fit function for sub-sample accuracy
- Reading the results
So, is there a problem with the way I try to solve the problem ? Or is cross-correlation just a bad way to approach it ?
I can edit the post to provide more informations or actual code, but as it stands I don't know what would be useful. Note that here, all the images are highly saturated, because I just screen-printed them to put them here, but they aren't when I am really working on them (I lower the exposure time).