Sub Pixel Super Resolution Tutorial

I was researching how to do astrophotography when I came across this technique. It is very similar to how you stack star shots and adjust the camera ever so slightly so that the pixels aren’t in exactly the same spot to prevent ISO noise from stacking up as you merge long exposures to bring out the night sky. This allows you to clean up noisy ISO and low light black blotches. It makes sense that the same process would help you clean up noise created by scaling an image larger.

Here is the image I used for this example. This is one of the 36 burst photos I took.

In both situations, you are averaging out pixels spread across multiple images. It doesn’t work if you use a tripod however because each pixel and sub pixel would line up with the other photos and there wouldn’t be anything to average out. You’d need to bump the tripod in between shots so that the sub pixels got shifted a bit.

This is the processed image. Due to file size limitations, I can’t post the full sized image as it is over 30 MB.

By slightly adjusting each image, a spot that was captured by the red sub pixel in one image, might be captured by the blue sub pixel in another. Then, by averaging out 30 or so images, the picture gets smoother, sharper, and cleaner.

Now obviously if you don’t need your image to be larger than your camera can produce, then there is no reason to use this technique. In the sample images below, I’ve scaled the original to the enlarged size. Without doing that, you won’t see the improvement, or the processed one might even look worse.

You can download the full quality sample photos here if you’d like to compare for yourself: Sample Images

As you can see in the sample images below, the effect is quite impressive. I was able to take a stack of normal 26 megapixel images measuring 6240x4160 and scale them 200% up to 105 megapixels at a size of 12544x8380.

The left is a single image. The right is the sub pixel stacked images using this technique. Both have been scaled to the 12544x8380 size.

Here you can see how much smoother the dome is with the stacked image. This is why I refer to it almost as anti-aliasing. It reduces jagged edges on round shapes. Also the blotchiness is reduced.

I think this is the most stunning example. If you had to crop in on this section of the photo, the original would be nearly unusable for anything you’d want to sell. The processed photo looks nearly perfect by comparison.

There is one downside to this processes. Anything that is moving in the image will get blurred out due to it being in multiple locations across the stack of photos as seen below in the bushes and flags.

The bushes and flags are a blurry mess. In order to fix this, I would need to cut out the bottom portion of one image and lay it on top of my stacked images, but then that section might not look good scaled to a higher resolution.

In a change of pace, I decided to try this method out on more than just the obvious Photoshop. I have had Affinity Photo for a while and try to use it when I’m not in a hurry so that I can learn it. I turns out it does almost as good of a job at this task as Photoshop.

Here is a cheat sheet to help you remember the steps needed for both Photoshop and Affinity Photo. Watch the video to understand what these steps mean the first time you try.

Photoshop

  1. Add all images to a project in photoshop

  2. Convert all the smart objects created in step 1 to Layers

  3. Auto Align Layers

  4. Verify that the layers are lined up. Delete any that didn’t line up correctly

  5. Change Image Size

    1. Turn on Resample and choose Nearest Neighbor

    2. Scale up to 200%

  6. Select all layers and convert to Smart Objects

  7. Use Smart Object Stackmode and choose Mean (can use Median if it gives a result you prefer)

  8. Save the final stack as your final image

Affinity Photo

  1. Create a New Stack and add all your photos

  2. On the Stack choose Mean (or Median based on preference)

  3. Resize Document

    1. Turn on Resample and choose Nearest Neighbor

    2. Enter your new dimensions

  4. Right click on stack and choose Merge Visible

  5. Hide the stack by unchecking the checkbox (Only the Pixel layer should be enabled)

  6. Export the the final image