Author Topic: Assign lens focal length and name for non cpu lenses  (Read 69111 times)

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #175 on: January 12, 2017, 02:10:15 AM »
I tweaked also "stCamera:ProfileName" to "...BS" instead of "CS"
;D

If you use the img tags your screenshot will appear on the forum:
Code: [Select]
[img]https://www.flickr.com/photos/147593195@N03/shares/8815Cp[/img]Though this doesn't seem to work unless you make your file public.

Strange thing you got going on with the 8mm fisheye showing up as a 50mm. It is working fine over here. I'm on a Mac using Adobe Camera Raw 9.8 and Lightroom 2015.8 (hum, all the other CC apps are on 2017). What are you running? Upload your XML and hacked lens profile somewhere and post a link so I can see if it happens on my system.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1856
Re: Assign lens focal length and name for non cpu lenses
« Reply #176 on: January 16, 2017, 06:32:22 PM »
@dmilligan David, if you catch this: a question regarding a previous reply you made http://www.magiclantern.fm/forum/index.php?topic=18083.msg177889#msg177889

Where do I find more about the constants such as GUISTATE_QR, that you use in the .xmp module.

I can see guistate in the api reference, but not qr.

I'm trying to better understand/exploit Lua.

Cheers

Garry

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #177 on: January 16, 2017, 06:39:09 PM »
@garry23 - @dmilligan is on tapatalk so if you use the @ sign before his user name like I just did tapatalk will send him an alert. Quoting his post will also send an alert.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1856
Re: Assign lens focal length and name for non cpu lenses
« Reply #178 on: January 16, 2017, 06:44:09 PM »
Dan thanks, I truly didn't know that  :o

Maybe I should get on taptalk

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Assign lens focal length and name for non cpu lenses
« Reply #179 on: January 16, 2017, 08:32:52 PM »

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1856
Re: Assign lens focal length and name for non cpu lenses
« Reply #180 on: January 16, 2017, 08:45:16 PM »
@dmilligan

Thank you.

Is this a general principal, that you can tap into other property state constants, assuming they exist and you know where to look?

JohanJ

  • Freshman
  • **
  • Posts: 88
Re: Assign lens focal length and name for non cpu lenses
« Reply #181 on: January 29, 2017, 08:46:25 PM »
@dfort
Quote
Strange thing you got going on with the 8mm fisheye showing up as a 50mm.

Today I found the reason for it: the 60D writes 50mm into EXIF:FocalLength embedded in the CR2 file

EXIF info from a sample picture using magiclantern-manual_lens_info.2017Jan26.60D111:
Code: [Select]
exiftool - FocalLength IMG_6397.CR2 ======== IMG_6397.CR2  Focal Length                    : 50.0 mm


I also tested the latest magiclantern-manual_lens_info.2017Jan26.100D101 using a 100D instead of the 60D.
Code: [Select]
exiftool - FocalLength IMG_3743.CR2 ======== IMG_3743.CR2  Focal Length                    : 0.0 mm

For the 100D everything just worked as expected: XMP file contained all necessary information of the manual lens, import to Lr (6.8 on Win10) had no problem at all, and my proper lens profile for this lens was found immediately. And even  FocalLength 8 mm was shown and used correctly in the processed xmp!

Now the remaining question is how to make Lr use FocalLength from the xmp file created by ML instead of existing (but dummy) information embedded in the CR2 file?
60D.111 / 100D.101 / M2.103

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #182 on: January 30, 2017, 06:27:35 AM »
Today I found the reason for it: the 60D writes 50mm into EXIF:FocalLength embedded in the CR2 file
...
Now the remaining question is how to make Lr use FocalLength from the xmp file created by ML instead of existing (but dummy) information embedded in the CR2 file?

Interesting finding. I would have thought that the xmp file would take precedence over the EXIF tags in the CR2 file. Just in case that modifying a CR2 with exiftool doesn't give the same results could you please upload a sample CR2 with the manual lens xmp from the 60D so we can take a look at it?
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

JohanJ

  • Freshman
  • **
  • Posts: 88
Re: Assign lens focal length and name for non cpu lenses
« Reply #183 on: February 04, 2017, 07:17:01 PM »
I would have thought that the xmp file would take precedence over the EXIF tags in the CR2 file. Just in case that modifying a CR2 with exiftool doesn't give the same results could you please upload a sample CR2 with the manual lens xmp from the 60D so we can take a look at it?

I can confirm that EXIF tag FocalLength = 50 set by 60D is the reason for the wrong focal length in Lr. Modifying a sample CR2 using exiftool -FocalLength=0 did the trick. Import to Lr showed the correct value from the xmp file.

Conclusions
 1. Lr chooses EXIF tags from CR2 files over xmp values if not initial (=0)
 2. There are different default values for different models. For 60D it is 50mm for 100D it is initial. I checked even som older pics taken with a 350D and there it was initial too.

Sample shots (w/ and w/o modified EXIF) for 60D and 100D, as well as a modified Lr lens profile for Samyang 8 mm can be found here (see File_info.txt for details):
https://drive.google.com/open?id=0B7N2Wbxd7m2gS293V1Z3a2hqYVk
60D.111 / 100D.101 / M2.103

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12321
  • Emergencies only
Re: Assign lens focal length and name for non cpu lenses
« Reply #184 on: March 05, 2017, 10:40:39 PM »


Just got this screen on 5D3.

Setup: thread-safety branch (which includes lua_fix), 5D3 1.2.3, mlv_lite loaded, movie mode. Starting from photo mode and then switching to movie is OK. As you noticed, backing out 56464bc solves it, but why?

The mystery goes on...

Edit: solved - the info bars layout was first done with FONT_MED_LARGE and then replaced with a centered version of the same font. The linked commit did not cause the bug - it simply prevented a layout refresh, so the bug became visible. Classical code duplication bug...

Lars Steenhoff

  • Senior
  • ****
  • Posts: 454
Re: Assign lens focal length and name for non cpu lenses
« Reply #185 on: April 06, 2017, 12:30:42 PM »
Thanks Alex for updating the experimental a lens info branch

JohanJ

  • Freshman
  • **
  • Posts: 88
Re: Assign lens focal length and name for non cpu lenses
« Reply #186 on: April 06, 2017, 03:57:52 PM »
100D is missing. Build seems to be broken since merging w lua_fix.

Sent from my SM-T719 using Tapatalk

60D.111 / 100D.101 / M2.103

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #187 on: April 06, 2017, 06:29:30 PM »
@JohanJ -- Where did you get a Non-CPU lens info build for the 100D? The reason it is missing from the Experiments download page is because the 100D hasn't been merged into unified yet. My understanding is that the 100D is next in line and when that happens we'll see it show up with the other experimental builds.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

JohanJ

  • Freshman
  • **
  • Posts: 88
Re: Assign lens focal length and name for non cpu lenses
« Reply #188 on: April 06, 2017, 09:58:33 PM »
A1ex had included 100D on the experiments page for branches lua_fix and manual_lens_info. The latter 25th of jan 2017. See my posts for the focal lens info problem on 60D xmp files (50mm fixed in Lr) compared to 100D (initial focal length and therefore working fine in Lr)

Sent from my SM-T719 using Tapatalk
60D.111 / 100D.101 / M2.103

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #189 on: April 07, 2017, 08:58:22 PM »
Right -- so the 60D puts 50mm in the EXIF lens field when a non-cpu lens (or no lens) is attached and LR uses that instead of the information in the xmp file, is that right? Sorry for the delay but I'm trying to catch up and just checked your files.

Don't know what to do about it because the whole point of writing the XMP file is to avoid having to figure out how to write EXIF data to the CR2 file.

I believe that a while back there was some code in ML that defaulted to 50mm, wonder if that is still the case and if that's causing the issue. I did a quick search of the code and found an instance of 50mm in raw2dng.c which shouldn't be related to this issue.

A few things to look into:
  • Does it also default to 50mm without ML loaded?
  • If so, is it possible to test with firmware version 1.1.2 on the 60D and checked to see if it is still happening?
  • Are other cameras also affected?
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #190 on: April 09, 2017, 12:50:37 AM »
Here is a screenshot to illustrate the 60D issue:



Focal length is 8mm in the xmp and 50mm in the CR2 EXIF. If it is 0mm in the CR2 EXIF then LR takes the focal length from the xmp file.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3348
  • 5D3 | M1 | 7D | 70D | SL1 | M2 | 50D
Re: Assign lens focal length and name for non cpu lenses
« Reply #191 on: April 09, 2017, 01:32:40 AM »
Maybe I'm a bit of a doofus but still haven't wrapped my head on how to use this with my manual lenses yet? Any recommendations on a start-up guide or some sort of a 'owners manual' upon experimenting these builds?

Been eyeing on this project of yours (that @Lars Steenhoff started for good reasons) for quite awhile... It needs some vintage love!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Assign lens focal length and name for non cpu lenses
« Reply #192 on: April 09, 2017, 01:58:50 AM »
Load the lua.mo module, restart, run the lens script (probably want to put it on auto run). Attach manual lens.

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #193 on: April 09, 2017, 07:36:41 PM »
Right -- though the lens.lua script that is packaged with the experimental build is only good for a very basic test:

Code: [Select]
lenses =
{
    { name = "My Lens", focal_length = 50 },
    { name = "My Other Lens", focal_length = 25 },
}

I published a script that includes several popular Zeiss and Samyang manual lenses back in Reply #134.

This project was started in order to do automatic lens corrections in Lightroom. Right now the only lenses that are working properly without having to hack into the lens profiles are the Zeiss ZF.2 primes. Well, almost. One of the Zeiss lenses has a name that exceeds the number of characters allocated by ML for the lens name.

I've been meaning to get back to this project once we figure out how to deal with that lens name issue. It requires some work on the ML back ends and also a change to the MLV specifications. There are other issues if you want true automatic lens correction. One of the corrections that Lightroom can do is to eliminate lens vignetting. However, the vignetting varies depending on the lens aperture used. Obviously it isn't all that practical to have to go into the menu to manually change the lens setting every time you adjust the f/stop.

There is another issue saving xmp files for every single frame if you shoot outside of LiveView or if you shoot bursts of CR2. In addition, @JohanJ discovered that the 60D (and possibly other camera) will default to 50mm in the EXIF focal length and Lightroom uses this information instead of what the script is writing to the xmp file.

If you are shooting silent DNG frames, forget it. This script doesn't write to the EXIF or create an xmp for DNG files.

So yeah, there's more to do here but if you're just looking for a way to keep track of which manual lens you used when shooting MLV, it works pretty good.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

histor

  • New to the forum
  • *
  • Posts: 49
Re: Assign lens focal length and name for non cpu lenses
« Reply #194 on: April 24, 2017, 12:26:08 PM »
It sounds quite on the contrary to the existing solution but…

We know how programmable EMF chips work – they just return several predefined values (f-number, FL, focus prompt compensation). Instead, let's imagine one could hack this values directly in-camera. We'll get immediately working focus confirmation (+ focus correction) and enough EXIF data to identify the lens (you can add the proper lens names with Exiftool later).

As for the AF-MF switch - it’s nothing but a software switch. It’s easily overridden (with API commands, for example). Newer EMF chips simulate AF mode now.

Lars Steenhoff

  • Senior
  • ****
  • Posts: 454
Re: Assign lens focal length and name for non cpu lenses
« Reply #195 on: August 24, 2017, 03:28:16 PM »
@dfort are you able to make a build that has some of the newer features enabled?

10/12/14 bit compressed
3x crop 1080p
Lens info
MLV sound

I'm looking to use the Zeiss lenses with it.

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3739
Re: Assign lens focal length and name for non cpu lenses
« Reply #196 on: August 24, 2017, 08:23:59 PM »
I see that you got part of your question answered, MLV sound isn't working with 10/12/14 bit compressed. At least not yet.

Have you tried the Lens info lua script with the latest crop_rec_4k? I'm at work right now so I can't try it but it looks like the lua fixes needed for that script might have already been merged into that branch.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

Lars Steenhoff

  • Senior
  • ****
  • Posts: 454
Re: Assign lens focal length and name for non cpu lenses
« Reply #197 on: August 24, 2017, 11:29:46 PM »
I'm working on it,  I managed to set up builds for my Mac with Sierra

Now I'm trying to make a build with crop rec that has sound + the Lua fixes.



Lars Steenhoff

  • Senior
  • ****
  • Posts: 454
Re: Assign lens focal length and name for non cpu lenses
« Reply #198 on: August 25, 2017, 12:00:13 AM »
I dont know how to solve the merge conflicts, so I will have to wait.

I tried to import the lua_fix branch into the crop_rec branch.