Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - zLOST

#1
Camera-specific Development / Re: Canon EOS R / RP
February 24, 2022, 12:46:50 PM
Quote from: Walter Schulz on February 24, 2022, 11:03:37 AM
LUA? Don't hold your breath.

well, the fact is, that i've been using ML for nothing but this script on 6D + 650D and it's a pitty, that i can't do the same on R. but i haven't contributed to ML at all, nor do i have any skills to do that, so all i can do now is just silently wait ;)
#2
Camera-specific Development / Re: Canon EOS R / RP
February 24, 2022, 10:29:09 AM
Hi,
and what about stripped-down ML with only LUA scripting and https://www.magiclantern.fm/forum/index.php?topic=18083 ? ;)
That'd make my day/week/month/everything

cheers
#3
Looks like i was able to make it all work with the latest 650D build from ml.fm (magiclantern-manual_lens_info.2018Dec23.650D104.zip).

All you gotta do is to install this build, grab http://ml.zlej.net/lua.zip and unpack its contents to ML/Scripts/ folder, overwritting everything what's conflicting (i've touched logger.lua, xmp.lua in libs, there is new lib/lens.lua, which holds the info about your lenses).

I've moved the array with lenses to a separate file (lenses.lua) in "Scripts/libs/" and made a lensfun-based generator at http://ml.zlej.net/lenses/.

I've just noticed one thing - although the script creates the exiv2/darktable files correctly, in my case it refers to IMG_xxxx.CR2, but the image on the card is called _MG_xxxx.CR2, which is weird and i have no idea why is it happening and how i could have the correct filename in the output.

This goes to XMP.LOG:
2022-01-17 17:02:59 - Writing XMP file B:/DCIM/104CANON/IMG_9476.XMP in darktable format for IMG_9476.CR2
2022-01-17 17:04:05 - Writing XMP file B:/DCIM/104CANON/IMG_9477.XMP in darktable format for IMG_9477.CR2


Whenever new lens is chosen, such line ends up in LENS.LOG:
2022-01-17 17:02:48 - Selected lens: Meyer-Optik Gorlitz Trioplan 1:2.9/50 V
2022-01-17 17:03:40 - Selected lens: Revuenon Auto Revuenon 1:1.2 f=55mm (Tomioka)

#4
btw: there is some memory-related assertion fckup, but otherwise the pic is taken, script seems to be run and xmp file (with the original) or custom formatted xml/exiv2 script is generated. So the assertion error is just a minor annoyance after taking a pic :)

i'm currently polishing and tweaking my version of the script and updating http://ml.zlej.net accordingly
#5
Hi,

So, i was able to replicate the assertion error by using unmodified latest build from https://builds.magiclantern.fm/jenkins/job/manual_lens_info/23/artifact/platform/6D.116/magiclantern-manual_lens_info.2018Dec23.6D116.zip

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

PropMgr stack: 170dc0 [170f68-16ff68]
0xUNKNOWN  @ 468a88:170e70
0x00BFD69C @ bf8ddc:170e50
0x00BFCED8 @ bfd6d4:170e40
0x0044F5E0 @ bfcef8:170e30
0x0044C9F4 @ 44f61c:170df0
0x0044C478 @ 44ca50:170dc0

Magic Lantern version : manual_lens_info.2018Dec23.6D116
Mercurial changeset   : 0de7b671c52c (manual_lens_info) tip
Built on 2018-12-23 22:39:23 UTC by jenkins@nightly.
Free Memory  : 383K + 1930K


Problem is, that you can't use the "Latest Lua updates + fixes" build, because the lua.mo in this one does not export info about the lens, which we need and the latest manual_lens_info available at ml.fm seems to be broken.

@aprofiti may be able to cast some light on this as my working 6D build seems to be even newer than builds from ml.fm :)
Magic Lantern Nightly.2019Jan21.6D116
Camera   : 6D
Firmware : 116
Changeset: b1818aa3ae43+ (manual_lens_info) tip
Built on : 2019-01-21 13:20:45 by [email protected]


It would be great if we could rebranch the manual_lens_info from latest lua_fix or push the lens-info part to the lua_fix branch, so we can focus on lua scripts..

cheers.

zLOST
#6
Well, i've only been playing with these lua scripts and i assume, that these assertion fckups come from the underlying part of ML, which is completely out of my league :(

zLOST
#7
Quote from: InACanoe on September 05, 2021, 08:57:25 PM
Hello,

I recently tried to get this working on my EOS Rebel T4i (650D) and ran into some strange problems that caused core dumps relating to malloc.

To absolve any doubt, I tried this on a fresh ML install from the 'Non-CPU lens info' build, (download page is Link1, link to 650D build is Link2).
I'm not using a chipped lens.
The menu for zLOST's lens2.lua script actually pops up. The error only happens when you try to take a photo. Then the script, I guess, crashes and the camera logs that ASSERT.LOG error file.

I tried this two ways, once using the stock lens.lua script that came with the nightly build, and another time using the lens2.lua script that zLOST wrote and publishes at Link3.
Link1: https://builds.magiclantern.fm/experiments.html
Link2: https://builds.magiclantern.fm/jenkins/job/manual_lens_info/23/artifact/platform/650D.104/magiclantern-manual_lens_info.2018Dec23.650D104.zip
Link3: http://ml.zlej.net/

Hello,

I'm sorry, but i've missed your post (and since i've switched to EOS R in February 2020, i can't even enjoy ML on my camera :( ).
But i'll borrow my old 650D from my son and give it a shot. The fact is, that i've only been using the lens2.lua with my 6D, but if i remember correctly, some failed assertions bit my ass as well..

cheers,

zLOST
#8
no idea, to be honest. after couple failed attempts to find one with chip, which actually worked with my digic and/or how to program that damned thing, i've abandoned these "smarter" adapters and am using only the "dumb" ones.
i assume, that the chip would have to be much much smarter to fully fake the modern lens behavior.

Quote from: Milk and Coffee on June 22, 2020, 07:40:30 PM
Can this module be used to program EMF/Focus Confirm chips on adapted manual lenses?
#9
Lensfun expects the lens model to be "Samyang 14mm f/2.8 AE ED AS IF UMC", so this line should do the trick:

{ make = "Samyang", name = "14mm f/2.8 AE ED AS IF UMC",  focal_length = 14, manual_aperture = 2.8,  serialN = "123456",  aperture_max = 2.8, aperture_min = 22, f_values = {"2.8","4","5.6","8","11","16","22"} },


Quote from: IBIRRU on April 28, 2020, 01:39:23 PM
Yes PS2020 and Rawtherapee show the correct value. I need to try with Samyang 14 mm if they detect the right lens profile.

I'll update soon about this
#10
And photoshop or whichever editor/viewer you use is showing the right exif values now?

I'm really glad to hear that.

Quote from: IBIRRU on April 27, 2020, 02:09:23 PM
zLOST, thanks again.
Just replaced manual.sh to manual.bat.

Shots some pictures and verified.

Double click on manual.bat and it run flawlessly. No needs to open the Command prompt window.
:)
#11
You're welcome.
You can easily change the filename in lib/xmp.lua at line 54:

        exiv2           = {
                filepath        = function() return dryos.shooting_card.dcim_dir.path .. "manual.sh" end,


Just replace manual.sh with manual.bat to save you a bit of work.. I haven't tried it with windows, so you are probably my first tester :)

Quote from: IBIRRU on April 23, 2020, 11:54:12 AM
zLOST Thanks for your update! :)
I try with a EOS 700D and as stated in a previous post the experimental build do not works.
I download the Aprofiti build and after add your last lua.zip it works!

I prefer the exiv2 mode that build the manual.sh script

I download also the exiv2 binary for windows and after unzip and add to the PATH i'm able to run it directly from Win10 command prompt (I open the manual.sh in Notepad++ and save as manual.bat)
#12
Damned, it's been over a year already..

In the meantime i did couple changes in my code, fixed some stuff, implemented other and changed one exif field.

I've also replaced the dummy sample images at http://ml.zlej.net with real ones i took few weeks ago to compare all my manual lenses. All those jpegs with apricot tree have exif data updated by my script, so feel free to grab them and test in your favorite editor. So far the only lenses with lensfun profiles in my case are zenitar 16/2.8, samyang 85/1.4 and industar-50-2 50/3.5..

What i've found out is, that darktable is using Exif.CanonCs.LensType to search for the correction profile. I've been setting it to 65536 == "not available", which made DT to ignore all Lens* fields. So in current version of the script i'm completely dropping this field and voila - detection works :)

cheers,

zLOST

Quote from: aprofiti on March 30, 2019, 12:32:32 AM
Thank you for the sample image, I'll take a look at metadata as soon as possibile.

Was working on a refactor of your addition for format selection last couple of days.
I'm trying to find a way to don't mess code too much and avoid the current limitation to allow user to use custom tags also for exiv2,
Can you try with the scripts version from the pending PR?
I also think each software is guessing using some heuristics from focal length, lens ID an maybe others... camparing with an internal database to choose from.

Maybe just override metadatas in Exif and Canon Makernotes, may be sufficient. Avoiding inserting redundant info like Photo.LensMake (which will also avoid necessity to handle and save other field in script)
#13
Quote from: Lars Steenhoff on March 29, 2019, 11:44:01 PM
Nice overview!  thanks for sharing

With pleasure, Lars ;)
#14
Quote from: aprofiti on February 23, 2019, 07:23:49 PM
From what i have understood by reading your posts, is that each editor may look for different attribute when selecting profile (Lens, Lens Make, Lens Model....)
Update the image's attributes by modifying exif like zLost did with exiv2 is something to keep in mind.

LensFun library, which is used by DarkTable, Gimp and RawTherapee, is trying to do some "intelligent" guessing and matching of exif data with existing lens profiles. They may use the LensType ID as well https://sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html#LensType because what for example my Sigma 150-500 is reporting as LensModel (just "150-500mm") is pretty much useless. I haven't checked lensfun sources, but they seem to be combining LensMake (when available) with LensModel and some variations of LensModel ("EF 70-200" versus "EF70-200" and so on).
#15
Sorry for being a bit quiet. In the meantime i've played with the script, moved the format submenu to the one with general script settings (autoload_menu) and made up this page, where i've summarized current state:

http://ml.zlej.net/

There is a LensName issue with Samyang 85/1.4, but otherwise we should be pretty much set ;)
#16
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 ;)
#17
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
#18
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..
#19
@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
#20
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 ;)
#21
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.
#22
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
#23
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..
#24
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
#25
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 ;)