Lightroom plugin cr2hdr v3.0 DEV (WIP)

Started by kichetof, March 18, 2014, 05:04:33 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

dmilligan

Perhaps popen doesn't work on Windows. I don't have a win pc, but I know it works on Mac. Also, your code snippet the way it is written shouldn't work, b/c you read the whole input, discard that and then try to read it again line by line. You should simply print the output variable. You also may need to specify the mode parameter for popen.

RGB to Temp/Tint is an incredibly complex calculation involving matrix transformations. I have implemented it in MLVFS source, but I still don't really understand the math.

kichetof


local cmd = string.format('""%s" -i -v "%s""', LrPathUtils.child(_PLUGIN.path, 'dcraw.exe'), LrPathUtils.child(_PLUGIN.path, '_MG_9542.CR2'))
-- note the double double quote
log:debug(cmd)

for l in io.popen(cmd, 'r'):lines() do
    log:debugf("%s", l)
end


Yes that works!

Okay I'll apply exiftool -AsShotNeutral to simplify the process :)

starbase64

Hi,

i have testet version 3.0 beta 3.3 with dual iso pics from my 70D and the plugin works randomly.

here two pics, the first doesn't work and second works:

https://www.dropbox.com/sh/8obd08vnf59y7kn/AABqSzGQAbyf0cFixvloDXm1a?dl=0

regards

starbase64

Walter Schulz

What does "doesn't work" mean?
- Dual-ISO is not treated as Dual-ISO or any other error resulting in cr2hdr missing to generate DNG?
- Converted DNG exposure is just wrong (overexposed)?

Can confirm second one.

starbase64

the replied message is simple, it is not a dual iso image

Walter Schulz

Conversion is working here. Had a hickup once with a strange error message about path properties but not reproducable.
You are using latest cr2hdr (compiled by dfort)?
https://bitbucket.org/daniel_fort/magic-lantern/downloads

starbase64


Walter Schulz

Download dfort's binaries and replace cr2hdr.

starbase64


kichetof

Bin updated, thanks @dfort
First support of WB=dcraw from camera multipliers :)
Move all files into lrplugin container to avoid hyphen bug and other little tweaks (see commits)

Version 3.1 on the road!  8) 8)

Could you confirm that GUI doesn't go out of view ? (on both Mac and Windows, for me everything is ok (27" for Mac and 2x24" on Win), luckily 8))

(No download link, download repo; Used command line operation for the moment, need to considere the gain from parsing command output in lua)

Walter Schulz

And Adobe *can* speed up fixing things ...
LR 6.3/CC 2015.3 is there and old import dialog is back
http://blogs.adobe.com/lightroomjournal/2015/11/lightroom-cc-2015-3-6-3-now-available.html

Patch installer seems to work for LR 6.1.x/CC 2015.1.x but CC app still wants to install October update (aka: 6.2/CC 2015.2). Those jumping from LR CC 2015.1 to 2015.3 may want to install LR CC 2015.2 first. We will see an updated CC app soon, I suppose.
Camera RAW version is 9.3

kichetof

Great news!! Normally the plugin should works with this version!
I can't try it before tomorrow morning!

If someone could confirm that everything works  8)

Walter Schulz

I'm afraid I cannot confirm this, now.
Plug-In is there and can be used but I have exactly the same error starbase64 was reporting. One of his sample files works fine and is converted and for the other one cr2hdr is telling me that it is no Dual-ISO file.

Update: Deleted his samples and reimported both and everything works fine now.

kichetof

Glad to read this! I'll try tomorrow to confirm that everything works well!

[EDIT] everything is ok !

starbase64

@Walter Schulz

can you upload v3.1 for me? can't build with command line.

kichetof

@starbase64 no v3.1 for the moment. But you only need to replace cr2hdr from bin folder with @dfort compiled

starbase64


NickZee

Hello @kichetof,

I recently started using the plugin and think it is great!  I received these errors and I believe turning off Same Levels fixed it.






I'm blending 5600 files right now.  They are from 20 Dual ISO RAW videos. 

Do you have a donation link?  If I find the plugin in my workflow, I would like to contribute to its further development.
Architectural Photography
NickZimmerman.com
5D MK3 & 600D | 24-70mm USMII L 2.8 | Nikon 14-24mm 2.8 | Nikon Nikkor 24mm 2.8 AIS & 50mm 1.4 AIS ** Windows 8.1 Pro | 32GB Ram | i7-4770 @ 3.4GHz

kichetof

Hello @NickZee

Ouch effectively same-levels will create an error like that with a lot of pictures.

When you run the plugin with same-levels, it will run like that:

C:\Users\tof\Scripts\cr2hdr.lrdevplugin\bin\cr2hdr.exe  --amaze-edge --cs2x2 --no-bad-pix --fullres --alias-map --stripe-fix --same-levels 'C:\Users\tof\photos\1.DNG' 'C:\Users\tof\photos\2.DNG' 'C:\Users\tof\photos\3.DNG' 'C:\Users\tof\photos\4.DNG' 'C:\Users\tof\photos\5.DNG' 'C:\Users\tof\photos\6.DNG' 'C:\Users\tof\photos\7.DNG' 'C:\Users\tof\photos\8.DNG' 'C:\Users\tof\photos\9.DNG' 'C:\Users\tof\photos\10.DNG' 'C:\Users\tof\photos\11.DNG' 'C:\Users\tof\photos\12.DNG' 'C:\Users\tof\photos\13.DNG' 'C:\Users\tof\photos\14.DNG' 'C:\Users\tof\photos\15.DNG' 'C:\Users\tof\photos\16.DNG' 'C:\Users\tof\photos\17.DNG' 'C:\Users\tof\photos\18.DNG' 'C:\Users\tof\photos\19.DNG' 'C:\Users\tof\photos\20.DNG' 'C:\Users\tof\photos\21.DNG' 'C:\Users\tof\photos\22.DNG' 'C:\Users\tof\photos\23.DNG' 'C:\Users\tof\photos\24.DNG' 'C:\Users\tof\photos\25.DNG' 'C:\Users\tof\photos\26.DNG' 'C:\Users\tof\photos\27.DNG' 'C:\Users\tof\photos\28.DNG' 'C:\Users\tof\photos\29.DNG' 'C:\Users\tof\photos\30.DNG' 'C:\Users\tof\photos\31.DNG' 'C:\Users\tof\photos\32.DNG' 'C:\Users\tof\photos\33.DNG' 'C:\Users\tof\photos\34.DNG' 'C:\Users\tof\photos\35.DNG' 'C:\Users\tof\photos\36.DNG' 'C:\Users\tof\photos\37.DNG' 'C:\Users\tof\photos\38.DNG' 'C:\Users\tof\photos\39.DNG' 'C:\Users\tof\photos\40.DNG' 'C:\Users\tof\photos\41.DNG' 'C:\Users\tof\photos\42.DNG' 'C:\Users\tof\photos\43.DNG' 'C:\Users\tof\photos\44.DNG' 'C:\Users\tof\photos\45.DNG' 'C:\Users\tof\photos\46.DNG' 'C:\Users\tof\photos\47.DNG' 'C:\Users\tof\photos\48.DNG' 'C:\Users\tof\photos\49.DNG' 'C:\Users\tof\photos\50.DNG' 'C:\Users\tof\photos\51.DNG' 'C:\Users\tof\photos\52.DNG' 'C:\Users\tof\photos\53.DNG' 'C:\Users\tof\photos\54.DNG' 'C:\Users\tof\photos\55.DNG' 'C:\Users\tof\photos\56.DNG' 'C:\Users\tof\photos\57.DNG' 'C:\Users\tof\photos\58.DNG' 'C:\Users\tof\photos\59.DNG' 'C:\Users\tof\photos\60.DNG' 'C:\Users\tof\photos\61.DNG' 'C:\Users\tof\photos\62.DNG' 'C:\Users\tof\photos\63.DNG' 'C:\Users\tof\photos\64.DNG' 'C:\Users\tof\photos\65.DNG' 'C:\Users\tof\photos\66.DNG' 'C:\Users\tof\photos\67.DNG' 'C:\Users\tof\photos\68.DNG' 'C:\Users\tof\photos\69.DNG' 'C:\Users\tof\photos\70.DNG' 'C:\Users\tof\photos\71.DNG' 'C:\Users\tof\photos\72.DNG' 'C:\Users\tof\photos\73.DNG' 'C:\Users\tof\photos\74.DNG' 'C:\Users\tof\photos\75.DNG' 'C:\Users\tof\photos\76.DNG' 'C:\Users\tof\photos\77.DNG' 'C:\Users\tof\photos\78.DNG' 'C:\Users\tof\photos\79.DNG' 'C:\Users\tof\photos\80.DNG' 'C:\Users\tof\photos\81.DNG' 'C:\Users\tof\photos\82.DNG' 'C:\Users\tof\photos\83.DNG' 'C:\Users\tof\photos\84.DNG' 'C:\Users\tof\photos\85.DNG' 'C:\Users\tof\photos\86.DNG' 'C:\Users\tof\photos\87.DNG' 'C:\Users\tof\photos\88.DNG' 'C:\Users\tof\photos\89.DNG' 'C:\Users\tof\photos\90.DNG' 'C:\Users\tof\photos\91.DNG' 'C:\Users\tof\photos\92.DNG' 'C:\Users\tof\photos\93.DNG' 'C:\Users\tof\photos\94.DNG' 'C:\Users\tof\photos\95.DNG' 'C:\Users\tof\photos\96.DNG' 'C:\Users\tof\photos\97.DNG' 'C:\Users\tof\photos\98.DNG' 'C:\Users\tof\photos\99.DNG' 'C:\Users\tof\photos\100.DNG' 'C:\Users\tof\photos\101.DNG' 'C:\Users\tof\photos\102.DNG' 'C:\Users\tof\photos\103.DNG' 'C:\Users\tof\photos\104.DNG' 'C:\Users\tof\photos\105.DNG' 'C:\Users\tof\photos\106.DNG' ... ... ...


So, the command is too long ...
I'll thinking to find an another way to converse a lot of pictures (maybe to converse entire folder, but converse all pictures without exception)

If you want to donate, contribute to Magic Lantern :)

Danne

How about exiftool adding the white level from the first dng to all the selected pics after conversion? Don,t know how lightroom/lua registers the pics chosen but there must be some kind of listing?

kichetof

That a solution, but I need to calculate the white level...

cr2hdr same-levels source

if (same_levels && num_files > 1)
    {
        /* Equalize white-black for all shots.
         *
         * Assuming all the pictures were shot at the same exposure settings,
         * this step will make sure they are all rendered identically (without flicker).
         *
         * However, for this to work, all the files must be passed in the same command line.
         *
         * We will use something close to maximum range among all files (with outlier filter).
         *
         * This should work even if the black level is not the same in all shots.
         */
       
        printf("\nEqualizing levels...\n");
       
        int* ranges = malloc(num_files * sizeof(ranges[0]));
        for (int i = 0; i < num_files; i++)
        {
            ranges[i] = whites[i] - blacks[i];
        }
        int new_range = kth_smallest_int(ranges, num_files, num_files * 8 / 9 - 1);

        for (int i = 0; i < num_files; i++)
        {
            char* input_file = argv[file_indices[i]];

            /* fixme: duplicate code */
            char out_filename[1000];
            snprintf(out_filename, sizeof(out_filename), "%s", input_file);
            int len = strlen(out_filename);
            out_filename[len-3] = 'D';
            out_filename[len-2] = 'N';
            out_filename[len-1] = 'G';

            int new_white = blacks[i] + new_range;
            printf("%-16s: %d ... %d\n", out_filename, blacks[i], new_white);
            set_white_level(out_filename, new_white);
        }
       
        free(ranges);
    }


If Dual ISO same-levels picture are on the same folder, easy to run the command cr2hdr --same-levels path\*.DNG/CR2, but if some picture aren't Dual ISO ?

dfort

Quote from: kichetof on November 18, 2015, 11:15:35 AM
@starbase64 no v3.1 for the moment. But you only need to replace cr2hdr from bin folder with @dfort compiled

Yesterday I updated the cr2hdr (along with the included exiftool and dcraw) in my download area, there was a problem with the previous version I compiled. The test version is preferred, it has some fixes by a1ex that haven't been merged into the unified branch yet.

Danne

Or snatch it the old style way ;)

exiftool First.DNG | awk '/White Level/ { print $4; }' > /tmp/magic_l_prores/wl_01 
wl_01=$(cat /tmp/magic_l_prores/wl_01)
rm /tmp/magic_l_prores/wl_01


QuoteIf Dual ISO same-levels picture are on the same folder, easy to run the command cr2hdr --same-levels path\*.DNG/CR2, but if some picture aren't Dual ISO ?

Same level is only needed for movie DNG sequences not for standalone CR2 files?

dfort

@kichetof if you are looking into cr2hdr make sure you are using the new cr2hdr branch that a1ex has been working on. You might also take a look at an issue that is causing a segmentation fault. dmilligan has narrowed down the problem.

http://magiclantern.fm/forum/index.php?topic=16166.msg157501;topicseen#msg157501

kichetof

@Danne you can run --same-levels on CR2 but it does not make sense
Thanks for the command!

@dfort yes I follow the topic, I'll update bin with new one!