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 1 Guest are viewing this topic.

zLOST

Quote from: zLOST on January 21, 2019, 11:02:21 PM
Not yet. This was like the second or third time i've run it so far. But it might be a nice feature to have the output format configurable for individual editors (including the filename, but in DT case it would require some troubleshooting why the heck io.* crashes when working on files with two suffixes).

Seems like we'd need completely different format.. But it might be doable as well ;) I'll play with it a bit tomorrow..
(this is a part of pp3 file used as meta storage by RT, which may be of some use for us)

[LensProfile]
LcMode=lfauto
LCPFile=
UseDistortion=true
UseVignette=true
UseCA=true
LFCameraMake=
LFCameraModel=
LFLens=


I've just tested it and the LCCamera and LFLens fields are used to store the data related to chosen correction profile, but i assume, that these are used after the profile is selected by user or when there is a profile matching Lens.Name from Exif.

So i'm afraid, that as long as we don't have the "faked" data in exif, this is a not going to help.

aprofiti

Quote from: zLOST on January 21, 2019, 10:45:30 PM
Thanks for the non-crashing build, Alessandro. It's perfect!
Happy to hear this!
Please report any strange behaviour if you plan to use it in the next days.

Quote from: zLOST on January 21, 2019, 10:45:30 PM
To ease my struggle with finding the right field to use for lens name, which will be accepted by darktable, i've modded xmp.lua, so the properties name can be a string and table/array as well to generate three lines with a single call to add_property()
Nice idea! May be useful to make code a little bit shorter if we add the new tags. Will look into it :)

Quote from: zLOST on January 21, 2019, 10:45:30 PM
At the moment i'm using this xmp output (the exifEX:LensModel is the right field for DarkTable...)
Would like to know if inserting the same information but with different namespace can make any editing software angry or not, as what I understood from your post, each software looks at different tags in the xmp.
Is possible to make a short recap on which tags each software use?

We could fill .xmp using different namespace (aux, exif, exifEx ) for the same information (name, aperture...) If there aren't any problems.

Quote from: zLOST on January 21, 2019, 10:45:30 PM

xmp.lens_specification  = { name = "exif:LensSpecification",    format = "%s" } -- Exif.Photo.LensSpecification  Rational  This tag notes minimum focal length, maximum focal length, minimum F number in the minimum focal length, and minimum F number in the maximum focal length, which are specification information for the lens that was used in photography. When the minimum F number is unknown, the notation is 0/0


xmp:add_property(xmp.lens_specification,        function()
                        local focal_min = (lens.focal_min or lens.focal_length)
                        local focal_max = (lens.focal_max or lens.focal_length)
                        local FminL     = (lens.FminL or lens.manual_aperture)
                        local FmaxL     = (lens.FmaxL or lens.manual_aperture)
                        return string.format("%s/1 %s/1 %s/1 %s/1", tostring(focal_min), tostring(focal_max), tostring(FminL), tostring(FmaxL))
                end)

Can't find this in exiftool's tag list. It may be this instead:

0xa432 LensInfo rational64u[4] ExifIFD (4 rational values giving focal and aperture ranges, called LensSpecification by the EXIF spec.)

Found other example in other forum which use "exifEx:"... Which one is to use?

Quote from: zLOST on January 21, 2019, 10:45:30 PM
The unfortunate fact is, that the min/max aperture values and lens_specs don't work the way i want them to. But technically those are not important at all for normal people..
What do you need exactly?

zLOST

Quote from: aprofiti on January 22, 2019, 08:00:34 PM
Happy to hear this!
Please report any strange behaviour if you plan to use it in the next days.

Well, i'm using my camera only for shooting - no high-level magic, so i'm afraid i'm of no use when it comes to testing..

Quote from: aprofiti on January 22, 2019, 08:00:34 PM
Nice idea! May be useful to make code a little bit shorter if we add the new tags. Will look into it :)
Would like to know if inserting the same information but with different namespace can make any editing software angry or not, as what I understood from your post, each software looks at different tags in the xmp.
Is possible to make a short recap on which tags each software use?
We could fill .xmp using different namespace (aux, exif, exifEx ) for the same information (name, aperture...) If there aren't any problems.
Can't find this in exiftool's tag list. It may be this instead:

0xa432 LensInfo rational64u[4] ExifIFD (4 rational values giving focal and aperture ranges, called LensSpecification by the EXIF spec.)

Found other example in other forum which use "exifEx:"... Which one is to use?

I'm using http://www.exiv2.org/tags.html and http://www.exiv2.org/tags-xmp-exifEX.html as a reference.. And i've only noticed the exifEx:LensModel in darktable forums, hence i do not know which other keys we could use for other editors.

Quote from: aprofiti on January 22, 2019, 08:00:34 PM
What do you need exactly?

My aim is/was to "fake" as much data as possible and if there is a way we could make the camera believe, that these values came from the lenses directly instead, so they get saved with another exif data in the image header, then go for it. That would make them instantly available for all image editors at once..

zLOST

At the moment i've got these:

-- predefined xmp properties
xmp.lens_make           = { name = {"exif:LensMake","exifEx:LensMake"},                         format = "%s" }         -- Exif.Photo.LensMake  Ascii  This tag records the lens manufactor as an ASCII string.
xmp.lens_name           = { name = {"exif:LensModel","exifEx:LensModel"},                       format = "%s" }         -- Exif.Photo.LensModel  Ascii  This tag records the lens's model name and model number as an ASCII string
xmp.lens                = { name = {"aux:Lens","exif:Lens"},                                    format = "%s" }
xmp.lens_serial         = { name = {"exif:LensSerialNumber","exifEx:LensSerialNumber"},         format = "%s" }         -- Exif.Photo.LensSerialNumber  Ascii  This tag records the serial number of the interchangeable lens that was used in photography as an ASCII string.
xmp.focal_length        = { name = "exif:FocalLength",                                          format = "%d/1" }       -- Exif.Image.FocalLength  Rational  The actual focal length of the lens, in mm.
xmp.FNumber             = { name = "exif:FNumber",                                              format = "%d/10" }      -- Exif.Image.FNumber  Rational  The F number.
xmp.apertureValue       = { name = "exif:ApertureValue",                                        format = "%d/10" }      -- Exif.Photo.ApertureValue  Rational  The lens aperture. The unit is the APEX value.
xmp.MinApertureValue    = { name = "exif:MinApertureValue",                                     format = "%s/10" }      -- Exif.Photo.MinApertureValue  Rational  The highest F number of the lens. The unit is the APEX value. Ordinarily it is given in the range of 00.00 to 99.99, but it is not limited to this range.
xmp.MaxApertureValue    = { name = "exif:MaxApertureValue",                                     format = "%s/10" }      -- Exif.Photo.MaxApertureValue  Rational  The smallest F number of the lens. The unit is the APEX value. Ordinarily it is given in the range of 00.00 to 99.99, but it is not limited to this range.
xmp.lens_specification  = { name = {"exif:LensInfo","exif:LensSpecification","exifEx:LensSpecification"},       format = "%s" }         -- Exif.Photo.LensSpecification  Rational  This tag notes minimum focal length, maximum focal length, minimum F number in the minimum focal length, and minimum F number in the maximum focal length, which are specification information for the lens that was used in photography. When the minimum F number is unknown, the notation is 0/0


And they are initialized with this:

function add_properties() -- {{{
        xmp:add_property(xmp.lens_make,                 function() return (lens.make or "-- unknown --") end)
        xmp:add_property(xmp.lens_name,                 function() return lens.name end)
        xmp:add_property(xmp.lens,                      function()
                        if lens.make ~= nil then
                                return lens.make.." "..lens.name
                        else
                                return lens.name
                        end
                end)
        xmp:add_property(xmp.focal_length,              function() return (lens.focal_length) end)
        xmp:add_property(xmp.apertureValue,             function() return (apex(lens.manual_aperture)*10) end)
        xmp:add_property(xmp.FNumber,                   function() return (lens.manual_aperture*10) end)
        xmp:add_property(xmp.MaxApertureValue,          function()
                        local max_aperture      = (lens.max_aperture or lens.manual_aperture)
                        if lens.f_values ~= nil then
                                local Fns       = lens.f_values
                                max_aperture    = Fns[1]
                        end
                        return (apex(max_aperture)*10)
                end)
        xmp:add_property(xmp.MinApertureValue,          function()
                        local min_aperture      = (lens.min_aperture or lens.manual_aperture)
                        if lens.f_values ~= nil then
                                local Fns       = lens.f_values
                                min_aperture    = Fns[#Fns]
                        end
                        return (apex(min_aperture)*10)
                end)
        xmp:add_property(xmp.lens_serial,               function() return lens.serialN end)
        xmp:add_property(xmp.lens_specification,        function()
                        local focal_min = (lens.focal_min or lens.focal_length)
                        local focal_max = (lens.focal_max or lens.focal_length)
                        local FminL     = (lens.FminL or lens.manual_aperture)
                        local FmaxL     = (lens.FmaxL or lens.manual_aperture)
                        return string.format("%s/1 %s/1 %s/1 %s/1", tostring(focal_min), tostring(focal_max), tostring(FminL), tostring(FmaxL))
                end)
end -- }}}
               
add_properties()


If we could generate more data in order to make the camera FW happy, i'll gladly do it :)

And as a bit of a motivation, here goes my beloved 50mm Trioplan...

aprofiti

Quote from: zLOST on January 24, 2019, 02:56:54 PM
My aim is/was to "fake" as much data as possible and if there is a way we could make the camera believe, that these values came from the lenses directly instead, so they get saved with another exif data in the image header, then go for it. That would make them instantly available for all image editors at once..
According to this old post, writing to Canon data structure is considered dangerous .

Maybe @a1ex discovered some other possible methods to inject exif data to .cr2?
I imagine MPU is most responsible for this and it usually doesn't "collaborate"; so not much expectation from this at the moment.

By the way, I would like to have aperture overridden in Photo menu... it would be useful to remember and check what value selected from the script.

Quote from: zLOST on January 19, 2019, 01:41:46 PM
I've just found what was wrong when setting params for my Samyang - lens.serial is expected to be integer, but this lens has string.
Regarding managing serial number as string... I made some tests and got a half working version:

/* lua/lua_lens.c */

#include <bmp.h>
#include <inttypes.h>

// Retrive value
static int luaCB_lens_index(lua_State * L)
{

...

    /// Get the serial number of the lens
    // @tfield string serial
    //else if(!strcmp(key, "serial")) lua_pushstring(L, lens_info.lens_serial);
    else if(!strcmp(key, "serial"))
    {
      char buf[20];

      //  snprintf(buf, 17, "%#" PRIx64, (uint64_t)lens_info.lens_serial);
      snprintf(buf, 17, "%llu", lens_info.lens_serial);
      //  snprintf(buf, 17, "%#" PRIu64 , lens_info.lens_serial);

      bmp_printf( FONT(FONT_LARGE,COLOR_RED,COLOR_BG), 30, 250,"lens.serial 2: %llu",lens_info.lens_serial);
      bmp_printf( FONT(FONT_LARGE,COLOR_RED,COLOR_BG), 30, 300,"buff: %s",buf);

      lua_pushstring(L, buf);
    }

....

// Assign new value
static int luaCB_lens_newindex(lua_State * L)
{
  else if(!strcmp(key, "serial"))
    {
        //LUA_PARAM_INT(value, 3);
        //lens_info.lens_serial = value;

        LUA_PARAM_STRING(value, 3);
        lens_info.lens_serial = strtoul(value, NULL, 0);

        bmp_printf( FONT(FONT_LARGE,COLOR_RED,COLOR_BG), 30, 100,"value: %s",value);
        bmp_printf( FONT(FONT_LARGE,COLOR_RED,COLOR_BG), 30, 150,"lens.serial 1: %d", lens_info.lens_serial );
    }

This save correctly the number as unsigned long integer in ML lens_info data structs (can be seen in Lens Info debut menu), but then when I try to get it as a string from the lua script, it give me nothing usefull... like a empty string with the format specifier as prefix.


    { make = "Samyang", name = "85mm f/1.4 AS IF UMC", focal_length = 85, manual_aperture = 1.4}
      --  serial = "A217D0264" }

Also in your case it is a alphanumerics value and add support to this isn't straightforward... I can change "strtoul" arguments to parse number in hexadecimal base (0-9 , A-F) and try to adapt script, but would not cove all possible case... as example old canon lenses use all of the letter from alphabet and other manufactures may do the same.

Given that, it may not be worth to manage serial in lua as a string; it's converted from number to string when saving .xmp, but actually it works only for decimal numbers.

@a1ex @dmilligan Any suggestion on what to do?

a1ex

If the question is about how to modify EXIF data in a CR2, then it all happens on the main CPU. Where exactly... I'm afraid I don't know.

It doesn't work in QEMU yet, but that's "just" a matter of implementing the LJ92/JPG encoders and other image processing paths used while creating the CR2. Once that works, you will be able to experiment with modified EXIF info.

Some of the metadata comes, indeed, from the MPU, but I'm pretty sure that can be faked somehow.

zLOST

I don't want to mess with images, but prefer to give the lens details to the camera itself and let it do its job (if possible, of course), which should be the safe way, i suppose. Theoreticaly the point is to emulate chipped lenses with lua in a way, that there is no difference in those for the original camera firmware.

The other way is to write a script, which will use exiv2/exiftool to process existing xmp files and store/update corresponding exif keys of matching files.

But a si wrote before - having the camera do this automatically is preferable way for a lazy ass like me :)

Quote from: aprofiti on January 25, 2019, 06:57:17 PM
By the way, I would like to have aperture overridden in Photo menu... it would be useful to remember and check what value selected from the script.
You mean this one?




Prob is, that each adapter may behave in a different way depending on presence and version of the chip. And we'd have to override this behavior by giving the camera a list of available apertures to choose from. Which may technically be the same as setting the lens name and focal length.

For the serial number - i had no idea it can get this complicated :) And in this area i'm of sub-zero use as i don't have experience with C..

aprofiti

Quote from: a1ex on January 25, 2019, 07:10:15 PM
If the question is about how to modify EXIF data in a CR2, then it all happens on the main CPU. Where exactly... I'm afraid I don't know.

It doesn't work in QEMU yet, but that's "just" a matter of implementing the LJ92/JPG encoders and other image processing paths used while creating the CR2. Once that works, you will be able to experiment with modified EXIF info..
Good to know! Thank you a1ex, maybe one day we will be able to experiment with it :)

Quote from: zLOST on January 25, 2019, 10:46:59 PM
You mean this one?




Prob is, that each adapter may behave in a different way depending on presence and version of the chip. And we'd have to override this behavior by giving the camera a list of available apertures to choose from. Which may technically be the same as setting the lens name and focal length.
Yes, exactly. It' the same problem as with lens data, overridding from cpu memory/code will possibly do the trick.

A temporary solution would be to use flexinfo to print the aperture value on top of Canon's text. Not very clean but doable if needed....

zLOST

Hi, it's me again ;)

I've played with lens.lua + xmp.lua a bit and added one more submenu option to select desired output format of the XMP file. My aim was to generate exiv2 command line, which would set all the desired exif data for me.

So, when the lens is selected:

===============================================================================
ML/SCRIPTS/LENS.LUA - 2019-02-02 23:24:34
===============================================================================

ML/SCRIPTS/LENS.LUA: 2019-02-02 23:24:40 - Update_lens: name: 50-2 50mm f/3.5
ML/SCRIPTS/LENS.LUA: 2019-02-02 23:24:40 - Update_lens: serialN: 7149595
ML/SCRIPTS/LENS.LUA: 2019-02-02 23:24:40 - Update_lens: manual_aperture: 3.5
ML/SCRIPTS/LENS.LUA: 2019-02-02 23:24:40 - Update_lens: make: Industar
ML/SCRIPTS/LENS.LUA: 2019-02-02 23:24:40 - Update_lens: focal_length: 50


Then you can use this dropdown to choose the format. For exiv2 the "exiv2 ....magic... IMAGE.CR2" is appended to img_folder/MANUAL.SH, so you'd run only one script and all matching pics will be updated at once..



And the result looks like this (i've just added a bit of logging to xmp.lua, so what is written to xmp file, get's also logged..):

===============================================================================
ML/SCRIPTS/LIB/xmp.lua - 2019-02-02 23:24:34
===============================================================================

ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:00 - Writing the xmp file...
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:00 - Path:B:/DCIM/101CANON/IMG_6864.XMP
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:02 - Writing XMP file B:/DCIM/101CANON/IMG_6864.XMP in 'default' format for IMG_6864.CR2
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:02 - <?xml version="1.0" encoding="UTF-8"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="MagicLantern">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
   xmlns:exif="http://ns.adobe.com/exif/1.0/"
   xmlns:exifEX="http://cipa.jp/exif/1.0/"
   xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
   exif:ExifVersion="0231"
   exif:MaxApertureValue="970/10"
   aux:Lens="Industar 50-2 50mm f/3.5"
   exif:FocalLength="50/1"
   exifEx:LensModel="50-2 50mm f/3.5"
   exifEx:LensSpecification="10/10 655350/10 14/10 14/10"
   exif:LensModel="50-2 50mm f/3.5"
   exif:LensMake="Industar"
   exif:FNumber="14/10"
   exif:ApertureValue="970/10"
   exif:LensSpecification="10/10 655350/10 14/10 14/10"
   exif:LensInfo="10/10 655350/10 14/10 14/10"
   exifEx:LensMake="Industar"
   exif:LensSerialNumber="7149595"
   exif:Lens="Industar 50-2 50mm f/3.5"
   exifEx:LensSerialNumber="7149595">
  </rdf:Description>
</rdf:RDF>
</x:xmpmeta>
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:02 - XMP file written.
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:20 - Writing the xmp file...
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:20 - Path:B:/DCIM/101CANON/IMG_6865.XMP
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:23 - Writing XMP file B:/DCIM/101CANON/IMG_6865.XMP in 'darktable' format for IMG_6865.CR2
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:23 - <?xml version="1.0" encoding="UTF-8"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="MagicLantern">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
   xmlns:exif="http://ns.adobe.com/exif/1.0/"
   xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
   xmlns:exifEX="http://cipa.jp/exif/1.0/"
   exif:ExifVersion="0231">
   <exif:MaxApertureValue>970/10</exif:MaxApertureValue>
   <aux:Lens>Industar 50-2 50mm f/3.5</aux:Lens>
   <exif:FocalLength>50/1</exif:FocalLength>
   <exifEx:LensModel>50-2 50mm f/3.5</exifEx:LensModel>
   <exifEx:LensSpecification>10/10 655350/10 14/10 14/10</exifEx:LensSpecification>
   <exif:LensModel>50-2 50mm f/3.5</exif:LensModel>
   <exif:LensMake>Industar</exif:LensMake>
   <exif:FNumber>14/10</exif:FNumber>
   <exif:ApertureValue>970/10</exif:ApertureValue>
   <exif:LensSpecification>10/10 655350/10 14/10 14/10</exif:LensSpecification>
   <exif:LensInfo>10/10 655350/10 14/10 14/10</exif:LensInfo>
   <exifEx:LensMake>Industar</exifEx:LensMake>
   <exif:LensSerialNumber>7149595</exif:LensSerialNumber>
   <exif:Lens>Industar 50-2 50mm f/3.5</exif:Lens>
   <exifEx:LensSerialNumber>7149595</exifEx:LensSerialNumber> 
  </rdf:Description>
</rdf:RDF>
</x:xmpmeta>
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:25:23 - XMP file written.
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:27:40 - Writing the xmp file...
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:27:44 - Writing XMP file B:/DCIM/101CANON/manual.sh in 'exiv2' format for IMG_6866.CR2
ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:27:44 - exiv2 -M "set Exif.Photo.MaxApertureValue 970/10" -M "set Xmp.aux.Lens Industar 50-2 50mm f/3.5" -M "set Exif.Photo.FocalLength 50/1" -M "set Exif.Photo.LensModel 50-2 50mm f/3.5" -M "set Exif.Photo.LensSpecification 10/10 655350/10 14/10 14/10" -M "set Exif.Photo.LensModel 50-2 50mm f/3.5" -M "set Exif.Photo.LensMake Industar" -M "set Exif.Photo.FNumber 14/10" -M "set Exif.Photo.ApertureValue 970/10" -M "set Exif.Photo.LensSpecification 10/10 655350/10 14/10 14/10" -M "set Exif.Image.LensInfo 10/10 655350/10 14/10 14/10" -M "set Exif.Photo.LensMake Industar" -M "set Exif.Photo.LensSerialNumber 7149595" -M "set Xmp.aux.Lens Industar 50-2 50mm f/3.5" -M "set Exif.Photo.LensSerialNumber 7149595" IMG_6866.CR2


ML/SCRIPTS/LIB/xmp.lua: 2019-02-02 23:27:44 - XMP file written.


I've noticed couple things:

  • When i've added new submenu item, the automated showing of "select your lens" menu was constantly failing with something like "wrong parameter". Saving of the configuration was also failing with "MENU NIL". Once i've deleted the Settings/LENS.LCF, it's all working fine.
  • Some lens parameters don't seem to be "stable". When checking the XMP files, sometimes the FNumber was saved as specified by the lens configuration, sometimes it was saved as F1.4, which is reported by the adapter. The same happens with focal length - see the LensSpecification tag, which in my case should read "500/10 500/10 35/10 35/10". I've even seen the FNumber changed in series of three pics taken in a row :( .

So at the moment i'm able to "fix" Exif.Image and Exif.Photo keys, but it seems, that i could also alter the Exif.Canon* stuff, so in the end the CR2/JPEG could contain completely valid set of metadata even for manual lenses ;)

zLOST

Looks like i'm finally there ;)

Exif data can be batch-updated with the exiv2 format of what used to be the XMP file:

cat MANUAL.SH
exiv2 -k -M"set Exif.CanonCs.LensType 65535" -M "set Exif.CanonCs.MinAperture 285" -M "set Exif.Photo.ApertureValue 322363/65536" -M "set Exif.CanonCs.Lens 180 180 1" -M "set Exif.Photo.LensSpecification 180/1 180/1 56/10 56/10" -M "set Exif.Photo.MaxApertureValue 322363/65536" -M "set Exif.Photo.LensSerialNumber 1728275" -M "set Exif.CanonSi.TargetAperture 157" -M "set Exif.Canon.LensModel Telemegor 180mm f/5.5" -M "set Exif.Photo.LensModel Telemegor 180mm f/5.5" -M "set Exif.Photo.FocalLength 180/1" -M "set Exif.CanonSi.ApertureValue 157" -M "set Exif.CanonCs.MaxAperture 157" -M "set Exif.Photo.FNumber 55/10" -M "set Xmp.aux.Lens Meyer-Optik Gorlitz Telemegor 180mm f/5.5" -M "set Exif.Image.LensInfo 180/1 180/1 56/10 56/10" -M "set Exif.Photo.LensMake Meyer-Optik Gorlitz" IMG_6899.CR2

exiv2 -k -M"set Exif.CanonCs.LensType 65535" -M "set Exif.CanonCs.MinAperture 285" -M "set Exif.Photo.ApertureValue 63626/65536" -M "set Exif.CanonCs.Lens 85 85 1" -M "set Exif.Photo.LensSpecification 85/1 85/1 14/10 14/10" -M "set Exif.Photo.MaxApertureValue 63626/65536" -M "set Exif.Photo.LensSerialNumber A217D0264" -M "set Exif.CanonSi.TargetAperture 31" -M "set Exif.Canon.LensModel 85mm f/1.4 AS IF UMC" -M "set Exif.Photo.LensModel 85mm f/1.4 AS IF UMC" -M "set Exif.Photo.FocalLength 50/1" -M "set Exif.CanonSi.ApertureValue 31" -M "set Exif.CanonCs.MaxAperture 31" -M "set Exif.Photo.FNumber 14/10" -M "set Xmp.aux.Lens Samyang 85mm f/1.4 AS IF UMC" -M "set Exif.Image.LensInfo 85/1 85/1 14/10 14/10" -M "set Exif.Photo.LensMake Samyang" IMG_6900.CR2

exiv2 -k -M"set Exif.CanonCs.LensType 65535" -M "set Exif.CanonCs.MinAperture 256" -M "set Exif.Photo.ApertureValue 131072/65536" -M "set Exif.CanonCs.Lens 58 58 1" -M "set Exif.Photo.LensSpecification 58/1 58/1 20/10 20/10" -M "set Exif.Photo.MaxApertureValue 131072/65536" -M "set Exif.Photo.LensSerialNumber 7765411" -M "set Exif.CanonSi.TargetAperture 64" -M "set Exif.Canon.LensModel 44-2 58mm f/2" -M "set Exif.Photo.LensModel 44-2 58mm f/2" -M "set Exif.Photo.FocalLength 58/1" -M "set Exif.CanonSi.ApertureValue 64" -M "set Exif.CanonCs.MaxAperture 64" -M "set Exif.Photo.FNumber 20/10" -M "set Xmp.aux.Lens Helios 44-2 58mm f/2" -M "set Exif.Image.LensInfo 58/1 58/1 20/10 20/10" -M "set Exif.Photo.LensMake Helios" IMG_6901.CR2


The result looks fine to me (and should be fully accepted by PS, Gimp, DarkTable or whichever jpg/raw editor (i hope))


exiv2 -g Lens -g Aperture -Pknyt IMG_6899.CR2 IMG_6900.CR2 IMG_6901.CR2
IMG_6899.CR2          Exif.Photo.ApertureValue                     ApertureValue               Rational   F5.5
IMG_6899.CR2          Exif.Photo.MaxApertureValue                  MaxApertureValue            Rational   F5.5
IMG_6899.CR2          Exif.CanonCs.LensType                        LensType                    Short      (65535)
IMG_6899.CR2          Exif.CanonCs.Lens                            Lens                        Short      180.0 mm
IMG_6899.CR2          Exif.CanonCs.MaxAperture                     MaxAperture                 Short      F5.5
IMG_6899.CR2          Exif.CanonCs.MinAperture                     MinAperture                 Short      F22
IMG_6899.CR2          Exif.CanonCs.DisplayAperture                 DisplayAperture             Short      0
IMG_6899.CR2          Exif.CanonSi.TargetAperture                  TargetAperture              Short      F5.5
IMG_6899.CR2          Exif.CanonSi.ApertureValue                   ApertureValue               Short      F5.5
IMG_6899.CR2          Exif.Canon.LensModel                         LensModel                   Ascii      Telemegor 180mm f/5.5
IMG_6899.CR2          Exif.Photo.LensSpecification                 LensSpecification           Rational   180/1 180/1 56/10 56/10
IMG_6899.CR2          Exif.Photo.LensMake                          LensMake                    Ascii      Meyer-Optik Gorlitz
IMG_6899.CR2          Exif.Photo.LensModel                         LensModel                   Ascii      Telemegor 180mm f/5.5
IMG_6899.CR2          Exif.Photo.LensSerialNumber                  LensSerialNumber            Ascii      1728275
IMG_6899.CR2          Exif.Image.LensInfo                          LensInfo                    Rational   180/1 180/1 56/10 56/10
IMG_6899.CR2          Xmp.aux.Lens                                 Lens                        XmpText    Meyer-Optik Gorlitz Telemegor 180mm f/5.5



IMG_6900.CR2          Exif.Photo.ApertureValue                     ApertureValue               Rational   F1.4
IMG_6900.CR2          Exif.Photo.MaxApertureValue                  MaxApertureValue            Rational   F1.4
IMG_6900.CR2          Exif.CanonCs.LensType                        LensType                    Short      (65535)
IMG_6900.CR2          Exif.CanonCs.Lens                            Lens                        Short      85.0 mm
IMG_6900.CR2          Exif.CanonCs.MaxAperture                     MaxAperture                 Short      F1.4
IMG_6900.CR2          Exif.CanonCs.MinAperture                     MinAperture                 Short      F22
IMG_6900.CR2          Exif.CanonCs.DisplayAperture                 DisplayAperture             Short      0
IMG_6900.CR2          Exif.CanonSi.TargetAperture                  TargetAperture              Short      F1.4
IMG_6900.CR2          Exif.CanonSi.ApertureValue                   ApertureValue               Short      F1.4
IMG_6900.CR2          Exif.Canon.LensModel                         LensModel                   Ascii      85mm f/1.4 AS IF UMC
IMG_6900.CR2          Exif.Photo.LensSpecification                 LensSpecification           Rational   85/1 85/1 14/10 14/10
IMG_6900.CR2          Exif.Photo.LensMake                          LensMake                    Ascii      Samyang
IMG_6900.CR2          Exif.Photo.LensModel                         LensModel                   Ascii      85mm f/1.4 AS IF UMC
IMG_6900.CR2          Exif.Photo.LensSerialNumber                  LensSerialNumber            Ascii      A217D0264
IMG_6900.CR2          Exif.Image.LensInfo                          LensInfo                    Rational   85/1 85/1 14/10 14/10
IMG_6900.CR2          Xmp.aux.Lens                                 Lens                        XmpText    Samyang 85mm f/1.4 AS IF UMC



IMG_6901.CR2          Exif.Photo.ApertureValue                     ApertureValue               Rational   F2
IMG_6901.CR2          Exif.Photo.MaxApertureValue                  MaxApertureValue            Rational   F2
IMG_6901.CR2          Exif.CanonCs.LensType                        LensType                    Short      (65535)
IMG_6901.CR2          Exif.CanonCs.Lens                            Lens                        Short      58.0 mm
IMG_6901.CR2          Exif.CanonCs.MaxAperture                     MaxAperture                 Short      F2
IMG_6901.CR2          Exif.CanonCs.MinAperture                     MinAperture                 Short      F16
IMG_6901.CR2          Exif.CanonCs.DisplayAperture                 DisplayAperture             Short      0
IMG_6901.CR2          Exif.CanonSi.TargetAperture                  TargetAperture              Short      F2
IMG_6901.CR2          Exif.CanonSi.ApertureValue                   ApertureValue               Short      F2
IMG_6901.CR2          Exif.Canon.LensModel                         LensModel                   Ascii      44-2 58mm f/2
IMG_6901.CR2          Exif.Photo.LensSpecification                 LensSpecification           Rational   58/1 58/1 20/10 20/10
IMG_6901.CR2          Exif.Photo.LensMake                          LensMake                    Ascii      Helios
IMG_6901.CR2          Exif.Photo.LensModel                         LensModel                   Ascii      44-2 58mm f/2
IMG_6901.CR2          Exif.Photo.LensSerialNumber                  LensSerialNumber            Ascii      7765411
IMG_6901.CR2          Exif.Image.LensInfo                          LensInfo                    Rational   58/1 58/1 20/10 20/10
IMG_6901.CR2          Xmp.aux.Lens                                 Lens                        XmpText    Helios 44-2 58mm f/2





If you'd want to test how the updated CR2 behaves in your favorite editor, you can grab the last one at https://www.zlej.net/IMG_6901.CR2

dfort

Excellent!

exiftool
...
Lens Info                       : 58mm f/2
Lens Make                       : Helios
Lens Model                      : 44-2 58mm f/2
Lens Serial Number              : 7765411
...


Adobe Camera Raw shows that it is a 58mm f/2 lens but there is no lens profile for that Helios lens.

Could you upload one with the Samyang 85mm? The xml is working with ACR on that lens so it would be great to see if it works the same as your embedded EXIF.

Are you pushing your code to a repository? It would be great to be able to try it out.

zLOST

Quote from: dfort on February 05, 2019, 06:02:46 PM
Excellent!

exiftool
...
Lens Info                       : 58mm f/2
Lens Make                       : Helios
Lens Model                      : 44-2 58mm f/2
Lens Serial Number              : 7765411
...


Adobe Camera Raw shows that it is a 58mm f/2 lens but there is no lens profile for that Helios lens.

Could you upload one with the Samyang 85mm? The xml is working with ACR on that lens so it would be great to see if it works the same as your embedded EXIF.

Are you pushing your code to a repository? It would be great to be able to try it out.

I haven't pushed anything yet as there are still few features i'd like to implement and test ;)

CR2 with samyang data is at https://www.zlej.net/IMG_6900.CR2

exiv2 seems to have some windows builds, so the batch script i'm creating might be used on Windows as well, but if you'd know of any other way to batch-update a set of images with defined metadata, let me know and i can add another template..

Lars Steenhoff

Can you try with lensdata that arc has a profile for?

for example:

this should be autodetected with a profile

name = "Zeiss Distagon T* 2.8/25 ZF.2",        focal_length =  25, manual_aperture = 2.8 },

zLOST

Quote from: Lars Steenhoff on February 05, 2019, 08:33:21 PM
Can you try with lensdata that arc has a profile for?

for example:

this should be autodetected with a profile

name = "Zeiss Distagon T* 2.8/25 ZF.2",        focal_length =  25, manual_aperture = 2.8 },

The raw with fixed exif is at https://www.zlej.net/IMG_6910.CR2
But the problem is, that the profile for Distagon does not exactly follow the schema used by normal "chipped" lenses, where stCamera:Lens is exactly what's being returned  by the lens:

<rdf:Description
       stCamera:Author="Adobe (www.adobe.com)"
       stCamera:Make="Canon"
       stCamera:CameraRawProfile="True"
       stCamera:LensID="174"
       stCamera:Lens="150-500mm"
       stCamera:LensInfo="150/1 500/1 0/0 0/0"
       stCamera:CameraPrettyName="Canon"
       stCamera:LensPrettyName="SIGMA APO 150-500mm F5-6.3 DG OS HSM"
       stCamera:ProfileName="Adobe (SIGMA APO 150-500mm F5-6.3 DG OS HSM, Canon)"
       stCamera:SensorFormatFactor="1"
       stCamera:FocalLength="150"
       stCamera:FocusDistance="999999995904"
       stCamera:ApertureValue="6.643856">


    <rdf:li rdf:parseType="Resource">
      <stCamera:Author>Adobe Systems, Inc.</stCamera:Author>
      <stCamera:Make>Canon</stCamera:Make>
      <stCamera:Model>Canon EOS-1Ds Mark III</stCamera:Model>
      <stCamera:UniqueCameraModel>Canon EOS-1Ds Mark III</stCamera:UniqueCameraModel>
      <stCamera:CameraRawProfile>True</stCamera:CameraRawProfile>
      <stCamera:LensID>237</stCamera:LensID>
      <stCamera:Lens>EF24-105mm f/4L IS USM</stCamera:Lens>
      <stCamera:LensInfo>24/1 105/1 0/0 0/0</stCamera:LensInfo>
      <stCamera:CameraPrettyName>Canon EOS-1Ds Mark III</stCamera:CameraPrettyName>
      <stCamera:LensPrettyName>Canon EF 24-105mm f/4 L IS USM</stCamera:LensPrettyName>
      <stCamera:ProfileName>Adobe (Canon EF 24-105mm f/4 L IS USM)</stCamera:ProfileName>


While the profile for Distagon has also the brand included in stCamera:Lens:

     <rdf:Description
       stCamera:Author="Adobe (www.adobe.com)"
       stCamera:Make="Canon"
       stCamera:CameraRawProfile="True"
       stCamera:LensID="33"
       stCamera:Lens="Zeiss Distagon T* 2/25 ZE"
       stCamera:LensInfo="25/1 25/1 0/0 0/0"
       stCamera:CameraPrettyName="Canon"
       stCamera:LensPrettyName="Zeiss Distagon T* 2/25 ZE"
       stCamera:ProfileName="Adobe (Zeiss Distagon T* 2/25 ZE)"


Let's hope that it will match with the Xmp.aux.Lens field:

IMG_6910.CR2          Exif.CanonCs.DisplayAperture                 DisplayAperture             Short      0
IMG_6910.CR2          Exif.CanonCs.Lens                            Lens                        Short      25.0 mm
IMG_6910.CR2          Exif.CanonCs.LensType                        LensType                    Short      (65535)
IMG_6910.CR2          Exif.CanonCs.MaxAperture                     MaxAperture                 Short      F2.8
IMG_6910.CR2          Exif.CanonCs.MinAperture                     MinAperture                 Short      F23
IMG_6910.CR2          Exif.Canon.LensModel                         LensModel                   Ascii      Distagon T* 2.8/25 ZF.2
IMG_6910.CR2          Exif.CanonSi.ApertureValue                   ApertureValue               Short      F2.8
IMG_6910.CR2          Exif.CanonSi.TargetAperture                  TargetAperture              Short      F2.8
IMG_6910.CR2          Exif.Image.LensInfo                          LensInfo                    Rational   25/1 25/1 28/10 28/10
IMG_6910.CR2          Exif.Photo.ApertureValue                     ApertureValue               Rational   F2.8
IMG_6910.CR2          Exif.Photo.LensMake                          LensMake                    Ascii      Zeiss
IMG_6910.CR2          Exif.Photo.LensModel                         LensModel                   Ascii      Distagon T* 2.8/25 ZF.2
IMG_6910.CR2          Exif.Photo.LensSerialNumber                  LensSerialNumber            Ascii     
IMG_6910.CR2          Exif.Photo.LensSpecification                 LensSpecification           Rational   25/1 25/1 28/10 28/10
IMG_6910.CR2          Exif.Photo.MaxApertureValue                  MaxApertureValue            Rational   F2.8
IMG_6910.CR2          Xmp.aux.Lens                                 Lens                        XmpText    Zeiss Distagon T* 2.8/25 ZF.2

Lars Steenhoff

Good news, with the IMG_6910.CR2 it loads the profile automatically !

It found the right lens and made the corrections for it. screenshots for proof :)


dfort

The Samyang lens didn't do as well in ACR.



The profile should be included.



I can pick it manually but that defeats what we're trying to do here:



Downloaded from the experiments page, activated the Samyang 85mm and did a test shot to see if the xml works:

ML ASSERT:
0
at ../../src/mem.c:799 (__mem_malloc), task PropMgr
lv:0 mode:3

PropMgr stack: 14cdc0 [14cf68-14bf68]
0xUNKNOWN  @ 9c188:14ce70
0x00B25EAC @ b215ec:14ce50
0x00B256E8 @ b25ee4:14ce40
0x00081F80 @ b25708:14ce30
0x0007F688 @ 81fbc:14cdf0
0x0007EF78 @ 7f6e4:14cdc0

Magic Lantern version : Nightly.2019Feb05.700D115
Mercurial changeset   : 0de7b671c52c (manual_lens_info)
Built on 2019-02-06 04:44:22 UTC by [email protected].
Free Memory  : 148K + 2732K


Not my day--and I'm leaving tomorrow for a week so no time to play around with this right now.

[EDIT] ok--tried one more thing. Used aprofiti's crop_rec_4k_mlv_snd_elns branch and got what looks like a good xml but it still doesn't work automatically in ACR.

<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:exif="http://ns.adobe.com/exif/1.0/"
    xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
    exif:ExifVersion="0230"
    exif:FocalLength="85/1"
    exif:FNumber="14/10"
    aux:SerialNumber="0"
    aux:Lens="Samyang 85mm f/1.4 AS IF UMC">
  </rdf:Description>
</rdf:RDF>
</x:xmpmeta>

zLOST

The crashes of experimental manual_lens branch were caused by one of recent commits, so for my testing i've used build from Alessandro - https://bitbucket.org/aprofiti/magic-lantern/downloads/

My versions of lens.lua (+ xmp.lua, logger.lua and ui.lua) are not available anywhere except my notebook and camera.

Apparently the Sam 85/1.4 should be supported by ACR, but the question is, what they expect to be in exif data. Would it be possible to get some archive with lens profiles from ACR? I got one from Lightroom, but Samyang is missing there :(

My version of lens.lua works in a way, that you:

  • select "exiv2" output format (instead of XMP sidecar for each pic it will append a line with exiv2 commandline to file named MANUAL.SH in the picture folder on SD/CF card)
  • run "bash MANUAL.SH" (on linux-like systems, of course. with windows it'll be probably a bit different), which will update exif data of all pics
  • open the raw/jpeg in your favorite editor
  • profit

The point is to find the right lens parameters for the editor to correctly detect the lens and match it with lens profile it supports..

So far i have these in my list (and with this make+name the distagon worked correctly as you've seen:

lenses = -- {{{
{
--  The following is for testing purposes. Comment out the following lines then either uncomment only the lenses
--  that you want to use from the list or add your own lenses. Tip: Put your most used lenses at the top of the list.
--  Attributes to use:
--  name                -> Name to be showed in Lens Info and in metadata
--  focal_length        -> Current focal length to be saved in metadata (Zoom Lenses: Default value to be used after selecting lens)
--  manual_aperture     -> Selected Aperture of the Lens
--  aperture_min        -> Min available aperture for a lens (limits the available FNumbers to the min-max range)
--  aperture_max        -> Max available aperture for a lens
--  focal_min           -> min Focal Length (optional for prime lenses)
--  focal_max           -> max Focal Length (optional for prime lenses)
--  serial              -> Lens Serial Number (optional)
--  f_values            -> Available f-stop for selected lens (optional) f_values = {"2.8","4","5.6","8"}
--  FminL               -> Max aperture on short end
--  FmaxL               -> Max aperture on long end
        { make = "Carl Zeiss Jena DDR", name = "Tessar 50mm f/2.8",             focal_length = 50,      manual_aperture = 2.8,  serialN = "8333263",    aperture_max = 2.8, aperture_min = 22 },
        { make = "E. Ludwig",           name = "Meritar 50mm f/2.9",            focal_length = 50,      manual_aperture = 2.9,  serialN = "1610554",    aperture_max = 2.9, aperture_min = 16 },
        { make = "Helios",              name = "44-2 58mm f/2",                 focal_length = 58,      manual_aperture = 2,    serialN = "7765411",    aperture_max = 2, aperture_min = 16, f_values = {"2","2.8","4","5.6","8","11","16"} },
        { make = "Industar",            name = "50-2 50mm f/3.5",               focal_length = 50,      manual_aperture = 3.5,  serialN = "7149595",    aperture_max = 3.5, aperture_min = 16 },
        { make = "Industar",            name = "61 L/Z (MC) 50mm f/2.8",        focal_length = 50,      manual_aperture = 2.8,  serialN = "8707286",    aperture_max = 2.8, aperture_min = 16 },
        { make = "Meyer-Optik Gorlitz", name = "Telemegor 180mm f/5.5",         focal_length = 180,     manual_aperture = 5.5,  serialN = "1728275",    aperture_max = 5.5, aperture_min = 22 },
        { make = "Meyer-Optik Gorlitz", name = "Trioplan 50mm f/2.9",           focal_length = 50,      manual_aperture = 2.9,  serialN = "2224344",    aperture_max = 2.9, aperture_min = 22, f_values = {"2.9","4","5.6","8","11","16","22"} },
        { make = "Pentacon",            name = "auto 29mm f/2.8",               focal_length = 29,      manual_aperture = 2.8,  serialN = "6308110",    aperture_max = 2.8, aperture_min = 22 },
        { make = "Pentacon",            name = "Prakticar 50mm f/1.8 MC",       focal_length = 50,      manual_aperture = 1.8,  serialN = "7710425",    aperture_max = 1.8, aperture_min = 16 },
        { make = "Samyang",             name = "85mm f/1.4 AS IF UMC",          focal_length = 85,      manual_aperture = 1.4,  serialN = "A217D0264",  aperture_max = 1.4, aperture_min = 22 },
        { make = "Zeiss",               name = "Distagon T* 2.8/25 ZF.2",       focal_length = 25,      manual_aperture = 2.8, aperture_max = 2.8, aperture_min = 22 },
--    { make = "", name = "", focal_length = , manual_aperture = , serial = "" },
} -- }}}


There is still a problem with chipped adapters, which (from camera's point of view) behave as regular lens - with focal_min = 1, focal_max = 65536, F_numbers = { "1.4" }. Which means, that our attempts to set the focal length and aperture are stubbornly ignored by the camera when the metadata are written. With dumb non-chipped adapters it's all fine and the camera accepts values we fake with lua script.

Lars Steenhoff

Here is a list of lenses with built in profile support:

https://helpx.adobe.com/camera-raw/kb/supported-lenses.html

And I found this name on the list

Samyang 85mm f/1.4 AS IF UMC

zLOST

Quote from: Lars Steenhoff on February 06, 2019, 11:45:25 AM
Here is a list of lenses with built in profile support:

https://helpx.adobe.com/camera-raw/kb/supported-lenses.html

And I found this name on the list

Samyang 85mm f/1.4 AS IF UMC

That's what i've found as well, but apparently the exif values we have in the CR2 don't fully match. What would help are lens profile definition files directly from ACR, so i could rip them off a bit ;)

dfort

Hey Walter, your posts were flagged as "Hall of Shame" but you do have a good point:

Quote from: Walter Schulz on February 06, 2019, 12:09:24 PM
"Samyang 14 mm f/2.8 ED AS IF UMC?

Quote from: Walter Schulz on February 06, 2019, 12:22:07 PM
I'm a little late for the party and haven't browsed through all replies.
Maybe I missed the point:
Why messing up with lens info for a lens with electronic coupling? AFAIK this particular lens is reporting its ID.

Turns out these lenses are available with or without a chip.



We were discussing the 85mm but the same applies to the 14mm and other Samyang/Rokinon manual lenses. I've got the cine version of these lenses but the photo version lens profiles should work fine on them.

You highlighted ED but that means ED: contains extra-low dispersion element(s) and has nothing to do with whether it is chipped. The chipped and unchipped lenses use the same name and thus the same lens profile as far as I can tell.

zLOST

@dfort - technically you can turn any lens/adapter into chipped one by sticking an EMF chip onto it (see https://www.ebay.com/itm/EMF-AF-Confirm-Chip-for-M42-PK-Nikon-CY-LR-OM-Canon-EOS-EF-Adapter-programmable/132534235628)

Problem is, that when there is a chip, which tells the camera anything about focal length and aperture, the camera will use these values instead of what we'll specify with the script. Or at least it seems to work like this from what i've seen so far.
What we'd need is to override certain parameters (camera.aperture.max, camera.aperture.min and something related to min/max focal length). Having customized camera.aperture.max/min would also give us a possibility to set camera.aperture.value and i assume, that the firmware would then use these values when writing the exif data to jpeg/cr2..

@walter - the point of all this is to add a certain metadata to images taken with old/non-chipped lenses, so the image editors can apply some lens-correction filters. and some people (me included) may find it useful for catalogizing pictures by used lenses.


find ./ -type f -name '*.CR2' -exec exiv2 -g Exif.Photo.LensModel -Pt {} 2>/dev/null \; |sort|uniq -c |sed -e "s/^ *//" -e "s/ /x /"
101x
5x 10-20mm
92x 150-500mm
37x 1-65535mm
758x EF17-40mm f/4L USM
293x EF24-105mm f/4L IS USM
18x EF50mm f/1.8 STM
61x EF50mm f/2.5 Compact Macro
12x EF70-300mm f/4-5.6 IS USM
496x EF-S10-18mm f/4.5-5.6 IS STM
102x Meyer-Optik Görlitz Trioplan 50mm f/2.9
238x MP-E65mm f/2.8 1-5x Macro Photo
26x Samyang 85mm f/1.4 Aspherical IF

zLOST

Actually, having the correct exif data embedded in the image makes generating of lens-correction profiles a lot easier ;)
https://wilson.bronger.org/lens_calibration_tutorial/

So far i've only played with vignetting data, but preparing pics for chromatic aberration and distortion is a piece of cake..


<lensdatabase>

    <lens>
        <maker>Carl Zeiss Jena</maker>
        <model>Tessar 50mm f/2.8</model>
        <mount>M42</mount>
        <cropfactor>1</cropfactor>
        <calibration>
            <vignetting model="pa" focal="50" aperture="2.8" distance="10" k1="-1.1957" k2="0.8042" k3="-0.2577"/>
            <vignetting model="pa" focal="50" aperture="2.8" distance="1000" k1="-1.1957" k2="0.8042" k3="-0.2577"/>
        </calibration>
    </lens>

    <lens>
        <maker>E. Ludwig</maker>
        <model>Meritar 50mm f/2.9</model>
        <mount>EXA</mount>
        <cropfactor>1</cropfactor>
    </lens>

    <lens>
        <maker>Helios</maker>
        <model>44-2 58mm f/2</model>
        <mount>M42</mount>
        <cropfactor>1</cropfactor>
        <calibration>
            <vignetting model="pa" focal="58" aperture="1.4" distance="10" k1="-0.2865" k2="-0.3428" k3="0.1544"/>
            <vignetting model="pa" focal="58" aperture="1.4" distance="1000" k1="-0.2865" k2="-0.3428" k3="0.1544"/>
        </calibration>
    </lens>


Small issue is, that hellios had a chipped adapter, so the camera used the provided aperture of F1.4..

aprofiti

Quote from: zLOST on February 08, 2019, 01:21:41 PM
Small issue is, that hellios had a chipped adapter, so the camera used the provided aperture of F1.4..
Are you referring to the embedded exif data of the image or the generated .xmp sidecar?

I'm sorry, regarding embedded exif we still need to figure out how to inject in the image processing pipeline as a1ex said..

If you are referring to the .xmp didn't noticed this issue with my local build, it should take the data in the ML lens_info struct

Quote from: zLOST on February 06, 2019, 09:58:37 AM
The crashes of experimental manual_lens branch were caused by one of recent commits, so for my testing i've used build from Alessandro - https://bitbucket.org/aprofiti/magic-lantern/downloads/
Currently I'm working on:
- Refactor config lib to make code more readable (recursiveCopy is a completely mess... not proud of It...)
- add more attribute to lenses looking from zLOST ..xmp
- add support for multiple name for the same attribute to .xmp lib (ex. Lens name using aux: exif: and exifEX:)

Still thinking about the possibility to have user's lenses in a separate config than embedded in the script.
This will be useful in case of an update, as user doesn't need to insert lenses each time

Attribute added locally:
-Fmin,Fmax (from zLOST)
-lens specification (from zLOST)

Would like to calculate aperture min and max from FNumber automatically instead of adding 2 more attribute to lenses.
Will look into it.

@zLOST can you show your .xmp.lua?
I'm having problems in adding support for multiple name for the same attribute. It doesn't print some of the other ones

Also can't figure out why lua isn't saving my data with the modified recusiveCopy I'm working on.. they are table, so passing is by reference...

Also noticed a strange behaviour with Lightroom, it looks like doesn't read the .xmp when opening the image... so no correction applied.

Does this also appen to you guys?

I will update my remote repo and the PR after solving those problems

zLOST

Hello Alessandro,

my version of {lens|xmp|ui|logger}.lua is at https://www.zlej.net/manual_lens.tar.gz (you'll just need to delete settings/LENS.LCF, otherwise it will keep on crashing when loading/saving the configuration due to added "Format" select to the lens configuration menu),
There are changes all over the place, so it may be better to discuss this by email, skype, icq or irc.
I may have screwed something up, but dumb adapters/lenses work fine - the focal length+aperture values are saved correctly, but with chipped adapter (one, which tells the camera some focal length/aperture values, these are used instead of the ones chosen by me.

With my "exiv2" template the output is not a XMP sidecarfile for each photo, but one bash script (with one line being added for each pic), which i'll run once i'm done with shooting and it updates the exif data of the existing CR2/JPG files, so no messing with metadata during saving the picture. So this should be safe way to get the data there ;)

An example of such line is:

exiv2 -k -M"set Exif.CanonCs.LensType 65535" -M "set Exif.CanonCs.MinAperture 288" -M "set Xmp.aux.Lens Meyer-Optik Gorl
itz Telemegor 180mm f/5.5" -M "set Exif.CanonCs.Lens 180 180 1" -M "set Exif.Photo.LensSpecification 180/1 180/1 56/10 5
6/10" -M "set Exif.Photo.MaxApertureValue 325770/65536" -M "set Exif.Photo.FNumber 55/10" -M "set Exif.Photo.FocalLength
180/1" -M "set Exif.Photo.LensMake Meyer-Optik Gorlitz" -M "set Exif.CanonSi.TargetAperture 157" -M "set Exif.CanonSi.A
pertureValue 157" -M "set Exif.CanonCs.MaxAperture 159" -M "set Exif.Photo.ApertureValue 322363/65536" -M "set Exif.Cano
n.LensModel Telemegor 180mm f/5.5" -M "set Exif.Photo.LensModel Telemegor 180mm f/5.5" -M "set Exif.Photo.LensSerialNumb
er 1728275" -M "set Exif.Image.LensInfo 180/1 180/1 56/10 56/10" IMG_6929.CR2

zLOST

Quote from: aprofiti on February 08, 2019, 03:18:16 PM
- add more attribute to lenses looking from zLOST ..xmp
- add support for multiple name for the same attribute to .xmp lib (ex. Lens name using aux: exif: and exifEX:)
Technically if we could insert the correct exif data with exiv2, we won't have to rely on editors to accept&parse the xmp sidecar at all as the picture would look like shot with modern lens ;)

Quote from: aprofiti on February 08, 2019, 03:18:16 PM
Still thinking about the possibility to have user's lenses in a separate config than embedded in the script.
This will be useful in case of an update, as user doesn't need to insert lenses each time
What about an external DB of lenses and user will only say, which are of some interest for him/her? ;)

Quote from: aprofiti on February 08, 2019, 03:18:16 PM
Attribute added locally:
-Fmin,Fmax (from zLOST)
-lens specification (from zLOST)

Would like to calculate aperture min and max from FNumber automatically instead of adding 2 more attribute to lenses.
Will look into it.
I've added a function set_lens_defaults(), which generates certain attributes. Including the Fmax Fmin from f_values (if available)...

Quote from: aprofiti on February 08, 2019, 03:18:16 PM
@zLOST can you show your .xmp.lua?
I'm having problems in adding support for multiple name for the same attribute. It doesn't print some of the other ones
Link to archive with everything i've mutilated is in the post above...

Quote from: aprofiti on February 08, 2019, 03:18:16 PM
Also can't figure out why lua isn't saving my data with the modified recusiveCopy I'm working on.. they are table, so passing is by reference...

Also noticed a strange behaviour with Lightroom, it looks like doesn't read the .xmp when opening the image... so no correction applied.

Does this also appen to you guys?

I will update my remote repo and the PR after solving those problems

Sorry, i'm darktable+gimp@debian only ;)