Constructing High-Resolution Lunar Mosaics

by Frank Barrett

5. Stitching the Mosaic Together

Now comes the fun part, putting all those segments together. This discussion assumes the processing is performed in Adobe Photoshop. The first step is to create a canvas large enough to contain all the segments (File | New...). Calculate this from the maximum number of segments in each axis and the pixel dimensions of your camera. It is better to err on the side of being too large. This isn't critical though as Photoshop will allow you to enlarge the canvas in any direction needed (via Image | Canvas Size...), but it's good to get this right from the beginning. When creating the image it's a good idea to set your background color to pure black initially fill the new canvas.

Now let’s add our segments. It’s generally a good idea to follow the same order in which the image segments were acquired. As long as you are laying down segments that are adjacent to one another alignment should be pretty easy. Open your first image segment and copy it to the clipboard. In Photoshop this is accomplished by pressing Ctrl-A to select all (or Select | All), and then Ctrl-C to copy (or Edit | Copy). Then click on the mosaic canvas and paste this image in, Ctrl-V (or Edit | Paste). Notice that Photoshop creates a new layer. Use the Move tool to place this image in the approximate correct location. Open the second image segment and repeat the process. Use the Move tool to align the segment as closely as possible to its correct position over the previously pasted segment. Zooming in on the overlapping region can do this fairly accurately. For fine adjustments use the keyboard cursor arrow keys to move the layer in single pixel increments.

Here's a trick that can virtually guarantee perfect pixel alignment of the two layers. In the Layers view change the blending mode (it's the drop down menu that typically says 'Normal') of the layer on top to Difference. You will see the overlapped area between the two image segments become dark, perhaps totally black (see Figure 2). Using the cursor keys and the Move tool, move the segment up and down and left and right until the dark area looks completely black (see Figure 3). It may be that this area won't go completely black. That's quite all right; the images can be offset by as much as a half a pixel width relative to each other and it may not be possible to achieve perfect alignment. Just use the setting that results in the darkest area. Then change the blending mode of the layer back to Normal. A real purist could achieve perfect alignment by resampling each segment by 2x or more and performing the alignment on the enlarged images. Generally speaking this is not necessary. When we blend the seams perhaps you'll see why.

Continue this process with all remaining segments. When you align a layer over multiple layers below you may discover that you cannot get everything perfectly aligned. For example, moving a pixel left makes one area darker and moving to the right makes another area darker. Again, don't get too hung up on this. Use the setting which gives the darkest overall area and you will achieve a good result.

Figure 2. Set the layer blending mode to "Difference". This shows where the two images are not properly aligned.

 

Figure 3. Using the Move tool, nudge the layer until the dark area is completely black. Then set the layer blending mode back to "Normal".

<PREVIOUS SECTION>   <MAIN>   <NEXT SECTION>