MLV Lite - The sweet taste of MLV with none of the extra calories™

Lua scripting updated


Twitter: @autoexec_bin    Facebook: magiclantern.firmware    Live chat: [email protected]

Want to help with Magic Lantern development, but have no coding skills?

Author Topic: Lightroom plugin cr2hdr v3.0 BETA3 (WIP)  (Read 250398 times)

kichetof

  • Senior
  • ****
  • Posts: 372
  • Take a beer and enjoy it!
Lightroom plugin cr2hdr v3.0 BETA3 (WIP)
« on: March 18, 2014, 05:04:33 PM »
Lightroom Dual ISO Plugin

This plugin allows you to convert Dual ISO picture from Lightroom directly to cr2hdr tools.

Lightroom v4 and more is needed.







How to use:

  • Default settings
    • Right click on one or multiple selected pictures
      • Select : Dual ISO Converter (cr2hdr) (this option uses default settings, see below)
  • Custom settings
    • Launch the Export Window
      • Right click on one or multiple selected pictures
        • Export selected photo(s)
      • Shortcuts
        • Windows: Ctrl + Shift + E / Mac: Command + Shift + E
    • Change what you want


Default settings:

> Plugin settings:
  • Add suffix -dualiso to the output file
  • Synchronize keywords with original picture
  • Reject original picture (flag unmarked)
  • Add converted file to all collections of the original
  • No subfolder
  • Show summary message
  • Keep log file
  • No keywords added by user (Dual-ISO is added by cr2hdr)
  • No label defined

> cr2hdr settings:
  • --amaze
  • --cs2x2
  • --no-bad-pix
  • --fullres
  • --alias-map
  • --stripe-fix
  • --wb=graymax (cr2hdr 20bit)
This plugin is translate in english, french, german, portuguese and swedish. (feel free to send me a translated file).



Download the latest stable version Lightroom Dual ISO Converter 2.1

/!\ BETA /!\ Download the lastest version of Lightroom Dual ISO Converter (cr2hdr) plugin (v3.0 BETA3).



How the plugin works:
  • Pictures selected to export are listed
  • Only CR2 and DNG files are supported (if file is not present, skip)
  • Each picture, one by one is converted with cr2hdr (with defaults or custom args)
    • if cr2hdr 20bit and --same-levels are selected, all pictures are converted in the same time
  • Picture is moved to subfolder
  • Picture is renamed with suffix
  • Picture is imported into Lightroom catalog
  • Label is added
  • Keywords are added (and created if needed)
  • Synchronize keywords with original file
  • Keyword Dual ISO raw or no Dual ISO is added to original file
  • Parse log file to fill metadata with cr2hdr results
  • Add picture to all collections
  • Keep or remove log file
  • Set the flag of the original file



How to install this plugin:

To install this plugin, save the file cr2hdr.lrplugin where you want.

On Lightroom, open the Plug-In Manager (shortcut Win: Ctrl + Alt + Shift + , (comma), Mac: Command + Option + Shift + , (comma)) and install it.

You can follow instructions from Adobe.



Mac requirements:

Install dcraw and exiftool, you can use this package from a_d_.



Follow the projet on Magic Lantern Forum.

Contribute to the code on Bitbucket.

This plugin is distributed under the GNU GPL v2.



Changelogs:

2014-09-30 v3.0 BETA 3
  • fix bug with cr2hdr command on windows
2014-09-22 v3.0 BETA 2
  • fix bug with subfolder
  • fix bug with same-levels
2014-09-13 v3.0 BETA
  • Rewrite processing (no unnecessary export)
  • Update cr2hdr 20bit to 0eabcb0
  • cr2hdr 20bit --same-levels argument supported
  • Added keywords Dual ISO raw or no Dual ISO to original file (speedup process and sorting in LR)
  • Synchronize keywords with original file
  • Convert tabs with 4 space
  • fix some bugs
  • (change editor text: Brackets before Smultron/TextMate)
  • (change Mercurial CLI to GUI: TortoiseHG for Mac)
2014-04-21 - 2014-09-12 v2.2 BETA
  • Added cr2hdr args
  • Added cr2hdr 20bit support
  • Added metadata with cr2hdr results (big thanks akry)
  • Added keywords
  • Added color label
  • Added flag rejection
  • Restore default plugin settings
2014-03-27 v2.1
  • Export to subfolder
  • redesign ui
2014-03-26 v2.0.2
  • Correct portuguese translation (thanks Luiz)
2014-03-26 v2.0.1
  • Remove extern functions
  • Works on Windows
2014-03-25 v2.0
  • New export window
  • DNG file supported
  • Custom user settings (suffix, label, add to collection, remove logfile)
  • Mac: check dependencies
2014-03-19 v1.0.3
  • Fix multiple instance of cr2hdr (thanks Rob Cole from Adobe forums)
2014-03-19 v1.0.2
  • Add portuguese translation (thanks Luiz Roberto dos Santos)
  • Change output name (solve fotogemeinschaft_de problem with export name)
2014-03-19 v1.0.1
  • Add german translation (thanks g3gg0 et Walter)
  • Update dcraw (9.20) and exiftool (9.54)
  • Windows command run without CMD visible (thanks chris_overseas)
2014-03-18 v1.0
  • First release (Mac fully compatible, Windows need some optimisation)
« Last Edit: April 29, 2015, 03:28:34 PM by kichetof »

Marsu42

  • Hero Member
  • *****
  • Posts: 1533
  • 66d + flashes
Re: Lightroom plugin cr2hdr
« Reply #1 on: March 18, 2014, 05:13:12 PM »
I've the pleasure to share with you my first Lightroom plugin!

Thanks, that certainly improves usability for newbies and people who keep the cr2 and dng in the same place. Still, with acr the dual_iso auto wb is broken so this workflow isn't without problems atm.

Danne

  • Hero Member
  • *****
  • Posts: 2213
Re: Lightroom plugin cr2hdr
« Reply #2 on: March 18, 2014, 06:16:54 PM »
Great! Will test later

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 8760
  • 5D Mark Free
Re: Lightroom plugin cr2hdr
« Reply #3 on: March 18, 2014, 06:36:39 PM »
Still, with acr the dual_iso auto wb is broken

IIRC you were the one researching this problem, along with engardeknave: http://www.magiclantern.fm/forum/index.php?topic=10265

Did you check if converting CR2's to Adobe DNG before running cr2hdr helps? Did you try to copy the exif info from an Adobe DNG file to cr2hdr output? I remember asking you this stuff, but I don't remember your answer (and my LR demo expired).

Danne

  • Hero Member
  • *****
  • Posts: 2213
Re: Lightroom plugin cr2hdr
« Reply #4 on: March 18, 2014, 08:11:26 PM »
Wonderful little plugin. Don,t understand wb problem? Converted/exported my cr2 directly and it gave me superb result after processing my dng in lightroom. Perfect being able to work with dualiso straight within lightroom. Very convenient. Big thanks!

« Last Edit: March 18, 2014, 08:13:00 PM by Danne »

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 2701
Re: Lightroom plugin cr2hdr
« Reply #5 on: March 18, 2014, 08:28:53 PM »
a big lol from my side when reading that post. why?

tonight i sat in front of the adobe SDK because i wanted to make dual iso files usable straight out of LR.
the intermediate step was just too inconvinient if you gave a graphical workflow.
then i decided, this is not a simple task if you never made a LR plugin. so i stopped since i didnt want to spend a week.
(i thought the right way is to generate a proxy file and using custom extensions)
i hoped that someone would come up with a proper solution.

and three hours after i stopped reading the SDK and example plugins you posted exactly what i was looking for.
wow, this was a perfect timing :)

thanks for this cool plugin, im gonna try it!

Danne

  • Hero Member
  • *****
  • Posts: 2213
Re: Lightroom plugin cr2hdr
« Reply #6 on: March 18, 2014, 08:33:13 PM »
It is awesome.
My workflow
1 - importing the folder with dual iso cr2 files and I rate all of the 1 star(for being able to differ the originals from my resulting dngs)
2 - export to dng with the plugin
3 - back into the folder I choose to show "unrated" pictures and I end up with only my dng,s. Awesome indeed!
So nice.

*Of course one could simply point the dng,s to a specific folder to have the exported separately from the originals. Even better than above workflow
« Last Edit: March 18, 2014, 10:44:49 PM by Danne »

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 2701
Re: Lightroom plugin cr2hdr
« Reply #7 on: March 18, 2014, 09:01:48 PM »
first feedback:

 - Lightroom 4.4
 - Windows 7 x64, German
 - installed cleanly
 - "C:\Program Files\Adobe\Adobe Photoshop Lightroom 4.4\cr2hdr.lrplugin"
 - .lrcat path contains spaces too
 - images are in path without spaces
 ! exporting fails with error message that that was no dual iso file
 -> problem was the binaries not being found - placed in a %PATH% directory and it works
 -> edit: i restarted LR and removed cr2hdr from the %PATH% directory and it suddenly works ... (?!?!)
 ! logfile per image "dualiso_xxxx.txt" is created, but empty
 -> didnt check yet where it comes from :)

conclusion:
aside from the mentioned install trouble a damn cool plugin which will push dual_iso a lot.

here the german translation:
http://upload.g3gg0.de/pub_files/cf7f49e55e19749234d19593907c5785/TranslatedStrings_de.txt

Danne

  • Hero Member
  • *****
  • Posts: 2213
Re: Lightroom plugin cr2hdr
« Reply #8 on: March 18, 2014, 09:26:20 PM »
I put the plug in straight to the lightroom plugin folder.
Rightclick program "lightroom" go to show package contents to contents to plugIns folder and put the plugin in there. Works straight away on mac.

Walter Schulz

  • Hero Member
  • *****
  • Posts: 4800
Re: Lightroom plugin cr2hdr
« Reply #9 on: March 18, 2014, 09:34:05 PM »
here the german translation:
http://upload.g3gg0.de/pub_files/cf7f49e55e19749234d19593907c5785/TranslatedStrings_de.txt

Verbesserungsvorschlag:
"$$$/ML/Publish/noDualIso=Das Bild ^1 scheint kein dual ISO Bild zu sein"
->
"$$$/ML/Publish/noDualIso=Das Bild ^1 scheint kein Dual-ISO-Bild zu sein"

Ciao
Walter


chris_overseas

  • Member
  • ***
  • Posts: 164
Re: Lightroom plugin cr2hdr
« Reply #11 on: March 18, 2014, 09:46:44 PM »
- Lightroom 5.3
- Windows 7 x64, English
- Installed fine from a separate directory (F:\Lightroom\Plugins\cr2hdr.lrplugin)
- Images are in a path that contains spaces
- Selected several images, right-clicked and exported, everything worked fine!

Note that I copied over new versions of cr2hdr.exe (I used the 20 bit version), exiftool.exe (9.54) and dcraw.exe (9.20) since the included ones appear to be quite old?

Bugs/issues:
- I get an empty log file for each image (as pointed out by g3gg0)
- The cr2hdr command line window opens in the foreground (is it possible to open it minimised, hidden or behind Lightroom?)
- The DNGs were created fine and the corresponding CR2 says it is in a stack, but the DNGs don't appear in the filmstrip or library (grid) view. [OK, turns out that's because I had just imported the CR2s then exported directly, so my library selection was "Previous import" rather than the folder I'd imported. I don't think that can be considered a bug?]

Overall, this looks great and will definitely simplify my workflow. Thank you!
Canon 5D Mark III v1.2.3 | 16-35mm f2.8L | 24-105mm f4L | 70-200mm f2.8L IS II | 100-400mm f4.5-5.6L II | 800mm f5.6L | 100mm f2.8L macro | 50mm f1.4 | Samyang 14mm f/2.8 | 2 x Yongnuo YN500EX

garry23

  • Hero Member
  • *****
  • Posts: 790
Re: Lightroom plugin cr2hdr
« Reply #12 on: March 18, 2014, 10:11:50 PM »
A simple report that this plugin works perfectly: well at least in my set up, ie LR5.3 and 64bit Win7.

I just right click on the image and select cr2hdr and magically the DNG returns to Lightroom, I don't even need to synchronize the folder in library view as I need to do with some plugins.

It means that we now have 1-click processing of dual-ISO.

Many thanks to the author of the plugin.


Danne

  • Hero Member
  • *****
  • Posts: 2213
Re: Lightroom plugin cr2hdr
« Reply #13 on: March 18, 2014, 10:46:53 PM »
All my logfiles (.txt files) contain all infomation about the conversion process. No one is empty.
I,m on a mac and lightroom 4.4

example from logfile:

"   1 image files updated
cr2hdr: a post processing tool for Dual ISO images

Last update: 310e39f on 2014-02-27 05:17:41 UTC by 1p:
Fix ISOs in dual ISO

Active options:
--amaze-edge    : use a temporary demosaic step (AMaZE) followed by edge-directed interpolation (default)
--cs2x2         : apply 2x2 chroma smoothing in noisy and aliased areas (default)

Input file      : /Users/itguser/Desktop/desktop/cr2hdr/ML/dualiso_5715.cr2
Camera          : Canon EOS 5D Mark III
Full size       : 5920 x 3950
Active area     : 5796 x 3870
White level     : 12500
Black borders   : 124 left, 80 top
Black level     : 1963
ISO pattern     : BddB RGGB
Noise levels    : 10.65 6.20 6.19 10.53 (14-bit)
ISO difference  : 3.98 EV (1580)
Black delta     : 3.96
Dynamic range   : 10.73 (+) 9.95 => 13.93 EV (in theory)
Looking for hot/cold pixels...
Hot pixels      : 1155
Cold pixels     : 487
AMaZE interpolation ...
Amaze took 6.27 s
Edge-directed interpolation...
Semi-overexposed: 23.77%
Deep shadows    : 66.49%
Horizontal stripe fix...
Full-res reconstruction...
ISO overlap     : 3.8 EV (approx)
Half-res blending...
Chroma smoothing...
Building alias map...
Filtering alias map...
Smoothing alias map...
Final blending...
Noise level     : 2.45 (16-bit), ideally 2.45
Dynamic range   : 14.07 EV (cooked)
Black adjust    : 0
Output file     : /Users/itguser/Desktop/desktop/cr2hdr/ML/dualiso_5715.DNG"

kichetof

  • Senior
  • ****
  • Posts: 372
  • Take a beer and enjoy it!
Re: Lightroom plugin cr2hdr
« Reply #14 on: March 18, 2014, 11:03:35 PM »
Thank you all for your feedback! I appreciate :)

I'm glad that this plugin makes your workflow easier!!

So, my workflow is Mac and it's really more simple to write shell command on it!

I spent a lot of hours to find a way to launch the command on windows and I'll find a way to optimise it! (see my post on dev ml forum and Lightroom discussion)
To windows users:

Could you add before LrTasks.execute (where cr2hdr.exe is call): mlLog:debug(command)
And paste result from windbg or anything else debugger

Could you add /B and/or /MIN after /WAIT on windows command var and tell me if it's more user friendly

Normally all path are escaped so I don't understand why you don't have output file!

I'll update dcraw and exiftool (forget to commit new version)

Thank you for deutsch translation! :) I'll add it tomorrow

If you're a pro with lua and Lightroom sdk feel free to help me to make code more robust :)
« Last Edit: March 18, 2014, 11:15:20 PM by kichetof »

kichetof

  • Senior
  • ****
  • Posts: 372
  • Take a beer and enjoy it!
Re: Lightroom plugin cr2hdr
« Reply #15 on: March 18, 2014, 11:08:07 PM »
a big lol from my side when reading that post. why?

tonight i sat in front of the adobe SDK because i wanted to make dual iso files usable straight out of LR.
the intermediate step was just too inconvinient if you gave a graphical workflow.
then i decided, this is not a simple task if you never made a LR plugin. so i stopped since i didnt want to spend a week.
(i thought the right way is to generate a proxy file and using custom extensions)
i hoped that someone would come up with a proper solution.

and three hours after i stopped reading the SDK and example plugins you posted exactly what i was looking for.
wow, this was a perfect timing :)

thanks for this cool plugin, im gonna try it!

I'm happy to help you! For one time it's me who can help you!

chris_overseas

  • Member
  • ***
  • Posts: 164
Re: Lightroom plugin cr2hdr
« Reply #16 on: March 19, 2014, 12:35:04 AM »
(For those wanting to play with the plugin code, make sure you go into LR's Plugin Manager and enable "reload plugin on each export" so your changes to the script are picked up and recompiled each time it runs)

  • /MIN works nicely - the window still opens but is minimised so doesn't cause any real problems.
  • /B works without any window appearing at all but ONLY if /B appears before /WAIT. If /WAIT is first the /WAIT seems to be ignored and I get "Doesn't look like interlaced ISO" (http://superuser.com/questions/355341/windows-start-wait-b-not-working).
  • The log file is empty because the shell running "start" is having its output redirected to the logfile rather than the window that is opened by "start" (which is where the real output is). Passing "dualiso.cr2 > dualiso.log" through as a single parameter doesn't work. What does work is escaping the redirect with ^> instead.

Personally I prefer /B over /MIN. I also added /BELOWNORMAL to reduce the cr2hdr priority slightly and help keep the computer responsive.

Here is the updated code incorporating the above changes:
Code: [Select]
command = string.format('"start /D "%s\\bin" /B /WAIT /BELOWNORMAL cr2hdr.exe "%s" ^> "%s""', pluginPath, filePath, output)

I wonder if there is a way to run multiple cr2hdr conversions in parallel? Also since I'm not really interested in having the log files left behind, I've removed that feature from my copy. Maybe there's a way to make it optional. I know additional settings can be added to the Plugin Manager dialog though I haven't looked into how to do that yet.
Canon 5D Mark III v1.2.3 | 16-35mm f2.8L | 24-105mm f4L | 70-200mm f2.8L IS II | 100-400mm f4.5-5.6L II | 800mm f5.6L | 100mm f2.8L macro | 50mm f1.4 | Samyang 14mm f/2.8 | 2 x Yongnuo YN500EX

mad.eos

  • Freshman
  • **
  • Posts: 63
Re: Lightroom plugin cr2hdr
« Reply #17 on: March 19, 2014, 12:40:14 AM »
A huge thanks from my part kichetof! You're the man!

This has, in my opinion, turned a whole new leaf in the post processing workflow for whoever works with lightroom!

Very good work! ;)

By the way, have you already updated your zipfile with the new cr2hdr files?
Canon EOS 1100D w/ 18-55mm | ML Nightly Build Tester

Luiz Roberto dos Santos

  • Member
  • ***
  • Posts: 162
  • be.net/LuizRoberto vimeo.com/luizroberto
Re: Lightroom plugin cr2hdr
« Reply #18 on: March 19, 2014, 04:17:48 AM »
This will be very helpful, big thanks.
So, this is on Half-res blending mode? Any chance to apply blending full-res? 0k, that requires Octave, but it could be done. Moreover, as mentioned above, perhaps the new features of 20bit version and "film-curve" could help.
I will test soon and bring you the feedback. Also, try to do the translation into Portuguese - BR.

painya

  • Senior
  • ****
  • Posts: 321
  • 6d 50d 550d 5dc
Re: Lightroom plugin cr2hdr
« Reply #19 on: March 19, 2014, 04:29:18 AM »
This is not to the ML Gurus.
To the beginners!
Here is a quick user friendly guide-
Open LR
File>Plugin manager
Click on the folder
Restart LR
Right click on your image
Export>ML>Cr2_hdr (or whatever it is)
Enjoy!
Good footage doesn't make a story any better.

Danne

  • Hero Member
  • *****
  • Posts: 2213
Re: Lightroom plugin cr2hdr
« Reply #20 on: March 19, 2014, 08:12:14 AM »
I wonder if there is a way to run multiple cr2hdr conversions in parallel?

I just ran exports in several export operations. Tried running 5 exports simultaneously of cr2 to dng and they work in parallell that way. Occassionally I get a pop up window telling me an internal error has occured but it exports anyway so I just ignored and synchronized the folder when finished.

The error code


*It appears the error code does indeed affect some pictures only getting halfway through the process so Running several export operations simultaneously isn,t stable.
« Last Edit: March 19, 2014, 08:54:07 AM by Danne »

kichetof

  • Senior
  • ****
  • Posts: 372
  • Take a beer and enjoy it!
Re: Lightroom plugin cr2hdr
« Reply #21 on: March 19, 2014, 09:05:45 AM »
Note that I copied over new versions of cr2hdr.exe (I used the 20 bit version), exiftool.exe (9.54) and dcraw.exe (9.20) since the included ones appear to be quite old?

Updated !

here the german translation:
http://upload.g3gg0.de/pub_files/cf7f49e55e19749234d19593907c5785/TranslatedStrings_de.txt

Thanks for this translation!

Here is the updated code incorporating the above changes:
Code: [Select]
command = string.format('"start /D "%s\\bin" /B /WAIT /BELOWNORMAL cr2hdr.exe "%s" ^> "%s""', pluginPath, filePath, output)

Yeaaaah !! Big thanks for that !!! (I'm more comfortable with a shell terminal)

I wonder if there is a way to run multiple cr2hdr conversions in parallel? Also since I'm not really interested in having the log files left behind, I've removed that feature from my copy. Maybe there's a way to make it optional. I know additional settings can be added to the Plugin Manager dialog though I haven't looked into how to do that yet.

I don't know how to make it, but I'll read the lightroom SDK to find it :)

I just ran exports in several export operations. Tried running 5 exports simultaneously of cr2 to dng and they work in parallell that way. Occassionally I get a pop up window telling me an internal error has occured but it exports anyway so I just ignored and synchronized the folder when finished.

The error code


*It appears the error code does indeed affect some pictures only getting halfway through the process so Running several export operations simultaneously isn,t stable.

Thanks for this try ! I'll investigate how to make it possible!

New version 1.0.1, I'll update first post soon !

Marsu42

  • Hero Member
  • *****
  • Posts: 1533
  • 66d + flashes
Re: Lightroom plugin cr2hdr
« Reply #22 on: March 19, 2014, 09:21:04 AM »
IIRC you were the one researching this problem, along with engardeknave: http://www.magiclantern.fm/forum/index.php?topic=10265

Well, he was researching it a bit and quickly came to the conclusion I arrived at even w/o some days of trial & error - it's too complex for us to figure out the algorithm how acr arrives at its wb values from the tags embedded in the cr2 :-(

thanks for this cool plugin, im gonna try it!

Maybe you can figure out to get the correct "as shot" wb from acr? This is a real pita, if you didn't shoot a wb/color card or a non-dual_iso shot to compare it's complete guesswork what the correct wb/tint is.

fotogemeinschaft_de

  • New to the forum
  • *
  • Posts: 12
  • Fotogemeinschaft.de - moving moments...
Re: Lightroom plugin cr2hdr - Error: 'Already treated
« Reply #23 on: March 19, 2014, 09:35:57 AM »
After the first export (which was ok) I always get the following error with every other Picture:

'Already treated' - 'The File xy has already converted to dual iso'
(LR 5.2)

In fact the file was NOT converted.

I have found the reason for this behaviour by myself: The plugin doesn't add numbers to the converted files; my filenames are rather long and the plugin therefore produces always the same filenames in the same directory.

After every single conversion I have to rename the converted file manually. A batch-job will therefore not be possible but nevertheless the integration in LR is great..

Ralf
« Last Edit: March 19, 2014, 09:53:58 AM by fotogemeinschaft_de »
Please visit my www.fotogemeinschaft.de - 30.000 pics

vertigopix

  • Senior
  • ****
  • Posts: 281
  • EOS M - 60D - 6D
Re: Lightroom plugin cr2hdr
« Reply #24 on: March 19, 2014, 09:57:28 AM »
Thanks for this plugin !   :)
Checked you version 1.0.1 and working perfectly for me (LR 5.3 64bit, Win7 64)

Great job !

 

courtesy