1. A method, comprising: calculating directionality values for pixels of a first image and for pixels of a second image, wherein a directionality value for a pixel is calculated based on gradient differences between the pixel and a plurality of neighboring pixels; determining a plurality of similarity values between the first image and the second image for a plurality of alignment positions of the first image and the second image, wherein similarity value for an alignment position is determined based at least on the directionality values for the pixels of the first image and the directionality values for corresponding pixels of the second image associated with the alignment position of the first image and the second image; and selecting an alignment position from among the plurality of alignment positions for aligning the first image and the second image based on comparison of the plurality of similarity values.