Assign lens focal length and name for non cpu lenses

Started by Lars Steenhoff, October 29, 2016, 12:04:45 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Ant123

Quote from: dfort on November 27, 2016, 07:49:53 PM
You don't need to attach text files
I can't attach any file. There is no "attach" button.

Quoteit has anything to do with this topic for non cpu lenses
maybe it could be helpfull for EF lens exploring...

dfort

Quote from: Ant123 on November 27, 2016, 08:24:11 PM
I can't attach any file. There is no "attach" button.

You have to link to a download URL on this forum, like with videos and photos.

Ant123

Quote from: dfort on November 27, 2016, 08:35:15 PM
You have to link to a download URL on this forum, like with videos and photos.
It's not an attachment. Why this feature is not enabled on ML forum?

dfort

Probably because it would quickly fill up the server with some large files. You can ask g3gg0.

In any case, let's get back on topic. We might want to use the Lens ID code instead of the name. According to your file:

LensID           = 0x1031
LENS NAME: EF-M22mm f/2 STM (Size: 17 Byte)


exiftool -- lib/Image/ExifTool/Canon.pm
    4145 => 'Canon EF-M 22mm f/2 STM', #34


mlv_dump -v
     Name:        'EF-M22mm f/2 STM'
     Serial:      ''
     Focal Len:   22 mm
     Focus Dist:  43 mm
     Aperture:    f/12.80
     IS Mode:     0
     AF Mode:     0
     Lens ID:     0x00000031


@g3gg0
Looks like there might be a problem with the MLV Lens ID. Shouldn't it be 0x00001031 (decimal 4145)?

g3gg0


a) print_msg(MSG_INFO, "     Lens ID:     0x%08X\n", lens_info.lensID);
b) hdr->lensID = lens_info.lens_id;
c) uint32_t    lensID;    /* hexadecimal lens ID (delivered by properties?) */
d) uint16_t                lens_id;
e) lens_info.lens_id = info[4] | (info[5] << 8);


hmm so then it must be the property being interpreted wrong or it doesnt have that id?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

right, at e) seems to be the bug. trying to fix it...
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

dfort

Lens ID works on EOSM and 700D with that PR. Still no Serial number though.

     Name:        'EF-M22mm f/2 STM'
     Serial:      ''
     Lens ID:     0x00001031


Nice additions to the Lens Info/Prefs menu.



Thanks!

g3gg0

guess that S/N thingy i found on 600D was some false alarm.

do you know the S/N of your lens? maybe you could dump the PROP_LENS content to check if the S/N is in there.
maybe at offset 0x16/17/18 is some information?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

dfort

I know the serial number of my lens but not sure how to dump the PROP_LENS content.

g3gg0


@@ -1104,5 +1114,15 @@
     #endif
     
+    FILE * f = NULL;
+
+    f = FIO_CreateFile("LENS.BIN");
+    if (f)
+    {
+        bmp_printf(FONT_LARGE, 0, 60, "Writing LENS");
+        FIO_WriteFile(f, (void*) info, 0x1E);
+        FIO_CloseFile(f);
+    }
+   
     if (lens_info.raw_aperture < lens_info.raw_aperture_min || lens_info.raw_aperture > lens_info.raw_aperture_max)
     {
         int raw = COERCE(lens_info.raw_aperture, lens_info.raw_aperture_min, lens_info.raw_aperture_max);

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

oh eh, add this to lens.c in function

PROP_HANDLER(PROP_LENS)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

dfort

Ok--this is the entire contents of LENS.BIN viewed through a hex editor it looks like this:

01185010 31001600 1680439A 7C00FF00 00000000 00004118 33010800 3D19

The serial number of the lens is:

950202019971

In hex that would be:

DD3C743083

If that the serial number is saved as ASCII it should look like this:

39 35 30 32 30 32 30 31 39 39 37 31 0a


g3gg0

thanks, so no serial in the property. makes sense as it would be really long
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

dfort

@dmilligan

Is your manual_lens_info branch at a point where we can start trying out some scripts? Seems like lens.name is working which is the one that is needed for the ACR automatic lens distortion correction to work. Are you planning on adding lens.focal_length and have you decided what to do with lens.aperture or camera.aperture? It would be great to have these available to lua along with the Lens ID and serial number but we should be able to get something functional with just lens.name.



dmilligan

Yes, you can try it. All three properties should be working. I implemented aperture override as lens.manual_aperture. In lens.lua, simply add your lens definitions like the ones already there, and you can add a "manual_aperture" field to the lens definition (the existing examples just have name and focal_length).

dfort

@Lars_Steenhoff -- here's something for you to test:

https://bitbucket.org/daniel_fort/magic-lantern/downloads/magiclantern-manual_lens_info.2016Dec05.5D3113.zip

This part should be familiar to you by now.


When you start up with a non-chipped lens attached or if you remove a chipped lens while the camera is on you'll get this lens selector:


These are your Zeiss ZF.2 manual lenses. Pick the one you have mounted and the metadata will be embedded in your MLV files.

Block: LENS
  Offset: 0x0000014c
    Size: 96
    Time: 0.003000 ms
     Name:        'Zeiss Planar T* 1.4/85 ZF.2'
     Serial:      ''
     Focal Len:   85 mm
     Focus Dist:  0 mm
     Aperture:    f/2.00
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x00000000
     Flags:       0x00000000


@dmilligan -- note that the Aperture isn't showing up. This is what I did in your lua script:
[EDIT] My bad, seems like I was looking at a file before adding the manual_exposure field.

lenses =
{
--  Zeiss ZF.2 manual lenses
--    { name = "Zeiss Distagon T* 2.8/15 ZF.2", focal_length = 15, manual_aperture = 2.8 },
--    { name = "Zeiss Distagon T* 3.5/18 ZF.2", focal_length = 18, manual_aperture = 3.5 },
--    { name = "Zeiss Distagon T* 2.8/21 ZF.2", focal_length = 21, manual_aperture = 2.8 },
--    { name = "Zeiss Distagon T* 2.8/25 ZF.2", focal_length = 25, manual_aperture = 2.8 },
    { name = "Zeiss Distagon T* 2/25 ZF.2", focal_length = 25, manual_aperture = 2 },
--    { name = "Zeiss Distagon T* 2/28 ZF.2", focal_length = 28, manual_aperture = 2 },
    { name = "Zeiss Distagon T* 2/35 ZF.2", focal_length = 35, manual_aperture = 2 },
--    { name = "Zeiss Distagon T* 1.4/35 ZF.2", focal_length = 35, manual_aperture = 1.4 },
    { name = "Zeiss Makro-Planar T* 2/50 ZF.2", focal_length = 50, manual_aperture = 2 },
--    { name = "Zeiss Planar T* 1.4/50 ZF.2", focal_length = 50, manual_aperture = 1.4 },
    { name = "Zeiss Planar T* 1.4/85 ZF.2", focal_length = 85, manual_aperture = 1.4 },
--    { name = "Zeiss Makro-Planar T* 2/100 ZF.2", focal_length = 100, manual_aperture = 2 },
--    { name = "Zeiss Apo Sonnar T* 2/135 ZF.2", focal_length = 135, manual_aperture = 2 },
}


These are all the Zeiss ZF.2 lenses. The ones that aren't in Lars Steenhoff's arsenal are commented out to reduce clutter. I'm planning on adding the Samyang (Rokinon, Bower) Cine lenses to the list because they are also popular manual lenses. Other lenses can be added by the user but as we learned, not all lenses are automatically recognized by Adobe Camera Raw. Fortunately the Zeiss ZF.2 lenses are:



When you switch manual lenses or if you want to check and see which lens is currently selected in the camera go to the wrench icon and pick Lens Info Prefs. You can bring up the lens selector by selecting the lens name.



Some things on my wish list are:

  • Have the manual_aperture show up in the MLV file. Already done
  • Give more room to the lens name field in Lens Info Prefs because many of the lens names overlap the "Manual Lens" field.
  • Save the last lens used in a configuration file and make that the default the next time the camera is started or lens changed. It looks like that is already in the works.
  • Make the lens selector a scrolling display. Maybe that is already done and I just haven't added enough lenses to the list? That was done too.
  • Add the lens ID and serial number to the fields available to lua. (May need g3gg0's help with the lens serial number.)

Lars Steenhoff

Cool stuff @dfort!

Im preparing for a trip, this will come in handy.

And when we get lens ID working i have some hope that nikon lenses will be reconised by id.


dfort

Yeah, cool if you are using Zeiss ZF.2 lenses.

It is looking pretty solid. I had to go back and edit some of those issues I pointed out earlier because manual aperture and the scrolling display are working.

I just tried it with some Samyang lens profiles and it isn't working in Adobe Camera Raw. I also went back to that Nikon AF NIKKOR 35mm f/2D lens to see if I could get that working but it still doesn't work with ACR, at least not automatically like it should.

Block: LENS
  Offset: 0x0000014c
    Size: 96
    Time: 0.003000 ms
     Name:        'Nikon AF NIKKOR 35mm f/2D'
     Serial:      ''
     Focal Len:   35 mm
     Focus Dist:  0 mm
     Aperture:    f/2.00
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x00000000
     Flags:       0x00000000


I got an answer from the Adobe forum but the answer came back with an example for a completely different lens and I don't have a deep enough understanding of ACR to decipher what it means.

https://forums.adobe.com/message/9158301
QuoteHi 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

dfort

Here's an idea for the lua script. Added some of the more popular manual lenses. Only problem right now is that the Zeiss lenses are being automatically detected in Adobe Camera Raw but the Samyang lenses and most other lenses I tried, are not. Let's see if someone at the Adobe forum comes up with a solution for this.

lenses =
{
--  The following is for testing purposes. Comment out the following lines then either uncomment the lenses
--  from the list or add your own lenses.

    { name = "My Lens", focal_length = 50 },
    { name = "My Other Lens", focal_length = 25 },

--  Zeiss ZF.2 manual lenses Nikon mount
--  { name = "Zeiss Distagon T* 2.8/15 ZF.2",        focal_length =  15, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 3.5/18 ZF.2",        focal_length =  18, manual_aperture = 3.5 },
--  { name = "Zeiss Distagon T* 2.8/21 ZF.2",        focal_length =  21, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 2.8/25 ZF.2",        focal_length =  25, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 2/25 ZF.2",          focal_length =  25, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 2/28 ZF.2",          focal_length =  28, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 2/35 ZF.2",          focal_length =  35, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 1.4/35 ZF.2",        focal_length =  35, manual_aperture = 1.4 },
--  { name = "Zeiss Makro-Planar T* 2/50 ZF.2",      focal_length =  50, manual_aperture = 2   },
--  { name = "Zeiss Planar T* 1.4/50 ZF.2",          focal_length =  50, manual_aperture = 1.4 },
--  { name = "Zeiss Planar T* 1.4/85 ZF.2",          focal_length =  85, manual_aperture = 1.4 },
--  { name = "Zeiss Makro-Planar T* 2/100 ZF.2",     focal_length = 100, manual_aperture = 2   },
--  { name = "Zeiss Apo Sonnar T* 2/135 ZF.2",       focal_length = 135, manual_aperture = 2   },

--  Samyang manual lenses - also branded as Rokinon and Bower. Cine versions use the same lens profile.
--  { name = "Samyang 8mm f/2.8 UMC Fisheye",        focal_length =   8, manual_aperture = 2.8 },
--  { name = "Samyang 8mm f/2.8 UMC Fisheye II",     focal_length =   8, manual_aperture = 2.8 }, --   8mm T3.1 Cine
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS",    focal_length =   8, manual_aperture = 3.5 },
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS II", focal_length =   8, manual_aperture = 3.5 }, --   8mm T3.8 Cine
--  { name = "Samyang 10mm f/2.8 ED AS NCS CS",      focal_length =  10, manual_aperture = 2.8 }, --  10mm T3.1 Cine
--  { name = "Samyang 12mm f/2 NCS CS",              focal_length =  12, manual_aperture = 2   }, --  12mm T2.2 Cine
--  { name = "Samyang 12mm f/2.8 ED AS NCS Fisheye", focal_length =  12, manual_aperture = 2.8 }, --  12mm T3.1 Cine
--  { name = "Samyang 14mm f/2.8 ED AS IF UMC",      focal_length =  14, manual_aperture = 2.8 }, --  14mm T3.1 Cine
--  { name = "Samyang 16mm f/2 ED AS UMC CS",        focal_length =  16, manual_aperture = 2   }, --  16mm T2.2 Cine
--  { name = "Samyang 21mm f/1.4 ED AS UMC CS",      focal_length =  21, manual_aperture = 1.4 }, --  21mm T1.5 Cine
--  { name = "Samyang 24mm f/1.4 ED AS IF UMC",      focal_length =  24, manual_aperture = 1.4 }, --  24mm T1.5 Cine
--  { name = "Samyang 35mm f/1.4 AS IF UMC",         focal_length =  35, manual_aperture = 1.4 }, --  35mm T1.5 Cine
--  { name = "Samyang 50mm f/1.2 AS UMC CS",         focal_length =  50, manual_aperture = 1.2 },
--  { name = "Samyang 50mm f/1.4 AS UMC",            focal_length =  50, manual_aperture = 1.4 }, --  50mm T1.5 Cine
--  { name = "Samyang 85mm f/1.4 AS IF UMC",         focal_length =  85, manual_aperture = 1.4 }, --  85mm T1.5 Cine
--  { name = "Samyang 100mm f/2.8 ED UMC MACRO",     focal_length = 100, manual_aperture = 2.8 }, -- 100mm T3.1 Cine
--  { name = "Samyang 135mm f/2 ED UMC",             focal_length = 135, manual_aperture = 2   }, -- 135mm T2.2 Cine
--  { name = "Samyang 300mm f/6.3 ED UMC CS",        focal_length = 300, manual_aperture = 6.3 },
}

dfort

Been having quite a conversation on the Adobe Camera Raw forum with an Adobe staff member. I did some hacking on a profile for a lens that I own and came up with something that works. Basically, the stCamera:Lens tag in the lens profile seems to be the key.

Here's the line to add to our lua script:

{ name = "Bower 16mm T2.2 Cine", focal_length = 16, manual_aperture = 2.2 },

This lens has the same formula for a lens that has a profile in ACR, the Canon M (Bower 16mm f2 ED AS UMC CS) - RAW.lcp. Changed it to this:

Canon(Bower 16mm T2.2 Cine) - RAW.lcp
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c011 79.156380, 2014/05/21-23:38:37        ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
    xmlns:stCamera="http://ns.adobe.com/photoshop/1.0/camera-profile">
   <photoshop:CameraProfiles>
    <rdf:Seq>
     <rdf:li>
      <rdf:Description
       stCamera:Author="Adobe (www.adobe.com)"
       stCamera:Make="Canon"
       stCamera:CameraRawProfile="True"
       stCamera:CameraPrettyName="Canon"
       stCamera:Lens="Bower 16mm T2.2 Cine"
       stCamera:LensPrettyName="Bower 16mm T2.2 Cine"
       stCamera:ProfileName="Adobe (Bower 16mm f/2 ED AS UMC CS, Canon)"
       stCamera:SensorFormatFactor="1.6"
       stCamera:ImageWidth="4770"
       stCamera:ImageLength="3177"
       stCamera:FocusDistance="1.200143">
      <stCamera:PerspectiveModel
       stCamera:Version="2"
       stCamera:FocalLengthX="0.69907"
       stCamera:FocalLengthY="0.69907"
       stCamera:ImageXCenter="0.508043"
       stCamera:ImageYCenter="0.513054"
       stCamera:ResidualMeanError="0.00024"
       stCamera:ResidualStandardDeviation="0.000368"
       stCamera:RadialDistortParam1="-0.088214"
       stCamera:RadialDistortParam2="0.073774"
       stCamera:RadialDistortParam3="-0.030652"/>
      </rdf:Description>
     </rdf:li>
     <rdf:li>
      <rdf:Description
       stCamera:Author="Adobe (www.adobe.com)"
       stCamera:Make="Canon"
       stCamera:CameraRawProfile="True"
       stCamera:CameraPrettyName="Canon"
       stCamera:Lens="Bower 16mm T2.2 Cine"
       stCamera:LensPrettyName="Bower 16mm T2.2 Cine"
       stCamera:ProfileName="Adobe (Bower 16mm f/2 ED AS UMC CS, Canon)"
       stCamera:SensorFormatFactor="1.6"
       stCamera:ImageWidth="4770"
       stCamera:ImageLength="3177"
       stCamera:FocusDistance="3"
       stCamera:ApertureValue="6">
      <stCamera:PerspectiveModel>
       <rdf:Description
        stCamera:Version="2"
        stCamera:FocalLengthX="0.69907"
        stCamera:FocalLengthY="0.69907"
        stCamera:ImageXCenter="0.508043"
        stCamera:ImageYCenter="0.513054"
        stCamera:RadialDistortParam1="-0.088214"
        stCamera:RadialDistortParam2="0.073774"
        stCamera:RadialDistortParam3="-0.030652">
       <stCamera:VignetteModel
        stCamera:FocalLengthX="0.69907"
        stCamera:FocalLengthY="0.69907"
        stCamera:VignetteModelParam1="-0.302536"
        stCamera:VignetteModelParam2="0.05392"
        stCamera:VignetteModelParam3="-0.051277"/>
       </rdf:Description>
      </stCamera:PerspectiveModel>
      </rdf:Description>
     </rdf:li>
    </rdf:Seq>
   </photoshop:CameraProfiles>
  </rdf:Description>
</rdf:RDF>
</x:xmpmeta>


It works!



I kept the same profile name so I know where it came from.

Ok, so I believe that there's a problem at Adobe's end because these lenses should be automatically recognized but the good news is that it is rather simple to modify an existing lens profile to work.

DeafEyeJedi

5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

dfort

@Lars_Steenhoff

Had a breakthrough today. To get your Nikon AF NIKKOR 35mm f2D lens working with the lua script simply copy the profile from the ACR installation. I'm not sure what the Windows location is but on the Mac it is in:

/Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0/Nikon/NIKON D3X (Nikon AF NIKKOR 35mm f2D) - RAW.lcp

and put the copy in your user area, again on the Mac it is in:

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

Then edit the stCamera:Lens from this:

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

To this:

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

Do a copy/replace because there are multiple instances of that tag.

Finally put that lens name in your lua script and that's it.

For more details, here's my latest post on the Adobe Camera Raw forum:

https://forums.adobe.com/message/9200782#9200782

Lars Steenhoff

thats very nice to see @dfort  :)

so a few extra steps but once its setup it all automatic.
I read about your idea of submitting custom profiles to the adobe database, is this still something worth doing ?