Deep dive into Nikon's Pixel Shift

Horshack

Forum Pro
Messages
11,231
Solutions
28
Reaction score
12,594
Location
US
Not all that deep since I'm far from an expert on this niche of sensor theory but perhaps still useful to those who are curious.

Theory of Operation

Most image sensors are color blind and achieve color sampling by placing colored filtered in front of each pixel. The filters are typically arranged in a repeating 2x2 RGGB pattern, with green pixels representing 50% of the total pixels and red and green 25% each. This means each pixel in a raw file has only green, red, or blue data - not all three. The monochromatic values between these are interpolated during raw processing to simulate full color images, with some inherent downsides including lower chroma sampling and demosaicing artifacts.

Pixel Shift uses multiple exposures and the sensor's IBIS mechanism to shift the position of the sensor in increments of 1 pixel for each exposure so that every "scene pixel" will be sampled by all four of the bayer color filters in the 2x2 RGGB pattern. This yields a full RGB triplet for every "scene pixel" vs the single monochromatic value obtained in a single exposure. This produces three benefits: increases the chroma (color) resolution of the image, reduces the noise of each pixel (from mean/median averaging of the multiple exposures), and eliminates demosaicing artifacts because the resulting image contains linear RGB that doesn't need to be demosaiced by the raw processor.

Here's a diagram showing how the Df moves the sensor for a 4-shot pixel shift sequence:


Nikon Df sensor movement for a 4-shot pixel shift

The sequence is:
  1. Take first exposure at baseline sensor position
  2. Shift the sensor one pixel right and take second exposure
  3. Shift the sensor one pixel down and take third exposure
  4. Shift the sensor one pixel left and take fourth exposure
The result is 4 raw files, which must be later assembled into a single composite raw using Nikon's NX Studio software.

Increased Resolution

Another technique that can be optionally employed is to shift the sensor by a fractional amount, specifically 1/2 a pixel. This can simulate a sensor with double the linear pixel density in both the horizontal and vertical axis (shifting both up/down), resulting in an image with 4x the total number of pixels. There are lots of practical factors which limit the increase in effective resolution though.

Here's a diagram showing how the Df moves the sensor for a 16-shot pixel shift sequence. Note that it still performs the chroma-enhancing 4-shift operation on top of the 1/2 pixel shift:


Nikon Df sensor movement for a 16-shot pixel shift

I generated the above diagram by analyzing the 16 raw files created by a 16-shot shift sequence and noting which direction the image shifted for each exposure and by how much, ie 1 pixel vs 1/2 sub-pixel. Here's a visual animation showing a sample of the image data I used.

Animation: Crop section of image movement for a 16-shot pixel shift

Note that the direction of sensor movement is opposite that of the image movement. For example, shifting the sensor right by one pixel actually shifts the captured image left by one pixel. There is a significant chance I messed the process up but even so hopefully you'll get the gist :-)

Pixel Shift options and their effect on resolution and noise

The Zf offers four possible shot counts for a pixel shift:
  • 4-shot: Same resolution / pixel count as single exposure but with full chroma sampling and lower noise from mean/median averaging of the exposures
  • 8-shot: Same resolution / pixel count as 4-shot mode but even lower noise from additional averaging of extra exposures.
  • 16-shot: 4x the pixel count of a single exposure and with full chroma sampling. I'm being careful to not say 4x the resolution since the effective increase in resolution will be limited by factors that will be considered in a future post.
  • 32-shot: Same pixel count / chroma as the 16-shot but even lower noise from additional averaging of extra exposures.
Interesting note about the 8-shot and 32-shot: the sensor actually shifts into new sensor rows for the extra exposures rather than shifting back to the original 2 rows of the 4-shot and 16-shot methods. I may touch on this in a later post.

There are additional workflow options as well, including delay to start of the sequence and the inter-exposure delay. Here is a short menu walkthrough demonstrating the options:



Sample Results

I'll now present some samples showing the benefits of pixel shifting in action. First we'll look at the reduction of demosaicing artifacts (aliasing and moiré) as well as the increase in resolved detail:

Image composite: Zf single exposure vs 4-shot vs 16-shot shift vs Z7

The above is an enlarged crop from each of the respective images, all upscaled to the resolution of the 16-shot exposure via PS Preserve Details 2.0. Note I show both capture-sharpening only samples (ie, ACR raw sharpening, set to 45/0.7/35), as well as capture sharpening + USM sharpening in PS (using 300/0.5). USM is used to demonstrate how the 16-shot pixel shift can tolerate (and actually require) additional sharpening vs the single exposure and 4-shot shift. I hope to go more into this in a later post.

I chose to use the same USM values for all samples, even though it creates obvious over-sharpening artifacts for all samples other than the 16-shot shift. I did this because using right-sized sharpening for each sample runs the risk of becoming subjective. Still, I plan to do some more nuanced sharpening comparisons in a future post.

When comparing the images, try to find areas of text in the chart that are unreadable in the single exposure but readable in the pixel-shifted images. And of course compare that to the native higher resolution of the Z7 sample. Also note the reduction/elimination of aliasing/false detail.

Here are animations of the same crops to help in visualizing the differences. Unfortunately the Z7 sample is slightly rotated - I chose not to correct that in post for this comparison since doing so would affect its acuity.

Animation: Zf single exposure vs 4-shot vs 16-shot shift vs Z7, capture-sharpening only

Animation: Zf single exposure vs 4-shot vs 16-shot shift vs Z7, capture+USM sharpening

Now let's take a look at the noise improvement, with a scene shot at -5EV exposure and raised in post to make the noise differences more obvious:

Animation: Zf single exposure vs 4-shot vs 8-shot, -5EV exposure

There's a significant decrease in visible noise between the single exposure and 4-shot in the above animation. There's actually a similar noise reduction between the 4-shot and 16-shot but it's less perceptible. Special thanks to SrMi for tips on looking into the noise improvements.

I hope to shoot some additional test scenes, preferably some with actual color to better highlight the increase in chroma resolution.
 

Attachments

  • 4396992.jpg
    4396992.jpg
    20.8 KB · Views: 1
  • 4396993.jpg
    4396993.jpg
    78 KB · Views: 0
Last edited:
Very interesting!

The explanation of moving one pixel to get more detail from a four-shot sequence sounds as though the Bayer filter “floats” above the sensor. How else would shifting a pixel expose that pixel to another color? Or do I have that wrong?

If it does float, does that mean that pixel-shift is impossible with the Z6/7/8/9?
 
Very interesting!

The explanation of moving one pixel to get more detail from a four-shot sequence sounds as though the Bayer filter “floats” above the sensor. How else would shifting a pixel expose that pixel to another color? Or do I have that wrong?

If it does float, does that mean that pixel-shift is impossible with the Z6/7/8/9?
You have it wrong. On a mobile device so can’t type an explanation at this time.
 
The explanation of moving one pixel to get more detail from a four-shot sequence sounds as though the Bayer filter “floats” above the sensor. How else would shifting a pixel expose that pixel to another color? Or do I have that wrong?

If it does float, does that mean that pixel-shift is impossible with the Z6/7/8/9?
No, I don’t think so.

the color filter of each photosite stays the same, but the image projected into the sensor by the lens does not change. So when the sensor shifts, the area of the image captured by any single photosite is now captured by a different photosite sensitive to a another color.

that is, the portion of the scene represented by one pixel is captured by a red sensitive photosite in shot 1, then by green in shot 2, then blue in shot 3 and finally green again in shot 4. The pixel representing that part of the projected image will be shifted by one in each resulting image.
 
This is really excellent work - well thought-out and clearly presented.

Thank you!
 
Very nice explanation 👍

For me, reduction in noise is more interesting effect than increasing the resolution.
 
The explanation of moving one pixel to get more detail from a four-shot sequence sounds as though the Bayer filter “floats” above the sensor. How else would shifting a pixel expose that pixel to another color? Or do I have that wrong?

If it does float, does that mean that pixel-shift is impossible with the Z6/7/8/9?
No, I don’t think so.

the color filter of each photosite stays the same, but the image projected into the sensor by the lens does not change. So when the sensor shifts, the area of the image captured by any single photosite is now captured by a different photosite sensitive to a another color.

that is, the portion of the scene represented by one pixel is captured by a red sensitive photosite in shot 1, then by green in shot 2, then blue in shot 3 and finally green again in shot 4. The pixel representing that part of the projected image will be shifted by one in each resulting image.
Thanks, this makes sense. Appreciate the explanation.
 
I noticed a peculiar artifact issue early on with 16-shot shits but revisited it today and it seems to occur on every 16-shot shift I do. Doesn't happen on the 32-shot shifts, which is the other sub-pixel shift mode the camera supports. Also doesn't occur on the full-pixel shift modes (4/8 shot). Here's an animation demonstrating the issue:

Animation: Zf 16-shot pixel shift artifact issue (compared to 32-shot)

It's barely visible at 100% without processing but because obvious when the image is sharpened. I've enlarged it to 500% with nearest-neighbor to make it more obvious. Seems to repeat at fixed row intervals (approx every 23 rows or so). Doesn't occur on all rows.

I'm certain it's not movement with my setup - I'm working on a concrete surface with excellent support. Not sure why it wouldn't show on the 32-shot shift - perhaps the artifact is median-blended away with whatever algorithm NX Studio is using.
 
Last edited:
In the OP I compared sharpness by upsampling the single exposure and 4-shot shift from their native 24MP to 96MP, to match the 16-shot's native 96MP. I used Photoshop's Preserve Details 2.0 resampling algorithm, which is the preferred method for upsampling. The problem is that Preserve Details 2.0 involves some implicit sharpening effects, which means the upsampled single exposure and 4-shot shift looks perceptually sharper than the 16-shot since the later was presented at its native resolution without upsampled sharpening.

To demonstrate this effect here is an animation showing the 4-shot shift upsampled to 96MP with two different methods - Preserve Details 2.0 and Bicubic Smoother. I compare both to the 16-shot shift at its native 96MP resolution:

Animation: Zf 4-shot shift upsampled via PD 2.0 and Bicubic Smoother vs 16-shot shift at native resolution

Notice how the 4-shot that's upsampled via Bicubic Smoother has about the same perceptual sharpening visible vs the native 16-shot image - this is good and what we want. From that we can tell the 16-shot actually resolves more detail, without any sharpening differences to make the comparison more difficult. Notice also how the 4-shot upsampled via Preserve Details 2.0 makes that comparison more difficult due to its implicit sharpening.

Few ways to solve this. How about upsampling both the 4-shot shift and 16-shot via Preserve Details 2.0 to a common higher resolution, say 192MP. That way both images undergo the algorithm's sharpening effects. Here's how that looks:

Animation: Zf 4-shot and 16-shot shifts upsampled to 192MP via PD 2.0

Hmm, the 4-shot still has more sharpening apparent vs the 16-shot even though both were upsampled via the same PD 2.0. I believe that's because the 4-shot undergoes a greater upsample (24MP -> 192MP) vs the 16-shot (96MP -> 192MP), and so the algorithm results in more apparent sharpening.

How about if we upsample both via Bicubic Smoother:

Animation: Zf 4-shot and 16-shot shifts upsampled to 192MP via Bicubic Smoother

That works.

In summary, there are two valid ways I see of comparing the pixel shifted images. One is to upsample the lower-resolution versions via Bicubic Smoother to match the resolution of the highest image presented. The other is to upsample all images to a common higher resolution, also with Bicubic Smoother.
 
Last edited:
Thank you for putting this together. Helped me a ton!
 
Thank you for the excellent explanation Horshack!

I am looking forward to viewing the first 16 or 32-pixel-shifted and focus-stacked (can the two in camera processes work together, or would we need to use an external automated focus rail for the focus stack sequence ?) images that a Z8 shooter posts.

Even better? a pixel shifted focus-stacked HDR sequence (if possible)!
 
Very interesting explanation.

I assume you need a very still set up for this?

What are the most likely uses for Pixel Shift?

Landscape

Products

Macro with a still subject?
 
Very interesting explanation.

I assume you need a very still set up for this?

What are the most likely uses for Pixel Shift?

Landscape

Products

Macro with a still subject?
Yes, to all. Pixel shift is designed for static subjects, from a tripod.
 
Nice work!

What I don't understand is how the pixel shift mechanism can be so precise.

We're talking 3-6 μm, depending on sensor...a hair is typically 50-100 μm.
 
Last edited:
Nice work!

What I don't understand is how the pixel shift mechanism can be so precise.

We're talking 3-6 μm, depending on sensor...a hair is typically 50-100 μm.
Did you know that Nikon is a global leader in making stepper motors photolithography, as well as industrial and consumer optics? nail about 10-12 years about one of their leading clients in Japan for stepper motors was Canon.
 
Nice work!

What I don't understand is how the pixel shift mechanism can be so precise.

We're talking 3-6 μm, depending on sensor...a hair is typically 50-100 μm.
Did you know that Nikon is a global leader in making stepper motors photolithography, as well as industrial and consumer optics? nail about 10-12 years about one of their leading clients in Japan for stepper motors was Canon.
I think (like a lot of things) people don't realize the other stuff nikon does.

Sony probably is more common to at least know about their different divisions, but nikons other stuff isn't as general consumer facing.
 
Nice work!

What I don't understand is how the pixel shift mechanism can be so precise.

We're talking 3-6 μm, depending on sensor...a hair is typically 50-100 μm.
Did you know that Nikon is a global leader in making stepper motors photolithography, as well as industrial and consumer optics? nail about 10-12 years about one of their leading clients in Japan for stepper motors was Canon.
Yes, but the stepper motors in the Zf probably cost no more than $5-10...

And you need the mechanics to be very high precision as well to obtain 1 μm resolution.

Considering that the Zf mech has no lock, I just wonder how the accuracy will be affected over time.
 
A big thank you! This was most likely much work, is nicely and clearly presented, and provides many useful insights.
 
Nice work!

What I don't understand is how the pixel shift mechanism can be so precise.

We're talking 3-6 μm, depending on sensor...a hair is typically 50-100 μm.
Did you know that Nikon is a global leader in making stepper motors photolithography, as well as industrial and consumer optics? nail about 10-12 years about one of their leading clients in Japan for stepper motors was Canon.
Yes, but the stepper motors in the Zf probably cost no more than $5-10...
it’s a huge business.
And you need the mechanics to be very high precision as well to obtain 1 μm resolution.
Photolithography requires even smaller movements. Pixel shift technology is not new. It has been around since the early 2000s. I remember using it back then on some high end (at the time) medium format digital backs.
 
Nice work!

What I don't understand is how the pixel shift mechanism can be so precise.

We're talking 3-6 μm, depending on sensor...a hair is typically 50-100 μm.
Did you know that Nikon is a global leader in making stepper motors photolithography, as well as industrial and consumer optics? nail about 10-12 years about one of their leading clients in Japan for stepper motors was Canon.
I think (like a lot of things) people don't realize the other stuff nikon does.

Sony probably is more common to at least know about their different divisions, but nikons other stuff isn't as general consumer facing.
Hmm. I was at a medical technology show in Anaheim on Thursday and Canon was there. One of the items they had in their booth were stepper motors. When I told them the company I work for, they said we are a customer of theirs. (I'm in business development, not on the technology side.) My manager is the R&D director for our company (yes - I know; it's a bit strange to me as well) and he told me yes, we have been buying stepper motors from Canon for at least ten years.

So ... has Canon been relabeling Nikon stepper motors as their own for all this time, or do they manufacture some motors but Nikon some others and they are clients of each other?
 

Keyboard shortcuts

Back
Top