MATLAB: Finding a specific edge in multiple images

Computer Vision Toolboxedge detectionimage processingImage Processing Toolboximage registration

I have a set of fotos taken by a camera that shifts slightly in the wind. I am trying to correct the shift automatically. This is the image I want to use as reference: http://i101.photobucket.com/albums/m80/klar_01/marks.jpg
This is an example of a shifted image: http://i101.photobucket.com/albums/m80/klar_01/shift2.jpg
I have cropped the reference image and isolated a part of the main horizon line using canny edge detection and a threshold. I would like to find this edge in the other images and then transform the images to line up with the reference. Unfortunately the lighting situation changes a lot and the edge can not always be picked out clearly.
This is the horizon line from the reference image (green) and the canny edges I get for the shifted image (purple). http://i101.photobucket.com/albums/m80/klar_01/edges.jpg
I can see where the green and pruple lines should line up but I have no idea how to express this in code, as I can't get a clear edge in the shifted image.
Any suggestions would be much appreciated. Other ideas about how to approach the problem would also be very welcome!
I have the computer vision toolbox and have tried using the inbuilt feature matching functions with SURF features and corner points. Points do not match up correctly, presumeably because of the changing light.

Best Answer

Did you try imregister()?