0
$\begingroup$

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 :

Strong edge effects

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 :

A peak on the edge

Which results in input data for the cross correlation like this :

Input data with a peak on the edge

(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 :

Peak isolated by a diaphragm

Resulting in data for the cross-correlation like this :

Data isolated by a diaphragm

Using this kind of setup I have really good results :

enter image description here

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 :

  1. Isolating one 1024 * 768 image from the camera
  2. Shifting the camera by a known distance
  3. Isolating another image from the camera
  4. Obtaining data from each image by averaging the pixels color of the 768 pixels on each of the 1024 row (I obtain two double[1024] array)
  5. (Optional) Applying a Butterworth 4th order low-pass filter on each double[1024] array
  6. (Optional) Applying a window function on each double[1024] array (Itried Hamming, Blackman, Raised Cosine)
  7. (Optional) Zero-padding both signals : placing each double[1024] array in the center of a double[2048] array
  8. Computing the cross correlation of the two signals
  9. Looking for the Max of the cross-corrleation
  10. Applying a parabolic fit function for sub-sample accuracy
  11. 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).

$\endgroup$
  • $\begingroup$ Hi, I suggest trying an image registration library, instead of developing your code from scratch. Basic image registration algorithms are auto-correlation based and take care of all your problems!. I'm sure there are many image registration codes in C#. $\endgroup$ – Mohammad M Jun 4 '18 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.