13 Replies Latest reply on Dec 15, 2016 6:21 PM by danielafort

    Locate a matching lens profile automatically

    danielafort Level 1

      I'm working on a project where we are using Nikon lenses on Canon (5D mark III) bodies. We managed to come up with a way to put the Lens Model in the EXIF metadata of our DNG files and it works great with Zeiss ZF.2 and other manual lenses but have come up with a problem trying to get Adobe Camera Raw to locate a matching lens profile automatically for a Nikon AF NIKKOR 35mm f/2D. We noticed that Nikon cameras use a Lens ID code number but the code for this lens (66) doesn't work when the shot originated on a Canon body.

       

      Is there a way to get ACR to recognize Nikon AF lenses automatically when attached to Canon bodies? Obviously we aren't using the autofocus features or any communications between lens and body. The lens information is being saved via Magic Lantern to an MLV file (Magic Lantern Raw Video) which is then converted into DNG frames that contains the EXIF tags for the lens information.

       

      Any hints, tips, or even known bugs to pass along?

       

      BTW -- we discovered that the list of supported lenses shows the "Zeiss Planar T* 1,4/85 ZF.2" which isn't recognized automatically by ACR. However, it works fine when the comma is replaced by a period "Zeiss Planar T* 1.4/85 ZF.2" in the Lens Model EXIF tag.

        • 1. Re: Locate a matching lens profile automatically
          ccastleb Adobe Employee

          Hi Daniel,

           

          The list of supported lenses generally matches the lens display names and not the specific EXIF value for Lens. Also, for many Zeiss SLR lenses, a generic EXIF name may be substituted inline with a specific product name. The code that handles this doesn't take into account mounting lenses meant for one camera system to another.

           

          As far as getting the auto match to work, there are a couple of options.

           

          1. Set a new Lens Profile Default in the Lens Corrections panel after manually locating the correct lens profile.

           

          OR

           

          2. Add a copy of the lens profile(s) to the user profile area and add an alternate lens ID (see below or example) for each applicable section that contains a LensID element.

           

          .....

          <rdf:Description

                 stCamera:Author="Adobe (www.adobe.com)"

                 stCamera:Make="Canon"

                 stCamera:CameraRawProfile="True"

                 stCamera:LensID="137"

                 stCamera:Lens="17.0-50.0 mm"

                 stCamera:LensInfo="17/1 50/1 0/0 0/0"

                 stCamera:CameraPrettyName="Canon"

                 stCamera:LensPrettyName="SIGMA 17-50mm F2.8 EX DC OS HSM"

                 stCamera:ProfileName="Adobe (SIGMA 17-50mm F2.8 EX DC OS HSM, Canon)"

                 stCamera:SensorFormatFactor="1.5"

                 stCamera:FocalLength="17"

                 stCamera:FocusDistance="999999995904"

                 stCamera:ApertureValue="2.970854">

                <stCamera:AlternateLensIDs>

                 <rdf:Seq>

                  <rdf:li>240</rdf:li>

                 </rdf:Seq>

                </stCamera:AlternateLensIDs>

          ......

           

          Regards,

           

          - Chris

          • 2. Re: Locate a matching lens profile automatically
            danielafort Level 1

            Option 1 is a bit cumbersome and works with only one lens at a time. At least the way I'm doing it there is only one Default at a time.

             

            Option 2 - "the user profile area" is where? I can go into /Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/Nikon/NIKON D3X (Nikon AF NIKKOR 35mm f2D) - RAW.lcp and look at a profile for the lens we are interested in. I'm not clear on the alternate LensID tag am I supposed to use. It seems that this profile is specific to the Nikon DX3 and we're using Canon 5D mark iii so maybe we need a whole new lens profile?

             

            It took me a while to get back to this because we were working with the scripts that put the lens information into the files. Another issue came up that is closely related to this with the Samyang (a.k.a. Rokinon and Bower) manual lenses. The cine lenses are popular with our users and it looks like there are several profiles that are supported. In fact I'm using an EOS-M as a test camera and there are several Samyang profiles for the M. This seems like the ideal setup for what we are doing because the lenses are not chipped. The EXIF tags for the lens has to be done in post production, yet these profiles don't auto match in ACR either even though I'm using the "right" camera and the "right" lens name in the DNG files.

            • 3. Re: Locate a matching lens profile automatically
              ccastleb Adobe Employee

              The user profile area is in the following location.

               

              /Users/<you> /Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/

               

              The manual/non-chipped Samyang/Rokinon/Bower lenses are not going to auto match since there is generally no metadata written at capture time to key off. You should be able to work around this by modifying/duplicating the profiles in the user area, add some key properties like stCamera:Lens, stCamera:LensID, stCamera:LensInfo that map to metadata you are writing in post production. Just be careful if choosing a LensID that has the potential to conflict with another profile with similar properties.

               

              As for the chipped versions, we don't have all of them covered just yet, but again, you can modify the non-chipped profiles to work around this.

               

              Regards,

               

              - Chris

              1 person found this helpful
              • 4. Re: Locate a matching lens profile automatically
                danielafort Level 1

                I now understand that the lens profiles that come with ACR are in:

                 

                /Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/

                 

                While the "custom" LensProfiles, like the ones from Adobe Lens Profile Downloader, are placed in:

                 

                /Users/<you> /Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/

                 

                Comparing the Zeiss ZF.2 profiles that are working fine against the Samyang ones that are not being automatically detected I see lots of differences. It seems very strange to me that a chipped lens like the ZF.2 series that are made to be used on Nikon bodies work fine in this application with Canon bodies. Looks like I'm going to have to do some more research on how ACR works with metadata. Is there some documentation that you can recommend?

                 

                Of course in an ideal world all lenses should be automatically detected as long as there is enough information in the EXIF metadata no matter if they are manual or auto or if a lens from one manufacturer is mounted on another manufacturer's body.

                 

                The Magic Lantern feature to add lens metadata is working quite nicely with the Zeiss ZF.2 manual lenses. Note that it is a common practice among professional cinematographers and stop motion animation to use manual lenses on DSLR cameras. In fact on the link I just pointed to it says:

                Using a Manual Aperture Lens to Avoid Flicker

                Note that we strongly recommend using a manual aperture lens (such as a Nikon lens) with a Canon body. With a digital lens, the aperture will close down to slightly different positions for each shot. This is not a problem for still photography, but for stop motion or time-lapse it creates "flicker".

                 

                In fact time-lapse photographers often untwist their automatic lenses breaking the lens/body communication to prevent flicker. Of course this also prevents the lens metadata from being recorded so our Magic Lantern application would come in handy in those situations as well.

                 

                I have more questions like is it even going to work applying a lens profile to a raw video frame that is a different size from the camera's native raw still image resolution? And if you need separate profiles for full frame and crop sensor (APS-C) bodies? In any case, it seems to me that the key to getting ACR to locate a matching lens profile automatically is not possible in all cases without modifying the lens profiles that shipped with ACR.

                • 5. Re: Locate a matching lens profile automatically
                  ccastleb Adobe Employee

                  Without getting into implementation details, the logic for matching lens profiles uses several pieces of image metadata and lens profile (.lcp) properties together. Usually it is the LensID, Lens, LensInfo, and sometimes camera Make. The property AlternateLensIDs (described above) and a similar AlternateLensNames property can be added when you have scenarios where metadata may be different due to lenses being used on different bodies or in cases where lens firmware has been changed by the manufacturer (e.g. exif lens name modification, different lens id). Hopefully that makes sense.

                   

                  In theory the profile should work with the video frame as long as it isn't cropped, though I would have to see how it works in practice with a sample frame.

                   

                  When we generate profiles in house, we always do so using the maximum sensor size supported by a lens. For example, a full frame lens profile is always generated from images shot on a full frame body. There is no need to redo the profile when the same lens is used on an APS-C body.

                  1 person found this helpful
                  • 6. Re: Locate a matching lens profile automatically
                    danielafort Level 1

                    ccastleb wrote:

                     

                    In theory the profile should work with the video frame as long as it isn't cropped, though I would have to see how it works in practice with a sample frame.

                     

                    It seems to work though we haven't done extensive tests.

                     

                    correction.gif

                     

                    I was hoping that it was just a matter of finding the right information to put into the EXIF tags in order to locate a matching lens profile automatically but it looks like we’re going to have to hack the lens profiles that shipped with ACR.

                     

                    Out of curiosity I copied one of the working Zeiss profiles, NIKON CORPORATION (Zeiss Planar T 1.4-85 ZF.2).lcp, into the user area in a test folder and started hacking it. First thing I tried was simply to change:

                     

                    stCamera:Lens="Zeiss Planar T* 1.4/85 ZF.2"

                    to

                    stCamera:Lens="My Lens"

                     

                    The reason I started there was because we had an issue with that lens. The lens profile that is listed in the Adobe website that lists the supported lenses is listed as Zeiss Planar T* 1,4/85 ZF.2 but that didn’t work when we put that into the EXIF metadata. It turned out that stCamera:Lens has the name with a “1.4” instead of “1,4” and was the trick to getting this lens to work.

                     

                    Getting back to hacking the lens profile, doing a find and replace "Zeiss Planar T* 1.4/85 ZF.2" with "My Lens" got ACR to automatically recognize "My Lens" in the EXIF tag as a "Zeiss Planar T* 1.4/85 ZF.2”.

                     

                    The Samyang profiles don’t have the stCamera:Lens tag but when I added stCamera:Lens="My Lens" to that profile it also automatically recognized it.

                     

                    So it looks like the problem is that the Samyang (and Rokinon/Bower) lens profiles that ship with ACR that don’t have the stCamera:Lens tag and that’s why ACR doesn’t automatically recognizes these lenses.

                     

                    Not quite sure how that tag is supposed to be used because I haven’t found documentation for these lens profiles but the Nikon AF NIKKOR 35mm f2D profile has this:

                     

                    <stCamera:Lens>35.0 mm f/2.0</stCamera:Lens>

                     

                    Changing it to this:

                     

                    <stCamera:Lens>My Lens</stCamera:Lens>

                     

                    Also works but changing it to:

                     

                    <stCamera:Lens>Nikon AF NIKKOR 35mm f2D</stCamera:Lens>

                     

                    in the “/Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/Nikon/NIKON D3X (Nikon AF NIKKOR 35mm f2D) - RAW.lcp” file breaks ACR’s ability to automatically recognize the lens on a raw file shot with that lens on a Nikon camera. It also doesn’t work with one of our DNG files that had the EXIF Lens Model tag set to Nikon AF NIKKOR 35mm f2D. So we’re still stuck on figuring out how to get lenses like this working.

                    • 7. Re: Locate a matching lens profile automatically
                      danielafort Level 1

                      Is it ok to modify a lens profile and share it? (It is easier to ask for forgiveness than permission.)

                       

                      http://www.magiclantern.fm/forum/index.php?topic=18083.msg176261#msg176261

                      • 8. Re: Locate a matching lens profile automatically
                        ccastleb Adobe Employee

                        I think sharing is fine.

                        1 person found this helpful
                        • 9. Re: Locate a matching lens profile automatically
                          ccastleb Adobe Employee

                          "So it looks like the problem is that the Samyang (and Rokinon/Bower) lens profiles that ship with ACR that don’t have the stCamera:Lens tag and that’s why ACR doesn’t automatically recognizes these lenses."

                           

                          When these were profiled, the camera didn't write a valid EXIF name, so we left it out.

                          1 person found this helpful
                          • 10. Re: Locate a matching lens profile automatically
                            ccastleb Adobe Employee

                            "in the “/Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/Nikon/NIKON D3X (Nikon AF NIKKOR 35mm f2D) - RAW.lcp” file breaks ACR’s ability to automatically recognize the lens on a raw file shot with that lens on a Nikon camera. It also doesn’t work with one of our DNG files that had the EXIF Lens Model tag set to Nikon AF NIKKOR 35mm f2D. So we’re still stuck on figuring out how to get lenses like this working."

                             

                            Keep in mind that modifying profiles is a non-standard behavior we don't claim will work 100% of the time. The 3 main pieces of metadata used to match are the LensID, Lens, and LensInfo tags. Also, I think the modified profiles in the user location will take precedence in a match conflict situation with the profiles in the installed location. To get around this, you should be able to include the alternate Lens and LensID tags as described earlier in the modified versions of the profiles.

                             

                            If you encounter any profiles for a CPU-enabled lens that do not automatically match and have not been modified (i.e. no potential conflicts) then we want to know about those separately so we can investigate/resolve legitimate bugs.

                             

                             

                            • 11. Re: Locate a matching lens profile automatically
                              danielafort Level 1

                              Ok, we're getting closer to a solution but most of it involves modifying lens profiles. I was hoping it could all be resolved with the EXIF tags.

                               

                              "If you encounter any profiles for a CPU-enabled lens that do not automatically match and have not been modified (i.e. no potential conflicts) then we want to know about those separately so we can investigate/resolve legitimate bugs."

                               

                              Will do.

                               

                              I'll also report on some issues I found in the current lens profiles for manual lenses, which is what I'm working on. If you look at the "Canon M (Samyang 10mm f2.8 ED AS NCS CS ) - RAW.lcp" it has a section that looks like this:

                               

                                     stCamera:ProfileName="Adobe (Samyang 10mm f/2.8 ED AS NCS CS, Canon EOS M)"

                                     stCamera:SensorFormatFactor="1.5"

                                     stCamera:ImageWidth="6048"

                                     stCamera:ImageLength="4038"

                                     stCamera:FocalLength="50"

                               

                              Focal length of 50mm? That's obviously wrong but if you compare it with the "Canon EOS M (Canon EF-M 22mm f2 STM) - RAW.lcp" you'll see this:

                               

                                     stCamera:ProfileName="Adobe (Canon EF-M 22mm f/2 STM)"

                                     stCamera:SensorFormatFactor="1.576691"

                                     stCamera:ImageWidth="5208"

                                     stCamera:ImageLength="3476"

                                     stCamera:FocalLength="22"

                               

                              The crop factor and image size on the Samyang profile are off.

                               

                              Also on that Samyang profile the stCamera:Lens is set to, "10mm f/2.8" -- rather generic but it is typical of Nikon lenses that also seem to use the stCamera:LensID tag to auto detect the lens. What I discovered is that by moving a lens profile into the "user area" (/Users/<you> /Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/) and changing the stCamera:Lens tag to the name of the lens ACR will automatically find the lens with just the Lens Model EXIF tag. This not only worked for the Samyang (Rokinon, Bower) lenses but also for Nikon AF lenses mounted on Canon bodies which of course have no lens/camera communication but works with the Magic Lantern feature we're developing. By the way it is a rather simple lua script.

                               

                              What got us started down this path was that the Zeiss ZF.2 lenses that we first tried were automatically matched in ACR.

                              31451185555_f562851f47.jpg

                               

                              I'd like to add the Samyang cine lenses to the lens choices but they aren't in the current lens profiles. Since we're modifying lens profiles I thought about using the same profiles as their still camera lenses because they use the same formula. As an option to having users get into hacking away on their Adobe CC installation I thought perhaps adding these profiles to the user database available through the Adobe Lens Profile Downloader. There are several profiles available for downloading so I tried one of them, the Richard Hachem - Canon EOS 5D - Samyang 35mm f1.4 AS UMC. It seemed that all the pieces were there but I could not get it to automatically recognize the lens. Selecting the Samyang "Make" got ACR to automatically fill in the rest of the fields.

                               

                              Screen Shot 2016-12-13 at 4.21.51 PM.png

                               

                              Looking at the code I'm not sure what is keeping it from being fully automatically recognized.

                               

                              So, to make a long post even longer:

                               

                              When these were profiled, the camera didn't write a valid EXIF name, so we left it out.

                               

                              Now that at least Magic Lantern equipped Canon cameras can write a valid EXIF lens name would it be possible to make a feature request for manual lenses like the Samyang follow the same convention as the Zeiss ZF.2 and have the stCamera:Lens tag set to the lens name?

                               

                              Note: I'd mark this post as the "Correct Answer" but I'm still missing how to get that downloaded lens profile working automatically.

                               

                              One more note: We obviously need to do more testing and probably create custom lens profiles for use with the various image sizes of DSLR raw video. I believe that having the ability of automatically correcting distortion, vignetting and lens aberrations is a natural fit with the Magic Lantern project.

                              • 12. Re: Locate a matching lens profile automatically
                                ccastleb Adobe Employee

                                The profiles were built using a camera body that matched the maximum sensor size that each lens supported (e.g. APS-C, 35mm, etc.). Since the distortion and vignette characteristics were the same across camera brands, we duplicated some of the profiles so they follow the pattern of having a profile for each mount supported (e.g. Canon EOS-M, Sony E, Canon EF, etc.). This is why some of the numbers you mention don't match up well. Also the focal length is bogus in some cases because the camera body either wrote a bogus value (it didn't know there was a lens attached) or there was no value for focal length, and the Lens Profile Creator stuck in a default value. I don't think the application of the profile to an image is affected by this, but for the sake of consistency, it makes sense to make them as close to what the camera would have written were the lens able to communicate with the camera. Hopefully that makes sense. I have a TODO to address this in the future, but I cannot guarantee when that will happen.

                                 

                                As for always adding the Lens tag, I agree that we should follow some predictable pattern based on at least what the chipped versions of these lenses record. This will take time since I will have to source various chipped versions of the lenses to gather test images and update profiles appropriately. Again, it's on my TODO list, but a lower priority than other product work I have on my plate.

                                 

                                For the images/profiles you are having trouble getting auto match to work, feel free to post profiles and images where I can download them and do some investigation on my end. You can either post the link here or to my email address ccastleb@adobe.com.

                                 

                                Regards,

                                 

                                - Chris

                                • 13. Re: Locate a matching lens profile automatically
                                  danielafort Level 1

                                  Chris --

                                   

                                  Thanks so much for your help on this. I'm going through the documentation in the Adobe Lens Profile Creator 1.0.4 but it doesn't get into defining the tags in the lens profile .lcp files and how ACR automatically matches up lens profiles.

                                   

                                  Also wondering, can ACR automatically find a lens profile that was submitted by a user and installed via the Adobe Lens Profile Downloader app? I take it that since it is installed in the user area it should take precedence over the ones from the ...CameraRaw/LensProfiles/1.0... library. There aren't any camera/lens combinations in the current download library that I can test but the manual lenses that I tried don't automatically match even though stCamera:Lens is already set the same as the Lens Model EXIF tag.