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.

dfort

That looks right. The lua_fix branch was already merged into the crop_rec_4k branch so all you needed to do was to merge manual_lens_info into crop_rec_4k--there were no merge conflicts when I tried it. If you want to keep things in order I'd recommend first making a branch of crop_rec_4k (I named my branch crop_rec_4k_manual_lens_info). You can pull it from my bitbucket repository and build it yourself or for a limited time only I'm making it available on my bitbucket download page for the 5D3.113/123.

On my builds I also added the Zeiss ZF.2 and Samyang (Rokinon/Bower/etc.) manual lenses that are in the Adobe Camera Raw database. You'll have to edit ML/scripts/lens.lua to comment out the test lines and uncomment the lines for your lenses.

I've been messing around all over the place in ML and not really concentrating on one project--like the manual lens info script. I think where we left off there was a problem with a length limit on the lens name in the MLV header. All of the Zeiss lenses were working except the 100mm Macro because the lens name is one character too long. To get that lens working required hacking the name in the ACR lens profile. For the Samyang lenses it takes some more work to get it working with ACR. If your goal is just to get the lens metadata into your MLV files, that part is working fine as long as you keep the lens name to less than 32 characters.

I did some more research into lens profiles and to do it right you should take into consideration the aperture used for each shot in order to properly compensate for vignetting and distortion. Of course in most situations it would be rather impractical to reset your camera every time you adjust the aperture.

In any case, please report your findings to that pull request you pointed out. Feedback is important in order to get new features merged into the main code base.

Lars Steenhoff

Thanks for the branch with the Lens info.

for me it fine without the 100 Zeiss for now as I don't have that one.
The main use for me is to have a name that is descriptive and the focal length,   so I can apply distortion correction for the manual lenses.

The one I tried to merge with the lens info was the crop_rec branch.
https://bitbucket.org/hudson/magic-lantern/branch/crop_rec

that one has sound but its a bit older I know that.

For me sound + crop 3x + lens info are the most important.

Compression and higher resolutions are nice but not essential.


Danne

Create a branch of regular crop_crec and merge manual lens info to that not working?

Lars Steenhoff

@Danne,
I tried that and have 3 merge conflicts in these files

scr/debug.c
scr/module.c
src/module.h

I can try to see if I can use the files from crop_rec to resolve the merge conflicts.

Danne

I see. You can try and resolve them in atlassian(source tree). Not sure which way 'mine' or 'theirs' but some testing should reveal what's going on :)

Lars Steenhoff

I made a build with resolve using mine  (crop_rec)

and when I run it on the cam I get

duplicate menu error module  ( 32 )

I saw some fixes in the crop4k for duplicate menu errors, maybe I have to cherry pic some thing from there.




Danne


Lars Steenhoff

Thats what source tree uses as a name, ( resolve conflict using mine, is keep current file from crop_rec and ignore file from manual_lens_info )

Does it make sense what I mean?

Danne

I'm no expert but I usually succeed resolving either using mine or theirs. Pretty shallow advice but if nothing works you seem to be able to get yourself into the code :).

Your description above is nothing I know about. Did you create a branch that you're working from?

dfort

Quote from: Lars Steenhoff on August 25, 2017, 02:59:10 PM
For me sound + crop 3x + lens info are the most important.

g3gg0 has been working on a branch to get mlv_snd working with crop_rec_4k. Not sure if that is ready for testing yet.

Have you tried H.264 proxy? It is under the Advanced settings. That will get you audio along with a .mov file for on set playback. You'll have to work a bit to sync it in post but the workflow isn't all that bad.

I haven't tackled those merge conflicts yet but I'd suggest trying out the crop_rec_4k_manual_lens_info build before spending too much time on it.

Lars Steenhoff

Yes I tried the crop_rec_4k_manual_lens_info build on firmware 1.1.3 jus now and it works fine.  :)

The lens info is embedded and photoshop recognises the Zeiss profile and can apply the corrections.
The other benefit is organisational, I can search the footage by lens.

I did try to use the h264 but that was not stable. also there is the offset in sound that is not nice to deal with for each shot to match them up.

I also did the same merge you did, just I don't know why the mlv rec and mlv sound don't compile from this branch.

If you can help with the merge conflicts, I can make builds now, but resolving conflicts is bit sticky for me as I don't know much of what the code does.  8)

https://bitbucket.org/hudson/magic-lantern/branch/crop_rec_4k_mlv_snd
This branch does not compile the Lua module, so I'm out of luck there for now

Lars Steenhoff

The only thing that does not work is the auto run on startup of the Lua script
https://bitbucket.org/daniel_fort/magic-lantern/branch/crop_rec_4k_manual_lens_info

the script shows up but when touching a button live view turns black and the lens selection menu disappears.

It works fine on its own without the autorun

Lars Steenhoff

I have managed to merge manual_lens_info branch into a copy of the branch for crop_mlv, by resolving some conflicts by more or less guessing.

https://www.dropbox.com/s/88vc19s41o5ga0c/magiclantern_crop_rec_manual_lens_info.2017Aug25.5D3113.zip?dl=0

this build has
sound,
mlvrec,
crop 3x 1080,
and lens info.

the same problem is here that is does not autorun the Lua script on start, because the live view takes over

dfort

Are you sure it isn't running? There have been some changes to it so it pretty much runs only when needed. Try putting on a CPU lens then remove it. The manual lens selection menu should come up.

I spent some time messing around with crop_rec_4k_mlv_snd, even merged it with manual_lens_info but it isn't quite ready to release into the wild.

I got a build with all of the items from your wish list. For some reason the silent module keeps failing. I'm looking into it and will post something to my download page soon, maybe without the silent module since it isn't on your list.

https://bitbucket.org/daniel_fort/magic-lantern/branch/raw_video_10bit_12bit_manual_lens_info

[EDIT] Tried your build and it is working better than mine so you should go with it.

Lars Steenhoff

Cool, I will also make a build from your branch

My build has problems with mlv_play.
I get a stack overflow free=0 used=16384 error in red when trying to playback.

As for the lens without cpu, When I turn on the camera with the Lua script enabled it shows up for a moment, but I can't interact with it.
It works well when the camera is already on and I activate from the menu.

I'm looking forward to see the results of crop_rec_4k_mlv_snd. This seems the most future proof way to go. I'm not sure how far of it is before it can be used well.

dfort

Quote from: Lars Steenhoff on August 26, 2017, 12:48:20 AM
My build has problems with mlv_play.

You might have to compile raw_twk for mlv_play to work. That dependency has been eliminated in the crop_rec_4k branch.

Yeah, it is a wild ride when you're merging development branches. I'm also looking forward to mlv_snd working with 4k raw lossless compression. With most of this stuff I can only cheer on the developers.

Lars Steenhoff

I just made a new build from the latest crop_rec4k and merged manual_lens_info into it.
Also merged the aspect ration fix that allow mlv_rec to build.

When I try to autorun the script it gives the screen for a split second and then it is gone.


www.youtube.com/watch?v=TiT4QAGaOec


NunoCaldeira

hi guys. thanks for this. how do i add my manual lens to the list? any tips would be welcome.
Also had 3 crashes on my camera when using this. where should i upload the logs, if it matters. thanks in advance

Lars Steenhoff

Quote from: leavesfromthepresentpast on August 27, 2017, 03:03:12 PM
hi guys. thanks for this. how do i add my manual lens to the list? any tips would be welcome.
Also had 3 crashes on my camera when using this. where should i upload the logs, if it matters. thanks in advance

You open the script lens.lua in a text editor in the scripts folder of Magic Lantern, and add new lenses there from line 11.  the -- is to disable the ones you don't need.

lens.lua
-- Manual Lens Information
-- Supplies lens information for manual lenses
-- Whenever there is a non-chipped lens detected, we prompt the user to select the attached manual lens from a list

require("ui")
require("config")
require("xmp")

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

selector_instance = selector.create("Select Manual Lens", lenses, function(l) return l.name end, 600)

xmp:add_property(xmp.lens_name, function() return lens.name end)
xmp:add_property(xmp.focal_length, function() return lens.focal_length end)
xmp:add_property(xmp.aperture, function() return math.floor(camera.aperture.value * 10) end)

function property.LENS_NAME:handler(value)
    if lens.is_chipped == false then
        task.create(select_lens)
    else
        if selector_instance ~= nil then
            selector_instance.cancel = true
        end
        xmp:stop()
    end
end

function select_lens()
    if #lenses > 1 then
        local menu_already_open = menu.visible
        if not menu_already_open then
            menu.open()
            display.rect(0, 0, display.width, display.height, COLOR.BLACK, COLOR.BLACK)
        end
        if selector_instance:select() then
            update_lens()
        end
        if not menu_already_open then
            menu.close()
        end
    elseif #lenses == 1 then
        update_lens()
    end
end

function update_lens()
    for k,v in pairs(lenses[selector_instance.index]) do
        lens[k] = v
    end
    xmp:start()
end

lens_menu = menu.new
{
    parent = "Lens Info Prefs",
    name = "Manual Lens",
    help = "Info to use for attached non-chipped lens",
    icon_type = ICON_TYPE.ACTION,
    select = function()
        if lens.is_chipped == false then
            task.create(select_lens)
        end
    end,
    rinfo = function()
        return lens.name
    end,
    warning = function()
        if lens.is_chipped then
            return "Chipped lens is attached"
        end
    end
}

if lens.is_chipped == false then
    task.create(select_lens)
end

NunoCaldeira

thanks for your quick reply.
Are we sorting some sort of list of lenses for the future to act like a "db"? Guess it would be easier to delete than to add manually.
Anyway heres my listing regarding Lensbaby lenses:

{
        { name = "LB Sweet 35", focal_length = 35 },
{ name = "LB Sweet 50", focal_length = 50 },
{ name = "LB Twist 60", focal_length = 60 },
{ name = "LB Edge 50", focal_length = 50 },
{ name = "LB Edge 80", focal_length = 80 },
{ name = "LB Circular Fisheye", focal_length = 5.8 },
{ name = "LB Soft Focus Optic", focal_length = 50 },
{ name = "LB Double Glass Optic", focal_length = 50 },
{ name = "LB Single Glass Optic", focal_length = 50 },
{ name = "LB Plastic Optic", focal_length = 50 },
{ name = "LB Pinhole Optic", focal_length = 50 },
{ name = "LB Fisheye Optic", focal_length = 12 },
{ name = "LB Velvet 56", focal_length = 56 },
        { name = "LB Velvet 85", focal_length = 85 },
{ name = "LB Creative Aperture", focal_length = 50 },
}

Lars Steenhoff

It will be good to have a doc with all the names somewhere.
you can edit this one

https://docs.google.com/spreadsheets/d/1OE4pbVJ7xzUZQ-X4dqu_NRoYguyIiAuSpGslqcnXzpQ/edit?usp=sharing

I made this one, at some point will be added to the magic lantern bitbucket.




--  Zeiss ZF.2 manual lenses Nikon mount - these work with the lens profiles that ship with Adobe Camera Raw

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

--  Nikon lenses
--  { name = "Nikon Zoom Ais ED 50-300", focal_length = 300, manual_aperture = 4.5 },
--  { name = "Nikon AF NIKKOR 28mm f/1.4D", focal_length = 28, manual_aperture = 1.4 },


--  Samyang manual lenses - also branded as Rokinon and Bower. Cine versions use the same lens profile.
--  The lens profiles for Samyang manual lenses that ship with Adobe Camera raw must be modified in order
--  for automatic lens detection to work.
--  More information here: http://www.magiclantern.fm/forum/index.php?topic=18083.msg176261#msg176261

--  { name = "Samyang 8mm f/2.8 UMC Fisheye",        focal_length =   8, manual_aperture = 2.8 },
--  { name = "Samyang 8mm f/2.8 UMC Fisheye II",     focal_length =   8, manual_aperture = 2.8 }, --   8mm T3.1 Cine
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS",    focal_length =   8, manual_aperture = 3.5 },
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS II", focal_length =   8, manual_aperture = 3.5 }, --   8mm T3.8 Cine
--  { name = "Samyang 10mm f/2.8 ED AS NCS CS",      focal_length =  10, manual_aperture = 2.8 }, --  10mm T3.1 Cine
--  { name = "Samyang 12mm f/2 NCS CS",              focal_length =  12, manual_aperture = 2   }, --  12mm T2.2 Cine
--  { name = "Samyang 12mm f/2.8 ED AS NCS Fisheye", focal_length =  12, manual_aperture = 2.8 }, --  12mm T3.1 Cine
--  { name = "Samyang 14mm f/2.8 ED AS IF UMC",      focal_length =  14, manual_aperture = 2.8 }, --  14mm T3.1 Cine
--  { name = "Samyang 16mm f/2 ED AS UMC CS",        focal_length =  16, manual_aperture = 2   }, --  16mm T2.2 Cine
--  { name = "Samyang 21mm f/1.4 ED AS UMC CS",      focal_length =  21, manual_aperture = 1.4 }, --  21mm T1.5 Cine
--  { name = "Samyang 24mm f/1.4 ED AS IF UMC",      focal_length =  24, manual_aperture = 1.4 }, --  24mm T1.5 Cine
--  { name = "Samyang 35mm f/1.4 AS IF UMC",         focal_length =  35, manual_aperture = 1.4 }, --  35mm T1.5 Cine
--  { name = "Samyang 50mm f/1.2 AS UMC CS",         focal_length =  50, manual_aperture = 1.2 },
--  { name = "Samyang 50mm f/1.4 AS UMC",            focal_length =  50, manual_aperture = 1.4 }, --  50mm T1.5 Cine
--  { name = "Samyang 85mm f/1.4 AS IF UMC",         focal_length =  85, manual_aperture = 1.4 }, --  85mm T1.5 Cine
--  { name = "Samyang 100mm f/2.8 ED UMC MACRO",     focal_length = 100, manual_aperture = 2.8 }, -- 100mm T3.1 Cine
--  { name = "Samyang 135mm f/2 ED UMC",             focal_length = 135, manual_aperture = 2   }, -- 135mm T2.2 Cine
--  { name = "Samyang 300mm f/6.3 ED UMC CS",        focal_length = 300, manual_aperture = 6.3 },


--  Lensbaby lenses

--  { name = "LB Sweet 35", focal_length = 35 },
--  { name = "LB Sweet 50", focal_length = 50 },
--  { name = "LB Twist 60", focal_length = 60 },
--  { name = "LB Edge 50", focal_length = 50 },
--  { name = "LB Edge 80", focal_length = 80 },
--  { name = "LB Circular Fisheye", focal_length = 5.8 },
--  { name = "LB Soft Focus Optic", focal_length = 50 },
--  { name = "LB Double Glass Optic", focal_length = 50 },
--  { name = "LB Single Glass Optic", focal_length = 50 },
--  { name = "LB Plastic Optic", focal_length = 50 },
--  { name = "LB Pinhole Optic", focal_length = 50 },
--  { name = "LB Fisheye Optic", focal_length = 12 },
--  { name = "LB Velvet 56", focal_length = 56 },
--  { name = "LB Velvet 85", focal_length = 85 },
--  { name = "LB Creative Aperture", focal_length = 50 },

a1ex

I'd like to add these to the repository, but the Lensbaby entries are missing the manual_aperture field. Looking up each one of them would take ages from here (slow network), so I'm going to ask for a little help. Also, OK to replace LB with Lensbaby in all entries?

Are the names fixed so the lens profiles can be recognized in Adobe or some other software? If so, is there a place to verify these names, e.g. to make sure they don't contain typos?

BTW, the manual_aperture field appears unused; maybe it's meant to be max_aperture or widest_aperture, and used as a limit for manual aperture override?

NunoCaldeira

hi a1ex.

Regarding the Lensbaby:
- I will organize the aperture field. i already done it for most of the optics at my website http://www.lensbabylovers.info/2013/03/compatability-chart.html Just to confirm, you want each unique f value possible with each optic or just the min and max f? I have them all, can confirm, just let me know if you want the min-max or all the possible f values.
- Yes you can replace LB with Lensbaby (i was just lazy);
- The lens names dont have typos. You can verify lensbaby lens names here https://lensbaby.com/optic-compatibility/

Technically, lensbaby lenses (besides Circular Fisheye, Velvet 56 and Velvet 85) are called optics, because they can be used with one of these optic bodies (Composer, Composer Pro, Composer Pro II, Spark, Muse). But in my point of view, theres not really a point of having to list the lens body, when what matters is the optic.


Lars Steenhoff

The Manual aperure field states the maximum aperture opening, (wide open)

NunoCaldeira

cool.

heres the values:

--  Lensbaby lenses

--  { name = "Lensbaby Sweet 35", focal_length = 35, manual_aperture =  2.5 },
--  { name = "Lensbaby Sweet 50", focal_length = 50, manual_aperture =  2.5 },
--  { name = "Lensbaby Twist 60", focal_length = 60, manual_aperture =  2.5 },
--  { name = "Lensbaby Edge 50", focal_length = 50, manual_aperture = 3.2 },
--  { name = "Lensbaby Edge 80", focal_length = 80, manual_aperture =  2.8 },
--  { name = "Lensbaby Circular Fisheye", focal_length = 5.8, manual_aperture =  3.5 },
--  { name = "Lensbaby Soft Focus Optic", focal_length = 50, manual_aperture =  2 },
--  { name = "Lensbaby Double Glass Optic", focal_length = 50, manual_aperture =  2 },
--  { name = "Lensbaby Single Glass Optic", focal_length = 50, manual_aperture =  2 },
--  { name = "Lensbaby Plastic Optic", focal_length = 50, manual_aperture =  2 },
--  { name = "Lensbaby Pinhole Optic", focal_length = 50, manual_aperture =  19 },
--  { name = "Lensbaby Fisheye Optic", focal_length = 12, manual_aperture =  4 },
--  { name = "Lensbaby Velvet 56", focal_length = 56, manual_aperture =  1.6 },
--  { name = "Lensbaby Velvet 85", focal_length = 85, manual_aperture =  1.8 },
--  { name = "Lensbaby Creative Aperture", focal_length = 50, manual_aperture =  2 },