Previously, I posted a test protocol aimed at discerning focus shift and longitudinal chromatic aberration (LoCA) in camera/lens systems:
This test is accurate, repeatable, and can provide the basis for quantitative comparisons between lenses.
That’s the good news.
The bad news is that the test protocol as it has now evolved requires 200 exposures at each aperture, making it labor-intensive, time-consuming, and a general pain in the neck for the tester (that would be moi — I have no assistant).
Is there something that is a lot faster and easier that you could use to get a rough idea of the focus shift in a lens?
Indeed there is, and it comes with every (free) copy of MTF Mapper.
You print out a target that looks like this:
Then you place it at a 45-degree angle to the camera, with the wide edge further away than the short edge. You focus on the lower edge of the big black square, and take a picture that looks like this:
Then you turn MTF Mapper loose on the captured image. It looks at all those slanted edges and produces an MTF50 versus distance chart. It also spits out a text file with all the values that you can import into Excel and graph different results on one chart.
When I did the test with the Coastal Optical 60/4 at a central magnification ratio of about 1:12, this is what I got:
The horizontal axis is in pixels. To convert it to distance, you’d have to measure the distance from the camera to the center edge of the black square, and make sure the angle is very close to 45 degrees. Then measure the chart extent on the image, and do some trig.
The vertical axis is MTF50 in cycles per pixel. The overall numbers are much lower than those measured with the razor blade protocol when those test results are converted from cycles per picture height to cycles per pixel. I think that is mostly because I have no way to print out a target that’s much sharper than the lens at macro distances, whereas the razor blade is, uh, razor-sharp. Sorry, I couldn’t resist that.
You’ll notice that there’s no f/8 curve. For some reason that I don’t understand, MTF Mapper abended repeatedly and consistently with my f/8 capture.
Let’s compare the MTF Mapper focus shift graph to the one I did with the same lens at 1:10:
This is for the green raw channel. I’m not sure what channel or group of channels MTF Mapper is measuring. With a lens with as little LoCA as the CO 60/4, it makes little difference.
The general shape of the curves are within spitting distance of each other. I show more shift between f/4 and f/5.6 than the MTF Mapper curves do. I also show f/5.6 being sharper than f/11, whereas MTF Mapper reverses that order. I trust my results more, but I think there’s a lot of utility in being able to get a set of curves in 15 or 20 minutes rather than two or three hours.
A few details and caveats:
I just lined the chart up by eye. The camera wasn’t completely square to the chart before I applied the forty five degree movement.
I got the 45 degree movement by velcroing the chart (rotated 90 degrees from how it’s presented above) to a door, squaring up the camera, and opening the door roughly 45 degrees.
There is a lot of noise in the MTF Mapper results. The plot above was made using a smoothed curve option that MTF Mapper provides. My razor blade curves have no smoothing at all.
Here’s what the f/4 MTF Mapper curve looks like with no smoothing:
In the above, I’m distinguishing between the MTF Mapper one-shot method and my razor blade method by calling the former “MTF Mapper”. My razor blade method uses MTF Mapper, too, just in a different way.
I think there’s a lot of promise here, both for some of my tests, and for some of you out there that wish to measure focus shift on your own lenses and don’t want to fork out close to a thousand bucks for a motorized focusing rail and a controller.
I’m sure it has occurred to you that It wouldn’t be hard for the author of MTF Mapper to modify the focus shift graphing code to yield LoCA curves. I plan to be in contact with him to see if he’s interested in doing that.
Oh, and what are the seven shots? I figure f/1.4, f/2, f/2.8, f/4, f/5.6, f/8, and f/11 should be enough data points to nail down focus shift for most lenses.
Added 5/16:
Frans van den Bergh, the author of MTF Mapper, asked me for a copy of the raw files that I used for the above measurements. He found that the f/8 file, the one that caused his program to abend, was corrupted. He will be fixing MTF Mapper so that a corrupted raw file won’t cause a crash.
I went back and looked at the file that I sent him. It, too, was corrupted, indicating that the problem is not the Internet. Fearing a bad SD card, I looked at the file on the card. It was fine. So the problem was the reader. I’ll order another.
Adding the uncorrupted file to the data set produced this result:
Again, with the same kind of caveats as for the graph further up the page, this is consistent with the results obtained with the razor blade and moving focus rail.
I am now a little concerned that the results with the razor blade show a focus shift, albeit an admittedly small one, between f/4 and f/5.6, and the results with the 45-degree chart do not.
Changing the horizontal axis scaling of the simpler test gives a hint of what may be going on:
The f/5.6 and f/4 curves are not as peaky as they should be. In other words, they show too much depth of field. This may be related to target sharpness, or there may be something else going on. For example, it could also be related to the small difference in magnification for the two tests. We have seen earlier, in the comparison fo the 1:2 and 1:10 focus shift results, how magnification can affect focus shift strongly with this lens.
My thanks to Frans for his help on this.
[Added 5/18]
Frans has identified the source of the broadening of the f/5.6 and f/4 curves in the 45-degree shots as field curvature in the CO 60/4 lens. He has modified his code to concentrate on more central edges, and has produced a set of curves that look very much like the razor blade curves, except for some geometric horizontal axis stretching. He will be releasing the new version as rel 0.5.2. When he does, I’ll test it and report here.
Also, Frans gave me an incantation to get this test done on any give raw color plane. That should be the basis for one-shot LoCA testing. Whoopee! I’ll report of that when I get rel 0.5.2 of MTF Mapper.
Christoph Breitkopf says
I have a similar mode in my (yet unreleased) “lencheck” program. I use only a single long Edge, which I think has the advantage of excluding tangential aberration effects right from the source. Results look very similar, both for RAW and dcraw ahd channels. The program is far from being ready for release, but I might be able to put together a special LoCA-only Version in a few days.
Frans van den Bergh says
I’ll be up for some (friendly) cross-validation when you release.
Just some quick notes:
1. If you have a single edge that spans a large fraction of the sensor width (for example), then the edge will still be subject to lens distortion (such as radial distortion), meaning your slanted edge implementation (which is what I assume you are using) must compensate for potential curvature in the edge; and
2. A long edge (relative to image width) will be subject to astigmatism and field curvature. If we imagine a horizontal edge through the centre of the lens, spanning the entire image width, then the pixels near the edges of the image will have a very different PSF from those near the centre: Field curvature will cause the pixels near the edge to be slightly out of focus (if we assume perfect focus in the centre of the edge), and the often-observed decrease in both radial and tangential MTF as we move away from the centre will also be present. If the entire edge is processed in one go using the slanted edge method, then you will be averaging over all the PSFs found along the edge. If you do use a single edge, then it would be better to apply the slanted edge method only to short spans (maybe even a sliding window). Strictly speaking, the MTF measured by the slanted edge method is only truly correct if the edge length approaches zero, so the best compromise is to keep the edge as short as possible while trying to keep the signal-to-noise ratio under control.
Christoph Breitkopf says
Hello Frans,
sorry for the late reply – I’m using the comments subscription feature now (thanks, Jim!).
1. I don’t see how that is different from your test target, where you even get lateral CA. Or does MTF mapper correct for all these effects? In any case, I’m not trying to get _both_ super-exact MTF _and_ LoCA+focus shift with this test, but only the latter. I can live with getting too-low MTF as long as I can see the differences between the raw channels.
2. I am effectively using a sliding window (actually I currently don’t even detect the one long edge, but lots of short edges, which should also take care of curvature to some extent). This is still a problem because the recommended “at least 200 pixels for good MTF” edge length seems often so long that the ends are already slightly out of focus, thus reducing MTF.
Currently, what holds me up is however not edge detection or MTF calculation, but finding a good enough target (welcome to the club…). I’ve found the trying to tune the algorithm with sample shots from subquality targets just does not work. And one of my goals was to come up with a low-cost method, so more involved with finding low-cost high-quality targets at the moment. Razor blades are too short for my method. Metal profiles from the hardware store seem promising. I’ll keep you up to date.
I posted one of my test results a few days ago: http://bokesan.blogspot.de/2016/05/longitudinal-chromatic-aberration-and.html
– Chris
Chris Livsey says
Could the auto fine tune in the D500/D5 be used? (crudely)
Conventionally wide open is used to yield an offset, and yes due to all the variability in the systems repeats are required, but then by progressively closing down it should show if the offset remains the same or increases/decreases as the aperture changes, indicating focus shift, given the centre sensor is to -4Ev you should be able to close down enough at least to the point where DOF makes it moot anyway.
Of course this is limited to lenses compatible with F mount but if that’s your system….
Jim says
I suppose it could, Chris, if there’s a way to make the fine tuning happen at user-chosen f-stops. I have a D5, which supposedly has something similar, but I’ve never used it (the D5 is to cameras as Microsoft Word is to word processors),
One thing that makes me chary is the totality of the reports that I’ve been reading about the D5 autotune variability and general flakiness.
David Braddon-Mitchell says
Great! More tests then if less labor needed!
Lynn Allan says
> The vertical axis is MTF50 in cycles per pixel.
I’m fuzzy on what that means. Is it different units that correspond to resolving ability.
I think I may at least partially follow the graph with the label:
“H Edge Raw Green” … whatever that means. It has vertical values of 200, 400, 600, etc.
Sorry to be so slow, but what does 0.08, 0.1, 0.12, etc. on the left mean?
Jim says
The horizontal axis, with numbers of 500, 1000, 1500, etc, is location in the image by pixel. Not very useful in general, but about all MTF Mapper can do since they don’t know how far away the test chart is, or the focal length of the lens (well, I guess it could dig both those things out of the metadata, but my guess is that Frans thought, “Life’s too short for that.”). Since the target is at a 45 degree angle to the lens axis, the horizontal axis measures target distance in an uncalibrated way. I could convert it to cm, knowing the target distance at its center, the focal length of the lens, but I said to myself: “Life’s too short for that.”
The vertical axis, with values like 0.1, 0.12, is the MTF50 in cycles per picture height. Since the a7RII files are 5304 pixels high, you can multiply by that to get cycles per picture height. I didn’t do that multiplication, because I felt, in this instance, that it would encourage folks to compare the MTF50 numbers that I came up with with the razor blade test with the ones with the 45 degree target, and they are apples and oranges. At macro distances, the 45 degree target is not very sharp, and the razor is, as I said before, sharp as a razor.
Lynn Allan says
And does your blog software have provision so that we can made aware to a reply to a specific article? Email or an icon at the top would be ok.
But is that possible since I’m not clear if a lurker / reader such as myself can register / sign-in?
I do respect that TLW doesn’t show ads … or maybe AdBlockPlus is blocking these?
Or am I missing something?
Jim says
The subscription options that I have are subscribe to all posts, subscribe to all comments, or subscribe to both. I guess, for completeness sake, I should mention that subscribe to neither is also an option, though not one that I encourage people to use.
I suppose that there’s a WordPress plugin that allows what you want (it seems like there’s a WordPress plugin that does almost anything), but I haven’t looked for it.
The reason that you’re not seeing ads is that I don’t use them. This site is a labor of love, not a money-raising vehicle.
Jim
Lynn Allan says
How do I “register” with your blog? Is that possible, or I carelessly missed that button?
What happens that I might make a comment, then I have to check back and tediously scroll back thru the articles. If it shows a comment, then tediously go to the bottom and see if it is a reply from you to my specific comment.
Whine, whine, whine? “Life’s too short”?
My experience in other forum / blogs is that I’ll get an email notification about “ABC replied to your comment”. I don’t think Roger Cicala blog at LensRentals had that originally, but does now.
In the interests of time, and “life is getting shorter”, I’m getting inclined to take your blog link off “heavy rotation” and wait if your thoughts show up at DPR.
Or I could read the article, and put a “generic suggestion” at the bottom of the article in comments such as “Please consider publishing this on DPR.”
Jim says
All good points. There hasn’t been much commenting on this blog up to now, so no one has ever asked me those kinds of questions before. I know that the kind of thing you’re talking about is a standard feature of forum software. I wonder if I can get a simple WordPress plugin to add that capability.
[Update: I think what you want is working now. Give it a try and let me know.]
Jim
Lynn Allan says
Once again, I’m fuzzy … this time on:
Why do you need 200 captures? For statistical validity?
I’d think with one copy of the test chart on a partially opened door, the MtfMapper software might be able to gives results such as an Excel spreadsheet corresponding to sharpness value for each row / col of the polygons.
Then you could use the Excel spreadsheet to visualize the center, corners, and extremes. You could also “see” if the four quadrants were more or less the same, and how much worse than the center.
Does the MtfMapper take the 200 captures, and grind on them overnight unattended? Do you use something like the PlayMemories Time-Lapse App or an intervalometer?
Is the partially opened door to avoid needing the motorized rails?
Jim says
I only need one capture per f-stop for the partially opened door case. I need 200 when I’m using the rail.
When I’m analyzing the rail/razor blade images, I use a Matlab program to drive DCRAW and MTF Mapper, and it takes 2 to 4 hours to run through 1200 images. The Matlab program was written originally by Jack Hogan, and has been heavily modified by me. DCRAW was written by Dave Coffin. MTF Mapper was written by Frans van den Bergh. It takes a village.
Jim
Frans van den Bergh says
Another factor that contributes to the apparent broadening of the f/4 and f/5.6 curves is the field curvature of the lens. Looking at the figure above showing only the “raw” (unsmoothed) points as a scatter plot (for the f/4 case), it is possible (with a bit of effort) to see that the scatterplot is a projection of a surface that is curved in the “distance” direction.
In other words, MTF Mapper projects the measured MTF50 values onto the “distance” axis under the assumption that the intersection of the “surface of best focus” (often called the focus plane, although it is not a plane if field curvature is present) and the 45-degree chart is a straight line, which is (probably) never the case. Fortunately, I have already implemented some code to estimate the curve that is formed by the intersection of the “surface of best focus” and the chart. This should allow us to minimize the influence of field curvature, which should make for a sharper peak at f/4 and f/5.6.
The field curvature is still present at f/8 and beyond, but since the DOF is greater, the relative influence of field curvature is reduced.
Jim says
That makes sense, Frans. I eagerly await your update to MTF Mapper. Is there a possibility that you could do outputs for each color plane? That way we’d have a one-shot LoCA test.
Thanks,
Jim