1. Read in a series of images into a list: I_list1.

2. Fit the sizes of the images to the maximum width and height.

3. Create two lists: I_list2 and I_list3. I_list2 holds the images removed from I_list1 whose coordinates in the canvas have been computed. I_list3 takes the images removed from I_list2, which have calculated the phase correlations with all the images in I_list1.

4. Initialize: remove the first image in I_list1 to I_list2. (The first image is the default target, locates at (0,0) of the canvas)

5. While I_list1 is not empty:

5.1. Take the first image in I_list2 as the target image J1 of this loop.

5.2. For each image J2 in I_list1.

5.2.1. Do phase correlation between J1 and J2.

5.2.2. If correlated: (1) compute J2’s coordinates in canvas based on J1’s coordinate and the position of the peak. (2) Remove J2 from I_list1 to I_list2.

5.2.3 If not correlated: continue.

5.3. Remove J1 from I_list2 to I_list3.

6. Remove the left images in I_list2 to I_list3.

7. Update the computed coordinates into positive. (As we set the target image’s coordinates as (0, 0), other images’ coordinate could be negative)

8. Add all images in I_list3 to the canvas, depending on their coordinates (calculated in the same order as stored in I_list3).