Announcing yet another way to Focus Tune, FoTunA v.0.1 (long)

Started May 1, 2013 | Discussions thread
ForumParentFirstPreviousNextNext unread
Flat view
RajahX
Forum MemberPosts: 62Gear list
Like?
Announcing yet another way to Focus Tune, FoTunA v.0.1 (long)
May 1, 2013

Picked up a D800 a few weeks back and I have been trying to get the best out of it. That usually means proper focus tuning. Dissatisfied with some of the products I saw out there for focus tuning, I tried my hand at developing my own This program has some similarities to Reikan's Focal, but I do have that program, and it is buggy as hell on my Mac. At the moment this is a command line only program for Win32, but a mac version may appear at a future date if there is enough interest. Being a quickly put together program, i haven't been able to test it out on a series of Nikon cameras and lenses. I have only tested it out on the lenses i have in conjunction with my D800 body. Hopefully this is of use to some people out there. It can be downloaded here:

Download the program

A description of the program follows.

FoTunA v.0.1 description

Overview

This application helps you determine optimal focus tuning values for a particular camera and lens combination. A series of RAW photographs are taken while varying the programmable focus offset while keeping the aperture, shutter speed, and ISO setting constant. The program analyzes the region around the central focus point in these photographs and then performs a curve fit to determine the best focus tuning value to use.

The benefits of the program over other focus tuning mechanisms available today are as follows. First, any user bias is removed by having the program analyze and determine a sharpness metric around the central focus point. Second, the results obtained with the tool are largely independent of the type of focus chart used as the focus target. As long as it is a target that the phase detect system employed by the camera is happy to use, the program will be able to analyze and interpret the results obtained. A sample target is provided, but the user can employ other targets. Third, by focusing on a small part of the image in the center, the program is less susceptible to alignment issues between the target and camera. Fourth, a series of photographs are used to determine the optimal focus point. There is some variability associated with focus systems and by using a series of photographs, we can chose a point that provides the greatest focus accuracy and reliability. Fifth, the application also detects shots taken with liveview and can report on how effective the contrast detect focus system of the liveview image is compared to the phase detect system.

Usage

Being an initial release, there are a number of limitations in the program:

  • Only Nikon RAW files from a camera that support focus tuning inputs is supported. Canon RAW support may appear in a future release.
  • It is able to read RAW files only. The analysis the program performs is most effective before any demosiacing is performed.
  • It is able to read uncompressed RAW files only. Compressed RAW support will come in a future release. Both 12-bit and 14-bit uncompressed Nikon RAW files are supported.

The camera must be configured to be in AF-S mode, single-point autofocus, and the central focus point should be selected. It is preferable to shoot in manual mode where aperture, shutter speed, and ISO values can be locked for the entire series of photos. It is also preferable to keep the ISO low so that image noise doesn't interfere with the analysis. Mount the focus target on a wall that is roughly parallel to the image plane. Position the camera a distance that is 30-50x the focal length of the lens, and position the central focus point on a region with sufficient contrast for the camera's focus systems to work. If the target supplied with the program is used, the distance will automatically be 30-50x away when the central focus point just covers the test image. As a reference and for comparison purposes, it may be useful to take a couple of photos in liveview mode using the contrast detect autofocus. The program will analyze these photos separately. Photos are to be taken using the phase detect system while varying the focus tune values from -20 to +20. For example, a strategy that works well is to step the focus tune values in +4 increments (-20, -16, -12, -8, -4, 0, +4, +8, +12, +16, +20) , and take two shots at each focus tune value.  For the first shot at each focus tune value, defocus the lens in the forward direction before taking the focused shot, and for the second shot defocus in the backward direction. The series of photos taken can then be fed to the program which then determines the optimal focus tuning value.

The files are supplied to the program to analyze in a specific way. First a prefix to the files is specified, then a suffix, then the number of digits in the file id, then the starting id, and finally the number of files is specified. For example, say you have the following files you wish to have analyzed in a directory called "focus_tune/images/":

DSC_0716.nef, DSC_0717.nef, DSC_0718.nef, DSC_0719.nef, DSC_0720.nef

You would invoke the program as "fotuna     focus_tune/images/DSC_       .nef     4    716    5". The first two arguments specify the prefix and suffix. The next argument indicates that there are four digits in the file id. The next argument indicates the starting file id, and the final argument indicates the number of files to read. If there is a missing file in the sequence it will be skipped during analysis.

The program will read the files and determine if they are contrast detect or phase detect shots. Contrast detect shots are analyzed separately. If they are phase detect, the program determines the focus tune value used to generate the shot. For each shot, either contrast detect or phase detect, the program computes a "FOM", figure of merit, that indicates how sharp the image is. Higher FOM values are indicative of sharper images. At the end of the program, it will attempt to do a curve fit on the set of focus tune values and FOMs determined, and determine an optimal focus tune value. It will also print out an average FOM for all the contrast detect shots so that phase detect can be compared to the contrast detect system. If a sufficient number of different focus tune values are not used, the program will skip the curve fitting process all together.

For example, running the FoTunA on the author's D800 and 35mm f/1.4G produces the following output:

>>>> fotuna.exe    test35\DSC_    .nef    4    274    24

FoTunA (Focus Tuning Aid, Nikon) v0.1

© Valavan Manohararajah, 2013

processing test35\DSC_0274.nef

camera: NIKON D800

serial no: xxxxxxx

lens: 35mm f/1.4

shutter: 0.010000 s

aperture: f/1.4

iso: 200

focal length: 35.0mm

shutter count: 723

contrast af: on

raw width: 7424

raw height: 4924

bits per pixel: 12

fom: 351.9

...

AF     FOM

-- hide signature --

-20     326.8

-20     327.1

-16     343.7

-16     341.1

-12     349.5

-12     346.9

-8     349.5

-8     346.8

-4     345.1

-4     345.0

0     335.4

0     331.3

4     330.0

4     319.6

8     305.6

8     327.8

12     298.2

12     306.4

16     289.1

16     293.6

20     278.8

20     284.5

curve fitting to determine best af tune value

best aftune point: -10

predicted fom: 343.2

r-squared: 0.924

fom of liveview shots: 352.4

The program prints out the focus tuning value used for each shot and its FOM. It prints out the best point determined via curve fitting and the predicted FOM at that point. It also prints out a confidence metric, r-squared, for the curve fit. And finally it prints out the FOM for the contrast detect shots.

 RajahX's gear list:RajahX's gear list
Nikon D800 Nikon AF-S Micro-Nikkor 60mm f/2.8G ED Nikon AF Nikkor 50mm f/1.8D Nikon AF-S Nikkor 24mm f/1.4G ED Nikon AF-S Nikkor 85mm f/1.4G +1 more
Nikon D800
If you believe there are incorrect tags, please send us this post using our feedback form.
ForumParentFirstPreviousNextNext unread
Flat view
Post (hide subjects)Posted by
ForumParentFirstPreviousNextNext unread
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark post MMy threads
Color scheme? Blue / Yellow