1. A method for aligning a first image and a second image, comprising: (1) selecting a first pixel in the first image and a second pixel in the second image that overlap when the first image and the second image are aligned with a camera motion; (2) if the first and the second pixels are edge pixels, incrementing a correlation value between the first image and the second image for the camera motion; (3) if only one of the first and the second pixels is an edge pixel, decrementing the correlation value between the first image and the second image for the camera motion; (4) repeating steps (1) to (3) for other overlapping pixels in the first image and the second image to determine the correlation value between the first image and the second image for the camera motion.