Nikon D3200 Sharpness
 
Support Ukraine

Nikon D3200 Sharpness

Given that the Nikon D3200 has a 24.1 megapixel sensor, how do I get the most out of those pixels? In particular, what is the sharpest aperture for the Sigma 10-20mm?

1. Background

The Nikon D3200 is a very advanced camera. With a 24.1 megapixel sensor producing images 6016 pixels wide by 4000 pixels tall, it is also slightly frightening. As I wrote almost two years ago on the topic of camera technique: No matter how advanced a camera is, there tends to be a certain way it must be handled to produce optimal results, for any definition of optimal. "Getting to know the camera" is very much a process of mapping out this parameter space. With the Nikon D40 it took me over a hundred shots before I could reliably produce the exposure I wanted. With the D3200 it was the same.

Image quality is a very subjective topic, but in general it amounts to making the camera do what you want it to. Now, "sharpness" is a quality of photos that I think is discussed and measured to death by idiots in forums. Let me therefore clarify: Discussing and measuring it to death is bad, but knowing the optimal aperture for sharpness of your camera / lens combo is good. The former takes a lifetime of angry posts and leads nowhere, but the latter takes about an hour and gives you good information that will last for the lifetime of the camera and lens.

Sharpness is usually most important when doing landscape photography, and my workhorse lens for that is the Sigma 10-20mm / f4-5.6. I usually shoot it at 10mm focused at infinity, but when doing VR panoramas I sometimes switch to 20mm for the shots along the horizon. I also shoot flowers and stuff like that close-up at 10mm. Therefore I wanted to find the optimal aperture for the following scenarios:

  1. 10mm, subject far away

  2. 10mm, subject close

  3. 20mm, subject far away

I set up the test, took the shots, and here are the results:

2. Results

2.1. Executive Summary

At 10mm, the best near-distance sharpness was achieved at f/10 and the best far-distance sharpness was achieved at f/7.1. At 20mm, the best far-distance sharpness was achieved at f/10.

2.2. Longer Summary

This is the test scene. The large and small green rectangles are the areas used for local contrast computation. The contrast values for the outer rectangle are listed as "Large Area" and the contrast values for the small area are listed as "Small Area". See §3. Method for a detailed description.

The large and small focus test areas
The large and small focus test areas

Here are the contrast values for the areas plotted against lens aperture. Don't compare the left and right axis values - they are not comparable. See §4. Data for the raw data.

10mm, Distant. Optimal sharpness at f/7.1.

10mm, Close-up. Optimal sharpness at f/10.

20mm, Distant. Optimal sharpness at f/10.

The diagrams are very abstract, so let me illustrate the difference between f/4 (almost the worst) and f/7.1 (the best). Let's look at a 60 by 60 pixel square enlarged to 400%. We'll take it from slightly above the center of the image.

The area used for this example
The area used for this example

Here it is. Click on the "f/7.1" below the image or roll over to see the difference.

Sample area at 400%

f/4f/7.1

Sample area at 400%

Here's another sample area, this time only at optimal sharpness. As you can see, we're getting just about 24 megapixels's worth of actual image.

Another sample at f/7.1 and 400%
Another sample at f/7.1 and 400%

3. Method

The sharpness is calculated as the sum of the contrast in the sum of all three color channels of a FINE JPEG photo. First all color channels are added. Then contrast is the sum of the contrasts in the neighborhoods of each pixel in the focus test area. The contrast in the neighborhood of a pixel is defined as the sum of the squares of the difference of the value of the pixel and the value of the neighboring pixels. As neighboring pixels we count the four pixels to the left, right above and below. In pseudo-code:

ImageChannel gray = red + green + blue;
long contrast = 0;
for (each pixel x,y in the test area) {
    long localContrast = 0;
    
     // left
    localContrast += 
        square( gray(x,y) - gray(x - 1, y) );

    // right
    localContrast += 
        square( gray(x,y) - gray(x + 1, y) );
    
    // above
    localContrast += 
        square( gray(x,y) - gray(x, y - 1) );
    
    // below    
    localContrast += 
        square( gray(x,y) - gray(x, y + 1) );

    contrast += localContrast;
}
return contrast;

This means that image noise is included in the contrast calculation. However, as the image noise is unaffected by aperture, this will cancel out. JPEG compression artifacts are much smaller than the image edges, and the squaring of the differences guarantee that they will remain too small to affect the test results.

4. Data

Here is the raw data for the diagrams. Each row in a table represents a single photo. The total score for each f-number is the sum of contrast values for photos with that f-number.

Contrast: Close-up, Large Area
f-number Contrast
101473472586
111448089433
101429158060
91409085413
91393520483
111370859050
81288059419
81258286169
7.11102239095
7.11040928766
6.3931812825
6.3920802883
5.6751291320
5.6714257715
5572115763
5534129334
4.5460484983
4.5431817600
4388591946
4354472747
4352543342
Contrast: 10mm, Close-up, Small Area
f-number Contrast
1026491725
1025673471
1125528584
925269181
924931162
1124361075
822523498
822390356
7.119149487
7.118762605
6.315897082
6.315867621
5.613169796
5.612826077
510958649
510651488
4.59643050
4.59579383
48185206
47226068
47096176
Contrast: 10mm, Distant, Large Area
f-number Contrast
7.11365777217
7.11294214204
81251169880
81144173812
6.31138479783
6.31112244942
91052372584
5.6995958084
5.6985868637
9951613872
10910765216
11854693277
10853995877
13837169762
11833494018
5827627700
5818899814
13810064611
4.5723018625
4.5718831094
4614740719
4603907103
Contrast: 10mm, Distant, Small Area
f-number Contrast
7.15126870
84829496
7.14718426
94564463
84317265
103969488
93870154
6.33839366
4.53662542
113606362
103597535
133595812
6.33554724
5.63503059
113408462
5.63389681
133349138
53272568
4.53270652
53216864
43115018
42898726
Contrast: 20mm, Distant, Large Area
f-number Contrast
101754731081
111576525091
131491058391
81382651841
91375091782
141359707701
5.61228758086
6.31137003059
7.1981308428