LensFun Nikon AF-P Lens Profiles

I recently tried one of the newly submitted lens correction profiles for three of Nikon AF-P lenses, the AF-P 10-20mm wide lens, now found within lensfun-0.3.95 version.

I was saddened to see even with the lens correction profile applied to my photo taken with a Nikon AF-P 10-20mm lens within RawTherapee, there was still some remanent pin cushion lens distortion at the (1/16 or less) center of the image/photo.

I’m going to guess, this is likely due to the author only submitting the absolute minimal necessary lens test images. (I read into the process of creating a lens profile, and found it a very laborous process, unless one is already setup to profile lenses.)

Is this normal with other LensFun lens profiles as well?

Since correcting lens deformations is likely a redundant necessary task, what do most others do? Are they simply satisfied with the correction results of using a JPEG+RAW image comparison correction within RawTherapee? Or do dedicated users create their own lens profiles, time permitting I would assume.

The only other lens deformation I have noticed, is some barrel distortion when the Nikon AF-P 70-300mm lens is zoomed into 300m. Other than this, most other lens distortion seems not noticeable.

Shouldn’t you be happy that someone bothered to do it at all and then was kind enough to share their results?

If the results aren’t satisfactory, you should make you own. There isn’t any need to disparage someone else’s work.

I shoot mostly primes, so someone else has kindly provided good correction profiles to my lenses.

@asn has worked pretty hard to make this more approachable. Have you read his article on the blog? https://pixls.us/articles/create-lens-calibration-data-for-lensfun/

1 Like

Paperdigits, I think you’re being a little presumptuous.

If you take the time to read my entire post word for word, or more specifically focus upon paragraph three, you will then likely comprehend that I already understand and gave adequate credit/notice by mentioning the task of creating the lens profiles is a very “laborous” task. (The reason I know this, I researched creating a lens profile for raw images when using a custom firmware for a Canon small point and shoot camera, along with almost getting the profile submitted, but I thought the end result of my lens profile was not up to the standards of other completed lens profiles. Anyways, way off-topic here.)

Like I stated within the my initial above post, I am curious if I’m correctly discerning the performance of the submitted AF-P 10-20mm wide lens profile; and further curious as to the extent of other’s experience with lens deformation and what they do to workaround problems. I’m going to take a reasonable guess, most professionals whom rely upon Rawtherapee and Linux, take the time to create their own lens profiles unless they’re fortunate enough already to have a detailed and well tested lens profile. (I think you started to touch upon this yourself, stating you yourself use primes, for which lens profiles are likely much easier to create and maintain.)

Another workaround is likely to continue using the proprietary software already including completed/tested lens profiles, and then work on my own lens profiles during next Winter, time permitting. (I have to slave for somebody else during the Summer while being tortured, and Winters are not much better with the availability of free time. The world has really gotten crappy within the past 10 years.)

1 Like

I did read your post word for word. I don’t find it fair to critisize the work of others who have put in the time and effort to make something and share it as “not good enough” for you. If that is the case, you should put in the work.

I have also found that as I’ve bought more expensive glass, the correction profiles are better. My Nikon 50 mm f1.4 and 24mm f1.8 both have good correction. My tamron 70-200 f2.8 also has good correction, but that lens doesn’t have a lot of distortion to my eye. This is probably because there are fewer lenses in the more expensive category, so there are more users per lens.

If you’re using RawTherapee, you should be able to extract an LCP provided by Adobe/your lens manufacturer.

1 Like

Here’s a good scenario, so I should just keep my mouth shut and not say anything about the apparent possible flaws, similar to the ground troops wanting to keep their mouths shut and circumvent the gun nest within the WW2 Movie “Saving Private Ryan”? I think you have your opinion and I have mine. Again, reread my post, nowhere did I insinuate anything derogatory concerning the submitted lens profile, if anything, completely the opposite taking time to note the extreme labor required for creating the profiles.

If I built a house and I possibly did something incorrectly, I would rather have the constructive criticism and/or feedback, rather than people simply keeping their mouths shut and fearing me because of the number of stripes on my sleeves or stars on my collar. This is separate of any derogatory comments of course.

I also tried the Adobe (lens) profiles, but cannot recall if the AF-P series were omitted or not provided as of yet. As I do the math, it is possible Adobe realized a mere series of three photo sessions were not good enough for the AF-P lenses as well. (eg. minimum, middle, maximum focal length.) As I recall, a lot of the Adobe lens profile names seemed incomplete, and I think I had to delve deeper into the profiles or something. And as I further recall, the Adobe lens profiles are a mix of end user and likely some manufacturer supplied profiles.

Like I said, I’ll put this on my Winter agenda, profiling the lenses using the Adobe lens profiler and Adobe provided charts.

I haven’t read the rest of the replies, but could you please post an example?

And if you are able to take a picture at 10mm like described in the article, we can take a look and maybe fix the problem?

I was just thinking of doing so, but running short on time for the past few years… regardless, figured instead of typing ~5 minutes my excuse, figured devote the ~5 minutes digging the files-up and posting. So here they are.

The JPEG is rasterized from the NEF raw file using Nikon’s Capture NX-D. Attached also is the PP3 file for RawTherapee. (Notice how closely I have most colors matching, except for a slight higher contrast, but I’m now almost always using Capture NX-D’s “+20 Shadow Protection” & “+10 D-Lighting HS” features to likely attain a very similar end result. See n56_1196_01.jpg for this effect, now very similar to the RawTherapee’s excellent results!)

You’ll notice a small dimple in the middle of the image and some warping along the perimeter of the image. The perimeter maybe more noticeable as I think there’s now cropping yet being performed on the raw image.

I’m working this new PP3 file configuration recently for inclusion into my online web page, “RawTherapee & Nikon DSLR Cameras”, instructions how to get similar results from Nikon Capture NX-D. Think the last thing remaining are documenting/resolving these minimal lens deformations

n56_1196.nef (30.1 MB) n56_1196.nef.pp3 (11.0 KB)

Here’s a snapshot of RawTherapee’s JPEG with the associated JPEG.PP3 file results. The above *.JPEG files without any -rt suffix are JPEG files created using Capture NX-D. The below suffixed with “-rt” and are created using RawTherapee, if one doesn’t have time to view the above attached NEF raw file.

n56_1196.nef.pp3 (11.0 KB)

In order to see the lens deformations between n56_1196.jpg/n56_1196_01.jpg and n56_1196_rt.jpg, you’ll likely need to open the images side by side tabs, and quickly tab between the images. (I know there’s a slight mess on the first couple of images uploaded, the NEF/PP3 files download links are in between the images, and I don’t want to muck around with the http/wiki code and screw-up the hefty upload links. Also, no titles and filenames on the images displayed, so readers will likely be confused up until they download the images.)

One thing to consider is that distortion often changes with focus distance, so perhaps the Lensfun profile was made on a test chart at a closer distance.

Nikon’s software would have a look-up table to handle the full range of focus distances.

1 Like

Could you please take a picute like the first one @ this page? https://pixls.us/articles/create-lens-calibration-data-for-lensfun/

With trees is really next to impossible to understand. Maybe the correction is even better with lensfun but of course different.

Woods and trees are difficult to capture without distortions but a quick look shows minimal distortions here :smiley:
As mentioned above, a building might be a better subject to test, should be plenty of candidates in Cleveland such as:

Try using filebin.net to share larger files.

I already realise the photos for buildings is preferable for immediately discerning lens deformations, however what time permits here, the above photos are what I could post on the spare of the moment, and toggling between the two n56_1196.jpg/n56_1196_01.jpg and n56_1196-rt.jpg photos vividly & clearly shows the likely lens deformation at the center, and likely the perimeter as well. (This just requires an extra step of downloading the images and using a tabbed/toggled image viewer.) However, I completely agree the deformations are not readily visible to the naked eye, unless photo of a building or grid is taken. (It would take me a one or two days to take photos of buildings in Cleveland, and in that time I could easily start setting-up the lens profiling studio possibly planned for a Winter/indoor task.)

After I slept on this, early this morning I realized what is likely happening with using the AF-P 10-22mm lens profile from LensFun. I have not read/researched how the RawTherapee lens profiles are created, but the Adobe method required at the very least, a series of three photo sessions, each session included ~9 photos of a lens profile target. It maybe this 10-20mm lens profile I’m still seeing lens deformations with only included three photos, omitting the center and perimeter correction photos, for which would be corrected if at least the ~27 images or three sessions were submitted. Probably quite common to misread or misconstrue the instructions, thinking only three photos are needed for a lens profile… I almost did too initially. Regardless, I’ll toss it on my Winter agenda. I probably should file a bug report for LensFun regarding this.

I just noticed the April 2019 Adobe Camera Raw update, which (thankfully) includes the lens/color lcp/dcp profiles. (Regardless, results are the same.)

After fidgeting with the above posted NEF photos again, I noticed the fore mentioned problem with lens deformation is not caused by any bad LCP file, but more likely within the RawTherapee > Transform > Distortion Correction > Automatic setting. Automatic sets for -0.055 when apparently comparing against the embedded JPEG within the NEF, where as a setting +0.010 more correctly matches Nikon’s embedded NEF JPEG and/or Nikon’s Capture NX-D output. There’s still a dimple in the center after adjusting to +0.010, and/or at any setting. It maybe the Automatic adjustment is trying to straighten to one specific area, throwing everything else out-of-whack. (Sorry, couldn’t think of proper terminology.)

After much mucking around, clickety clicking and staring at the photos… Found another issue or conflict related to this lens deformation.

By enabling “Distortion Correction” and setting to Automatic, I acquired some unexpected results alongside enabling the Lens Deformation Profiles. Manually reverting the Distortion Correction amount to zero, resolved most if not all of the unexpected lens deformation. eg. Probably not a good idea to enable both “Profiled Lens Correction” (Lens Fun Profiles) and “Distortion Correction” at the same time!

Am I correct to think, enabling both of these functions at the same time is an expected conflict? Is it probably best to merge to the two functions together to prevent conflicts? As I reflect now, some probably inherently understand to only enable one and not both functions for correcting lens deformation.

I still have a very small tiny amount of Barrel Distortion (previously mistakenly referred to as Pincushion Distortion) deformation at only a small center part of the image when using Nikon AF-P 18-55mm kit lens profile. (I incorrectly referred to the lens used as a my AF-P 10-20mm, and should be noted as the AF-P 18-55mm. My mistake!)

Yes you shouldnt’use use Profiled lens correction together with distortion correction.

As for talking about residual barrel/pincushion and so on, we are waiting building pictures since June.

FYI: I just tried/compared using Adobe CameraRaw_11.3 Nikon lens profiles, and would appear the Adobe CameraRaw AF-P 18-55mm profile @ 18mm appears somewhat better then either LensFun and even Nikon’s proprietary embedded/software lens database corrections. One of the problems with using an external lens profile, the lens profile is not automatically assigned to the photo within RawTherapee.

So just waiting to remember to bring my camera on my next trip to Cleveland, or trip to other great geometric icon for photos. As I think, could even take a photos of a chicken wire fence close-up. (Probably better to use hardware cloth fencing or possibly a large screened window.)

I’ll likely start a new thread with just the facts, and will post here the topic when I do. If I don’t follow-up, it means I never was able to complete this profiling/comparison. At the very least, others will know where I left-off at.

I just found another neat little fix for the small amount of barrel distortion I’m seeing within the center of the image.

Crop the Nikon NEF original image size from 6003x4003 down to 6000x4000. Lock ratio needs to be unchecked with all other options at defaults. Weirdest thing as resize is not activated, but the small amount of barrel distortion at the very center of the images is apparently gone after cropping and geometric results look very similar to Adobe results now.

I probably have to add another function to my default profile, cropping the NEF images now. Might be something with the Nikon D5600 creating 6003x4003x NEF size images and then using lens profiles from a D3300 body? Shrugs … well, it works now.

Long story short:

  1. Try using Adobe lens profiles found within Adobe CameraRaw-11.3 if the default LensFun profiles create anomalies.
  2. Crop the raw image from 6003x4003 to 6000x4000, after uncheck crop “lock ratio” option.
  3. Do not enable two types of lens corrections at once. (eg. Specifying an LCP profile and enabling automatic lens correction via JPEG.); and of course double check the image for the lens used!

Why cropping here? Set the border in the demosaicing tool.

? My RT shows 6008x4008. But, as @ChasingShadows already mentioned, just set the border in Demosaic to 8, and you will get 6000x4000

Wow! Thanks. And correct, 6008x4008 was the correct original size.

(I was thinking this setting should be set automatically within the code after examining the resolution size within EXIF date, but then again, all camera make/models are not the same.)

Probably one of the first settings I should have been edumacated on, demosaic border size.