Auto Hand Held Bracketing Script

Started by garry23, February 11, 2018, 05:53:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

This thread is superseded by https://www.magiclantern.fm/forum/index.php?topic=25731.0

This script attempts to create an 'optimized' set of brackets when hand holding.

The script may be downloaded from here: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

The script uses a two pass bracketing scheme and the idea for the script was triggered by reading https://people.csail.mit.edu/hasinoff/pubs/hasinoff-hdrnoise-2010.pdf

The script assumes you have set exposure to capture the highlights, eg using ETTR. You should have advanced bracketing off, so you can use ETTR as part of your capture workflow. The script will switch advanced bracketing on and off.

The first pass takes three brackets using ISO shifting up to the maximum ISO, which is sensibly assumed to be 6400 in the script.

The script will then see if a second pass can be accomplished, ie if the base shutter was above the minimum shutter. If a second pass can be taken the script will take two additional brackets from the minimum shutter speed and the maximum ISO, ie doing time bracketing at a fixed, max ISO.

Thus you will always get either 3 or 5 brackets, straddling 1/30s (or your minimum shutter) to the fastest shutter needed for the highlights, and from the lowest ISO you can use for the base highlight to ISO 6400.

As I explore the HHB script I will write about it on my blog at www.photography.grayheron.net.

As usual I welcome testers and feedback.

garry23

I've refined the Auto Hand Held Bracketing script, which you can download from here: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

The script is now focal length aware, ie if you choose auto mode (FF or Crop) it will ensure the ETTR min shutter is adjusted.

In ETTR mode, select in the script's menu, you control things by setting the min shutter yourself, ie in the ETTR menu.

Please read the script's comments for more info.

As before, advanced bracketing should be switched off, so you can use ETTR. The script will switch bracketing on and off.

The script is switched on by doing a 3sec + half shutter press, thus you can hand hold to your eye, undertake an ETTR (use double press to trigger) and then switch on the auto HHB script, all without your eye leaving the camera (unless you are in LV mode and hand holding at a distance from your eye).

Here are a couple of screen captures of a test image I just took in our kitchen. The ETTR (0% highlights) chose 1/15 (auto set by the script from the focal length of the lens), at F/7.1 on my 12mm at ISO 100; as the base exposure for the highlights. The script then bracketed from there to ISO 800 and SO 6400. No additional time brackets were taken as the base shutter was not faster than the slowest shutter.

LR capture (below) shows the three brackets, then the HDR merged image, then the post processed in LR image.

I've also added a jpeg of the final processed image.

Looking forward to hearing how others get on with the script.

BTW I've tested it on my 5D3 so far.






garry23

I've refined the Hand Held Bracketing Script (which can be downloaded from here: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa).

The menu has the following options:





And here are four hand held images I took today, using the script, inside Winchester Cathedral.










garry23


IDA_ML

Fantastic work, Garry, keep it up!  Perfect for people like me who do not like carrying tripods around.  Pictures are really impressive!

garry23

Have tidied things up and hopefully made the ISO bracketing logic more robust.

Here is the latest script: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

Would really welcome other users trying it out ;-)

Danne

This looks great. Will try it as soon as I can. Thanks for contributing.

garry23

@Danne

Looking forward to hearing what you and others think. My weekend experience, in Winchester Cathedral, went well, and as I say on my blog, I can recommend using it with ETTR on, initiated with a double press, and with the audio feedback on in the script and a 2 sec delay in the script,, so you know the script is ready and you have a couple of seconds to compose yourself. 

It was a pleasure to use, ie the ETTR and HHB workflow went well.

As an aside, I was also impressed in post to see how well LR handled the hand held pano challange, where as a more specialised piece of pano software struggled. See my pano posted earlier.

Cheers

Garry

garry23


ToniX

Hi @garry23,

...in order to run the script, I just need to save it as .LUA (notepad or specific editor?) and then drop it into the ML's script folder?

Does it will work on 600D?

(forgive my ignorance,  I am only recently aware of the existence of LUAs ...)

Thanks

600D - EFs18-55 ISII

garry23

@ToniX

I recommend you use the Lua fix ML download from the experimental branch, it is the most up to date, and the 600D is there.

Make sure you switch on the Lua and ETTR modules, as well as other modules that you need, eg Dual-ISO.

As for setting, make sure you set the ETTR up, eg double press, highlight ignore should be low, say 0.1%, dual should be off and the s/n option 0.

Let me know how you get on.

garry23

@ToniX

...also when you down load the script it will have the Lua file extension. Place the file in the ML scripts folder.

You will see loads of other scripts there as well. I personally remove these to another folder so they don't run.

When you then switch the camera on you will need to enable the modules, once only. Then go to the scripts tab and enable my script, i.e. Auto run on.

BTW I recommend you also try the focus bar script as well.

Cheers

Garry

ToniX

Thanks for the instructions and for the various suggestions (it seems to me everything is clear!). :)

I will test in the next days, I will report my impressions.

Thanks for the availability and congratulations for your photos on 500px, I'm following you now.
600D - EFs18-55 ISII

IDA_ML

Garry,

I have a few questions on your script:

1) Keeping in mind that some of the shots are taken at high ISO - 6400, where does the noise go?  Averaging???  Your examples look amazingly clean.

2) What about misalignment between the different shots?  If the bracket is taken handheld, there will deffinitely be some misalignment beween the frames.  Does the post process take care of it?

3) Does Photomatix provide a good result with merging the single frames?  Have you tried that?

Thanks.

a1ex

Quote from: IDA_ML on February 21, 2018, 11:10:13 AM
1) Keeping in mind that some of the shots are taken at high ISO - 6400, where does the noise go?  Averaging???  Your examples look amazingly clean.

Misconceptions 101 - higher ISOs have less noise, all other exposure variables being equal (including the brightness of the output image). This was discussed many times, and Garry himself linked to a paper on this subject a few posts ago.

In particular, for 5D3, log2(34.9 / 2.5) = almost 4 stops of better shadow performance with ISO 6400, compared to ISO 100. Price to pay for that: 6 stops of clipped highlights.

When bracketing, you take the highlights from other images, possibly captured at lower ISOs and/or faster shutter speed. Problem solved. The same happens with Dual ISO.

P.S. compare these plots with the ones from Hasinoff's paper (in particular, Fig. 2b) :)

garry23

@IDA_ML

As @a1ex says, there are many misconceptions out there regarding 'noise'. Also, total noise is made up of many components, eg photon shot noise and 'electronic-camera-related noise' etc.

Anyway, as @a1ex says, higher ISOs have less read-noise, as seen in this graph for a 5D3 taken from photonstophotos:




free photo hosting websites


Note log2 scaling, and that once the ISO enters the ISO invariant zone, around 1600-3200, the images become (relatively) ISO noiseless, ie no more noise is added and the electronic noise is at its lowest, eg a few electrons per photo site.

Of course, noise, on its own is not a good metric for IQ. You need signal; and at high ISO signal is low.

As for alignment, unless you are radically moving the camera, the auto align algorithms seem to do well. At least from my experience using HDR Merge in LR: BTW I don't use Photomatix.

Bottom line: This version of the script works reasonably well, but I'm still experimenting with strategies. For example, I just tried a version that took n max ISO images on top of the ISO bracketed ones. My thinking was to exploit the sqrt(n) noise reduction. But the issue is post processing all the differently processed sub-brackets, eg can't process all of them at one go. I need to do some more thinking if I'm to get the last ounce out of the script ;-)

BTW here is another image I processed from my Winchester trip, that I think shows the power of the technique - once again hand held:





POSTSCRIPT: Just tried Photomatix (I have it, but gave up using it in favour of LR-HDR Merge), and in fusion-natural mode it tooks pretty good.

garry23

BTW @IDA_ML here is a Photomatix (6) processed image from my Winchester hand held shoot:




Danne

Hi garry23. Could you share the six images from your winchester capture? I am trying out three different ways to produce aligned and merged tifs. Will post the results here if you don't mind.

IDA_ML

Thank you, А1еx for these important sources and thank you, Garry23 for sharing your quite impressive results.  Thanks to you, guys, I will have some very interesting material to read and a new module to experiment with for the weekend.

I do have one more question to Garry23 though.  I have been using Dual ISO quite a lot lately and really love it because it gives me 2-3 stops of increased dynamic range with just one single FRSP shot.  With the latest trigger options, it works extremely well with handheld stabilized lenses in low-light conditions generating losslessly compressed FRSPs and also provides very natural colors.  Reduced resolution in the highlights and shadows has never been an issue for me or at least, I never noticed a visually noticeable problem with that.  Workflow is also greatly simplified.  I just use the cr2hdr utility to convert the Dual ISO images to DNG files and then I process the latter in Photoshop or Lightroom as any RAW file. 

So, my question is:  Have you compared your bracketing method with the Dual ISO method and if yes, which one of both methods provides better image quality, less artifacts and more naturally looking results?  Your experience and opinion on that should be greatly appreciated.

ToniX

@IDA_ML   Braketing is more suitable for static subjects, while Dual ISO allow more DR in scenes with moving subjects. I would say that these are complimentary techniques for HDR shooters.
600D - EFs18-55 ISII

garry23

@IDA_ML

Dual-ISO and my (Auto) Hand Held Bracketing script are complementary, and I use both.

I will consider Dual first, because it works with a single image: but, relative to the HHB script it doesn't cover as high a DR.

I wrote the HHB mainly for one use case: when I'm in a high DR environment, like a church etc, but where tripods are either not allowed or difficult to use.

Also, unlike dual-ISO, the HHB script is sensitive to movement in the scene, eg people moving.

You may wish to try the latest version of the script: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

I've rethought the bracketing strategy to try and maximise the DR, ie get the most photons, so my two passes approach goes like this:
* Pass one will attempt a time bracket from the highlights starting point
* Pass two will carry out an ISO bracket set from the min hand holding shutter point

I look forward to others trying out the latest bracketing strategy.

Cheers

Garry

garry23


Danne

Great images to bracket. Thanks for sharing. I published a lot of code into Switch lately around HDR automation. Will group images checking time gap. Tried by detecting motion through hugin align_image but wasn´t reliable so back to time gap procedures. Anyhow I got three HDR workflows which I test and will write some more about those in a forum post later. Here are my examples from your cr2 files.

Code:
https://bitbucket.org/Dannephoto/switch/src/dd1ec9f982b2da7865108610b0b3366b01109573/Switch.app/Contents/bash/HDR_CR2.command?at=default&fileviewer=file-view-default


hugin align/enfuse
file: https://bitbucket.org/Dannephoto/magic-lantern/downloads/Enfuse__GJG5720-preview3-_GJG5724-preview3.tif


hugin/align to FFmpeg(tblend filter)
file: https://bitbucket.org/Dannephoto/magic-lantern/downloads/FFmpeg__GJG5720-preview3-_GJG5724-preview3.tif



HDRmerge
http://jcelaya.github.io/hdrmerge/
file: https://bitbucket.org/Dannephoto/magic-lantern/downloads/HDRmerge__GJG5720-5724.dng
Example dng(did not work good at all):



garry23

@Danne

I've experimented with Aurora HDR, Photomatix, LR/Enfuse and LR-HDR-Merge. I think all are four worth using, with LR-HDR-Merge the 'simplest'.

It is instructive to compare my image (https://ibb.co/b2MVSc) of the same brackets with yours, i.e. processed in LR Merge.

I have only tried the latest version of the script at home. As soon as I can get in a more realistic environment, eg a church etc, I won't know if the latest bracketing strategy is better the my original. My gut feeling is that it should.

Cheers

Garry

garry23

Although I thought it was making my life easier using the ML Advanced Bracketing, in fact it was complicating managing the ISO and Time brackets between the limits, ie highlight starting point and min hand holding shutter.

I have therefore dropped using the advanced bracketing in the script and switched to explicitly controlling the required brackets.

The code is simpler and I'm not limited to the delta Ev between brackets.

Here is the updated code: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

ToniX

Quote from: garry23 on February 23, 2018, 09:20:51 AM

Here is the updated code: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

So, is this new script to be used now?

P.S. I 've got to install and run the  previous version of the script, but I had no chances to test it enough to report  you about it.. (I will)
600D - EFs18-55 ISII

garry23

@ToniX

Run either, but not both together.

That is have one or the other in your script folder.


garry23

As I indicated in a previous post, I changed the bracketing scheme in my Hand Held Bracketing script, in an attempt to maximise DR, ie grab the most photons.

Yesterday I had a chance to carry out some extreme tests at our local National Trust property: The Vyne.

The rooms are very dark and just lit with window light through diffuse screens and weak lamp light.

I thought I would share one of my images that shows, at least to me, in dark environments, where you can't use a tripod or a flash, you can still get some reason 'memory shots'.





Once again, this was taken with my 5D3, hand holding my Irix 11mm Blackstone (a great lens). Post processing was 'just' in LR. The six brackets were merged in LR with LR-HDR-Merge.

BTW for those that wish to use previous versions of my HHB script, simply do that from my github area that has the HHB script: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

garry23

For those that are following my hand held bracketing experiments, the latest version of the script is, I think/hope, the final algorithm.

It can be downloaded here: https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

The main logic remains, ie time bracket from the highlights and ISO bracket from the slowest hand holding shutter. This basic logic should maximise DR, ie grab the maximum photons.

The latest version has a refinement that kicks in IF you can't time bracket, ie the highlight shutter is the same as the min hand holding shutter.

In this situation you can tell the script to carry out three additional brackets, 1/3 Ev, around the high ISO limit. This gives you three extra brackets in the high ISO region, hopefully to better manage noise. That is sqrt 4 less noise at the high ISO end: three extra brackets plus the ISO bracketed one at high ISO.

Note you should ensure that the Canon max ISO is higher than the scripts'.

As usual I look forward to others trying it out.

BTW as for post processing, I've tried Aurora HDR, Photomatix LR-HDR-Merge and LR/Enfuse. There seems to be some advantage in carrying out NR as soon as possible and before any 'tone mapping'.

Cheers

Garry

POSTSCRIPT

Here is an example from the latest script. This scene generated three ISO and three time brackets. I then chose three to throw at LR-HDR-Merge




IDA_ML

Hello Garry,

I finally found some time to test your Auto Hand Held Bracketing Script on my EOS 100D and I have to say, I love it!  It works quite well with wide angle lenses (I tested with the EOS 17-40/4L at 17 mm).  The coolest thing is that the script also works with the single lossless FRSP DNGs and keeps the image stabilizer of stabilized lenses active during shooting the bracketing sequence.  This increases the usability of the script at very low light where shutter speeds in the 1/3 to 1/15-th of a second are quite common.

I used the build that was available for download on Feb. 24-th.  Since I did not have much time to test different options thoroughly, I left everything on Auto and used AETTR before taking the sequence.  In this mode, the camera would take 3 bracketed pictures at 1/4-th of a second, F5 and ISOs 100, 400 and 1600.  Then, I draged and dropped the three pictures directly from the SD card onto the Photomatix icon and let it do the fusion aligning and HDR merging using either the Neutral or the Interior options for the in-door photos that I took.  The results were quite satisfactory in terms of dynamic range and noise which was monochromatic and easy to remove afterwards in Photoshop.  Here are a few things that I noticed and that need a fix:

1) The HHB.Lua file has to be renamed to hhb.lua, otherwise the 100D does not recognize it in the script folder.

2) The Audio User Feedback function does not work on the 100D although the beeper is active in the Canon menu.  There is no beep when the camera is ready to take the sequence.

3) The shutter and apperture settings that I see in the view finder (F4 and 1/30 s) does not correspond to reality.  The actual set of bracketed photos is taken at F5 and 1/4 s).  Thus, there is no feedback to the user on the actual shutter and aperture settings that the camera takes the pictures at.

4) It is impossible to take more than one picture set after camera is turned on.  Every attempt to take a second set results in one single picture.  I have to turn the camera OFF and ON again to take the next set.  This is not good for the mechanical camera switch.

5) Right now, the sweet aperture spot which provides the most balanced image seems to be F5.  There are wide angle situations, however, requiring the aperure to be closed to F11, F16 or even F22.  In this case, the dark areas in the photo get terribly underexposed.  Quite obviously, in situations like this, the camera cannot find a balance between the maximum ISO and the minimum shutter speed for proper exposure.  In my opinion, in situations like this, the camera should reduce shutter speed to a value allowing for proper exposure of the dark areas while warning the user that it will use a much lower shutter speed than the limit set by the user.

===========================

Two more 100D issues that have nothing to do with the script:

6) The camera does not report the shutter speed properly in Adobe Camera RAW or any other editor.  A lens dependent value of 1/4, 1/3 or 1/2 s is reported, regardless of the actual shutter speed at which the silent DNG was taken.  With CR2 files, everything is fine.

7) There are no previews of the single DNGs in Explorer or any of the editors.  The thumb nails look like black squares.  This makes it extremely difficult to select the bracketed photos.  The only way to do that is to import all of them into Lightroom where the thumbnails are visible.  This process is very slow and takes for ever, actually much longer than the import of regular CR2 files.  The solution would be to fix the DNG thumb nail previews in Windows Explorer.

===============================

Excellent job, Garry and very useful!  Congratulations and thanks a lot for your efforts!

garry23

@IDA_ML

First of all thanks for testing. As you can appreciate, with 'only' a 5D3 and EOSMs I can't account for all cameras.

Having said that, the script is fairly simple and shouldn't be too camera specific: so I'm surprised your 100D is exhibiting 'strangeness'. For example the audio beep works on my 5D3. Have you tried the LED option? I don't understand the HHB.lua vs hhb.lua sensitivity, HHB.lua works on my 5D3  - but maybe someone else does ;-)

BTW I've tweaked the algorithm again ;-) https://gist.github.com/pigeonhill/7efb6b13e34e366d2651ba574125a5fa

You can now tell the script to not do a second pass, ie only take the ISO brackets, or just do a second pass time bracket pass if you can, or do a 2nd time bracket pass and if you can't then do a high ISO bracket, or only do a high ISO bracket.

When doing the high ISO brackets you can choose 0Ev or 1/3Ev deltas. The 0Ev gives you brackets to do sqrt(n) noise reduction in post, ie before merging with the other brackets.

Let me be clear what the script does. It simply takes a set of brackets between your hand holding limit and your ISO max limit. The only thing the script knows about your scene is the input shutter and ISO settings that it assumes are set for the highlights. It also resets to these at the end.

I can't think what the problem is regarding not being able to reuse the script. Do you have other scripts running, eg conflicting key events?

For ultra WA lenses, ie less that 30mm on a FF, I would explicitly set the lowest shutter for hand holding, eg 1/30 or 1/60.

Finally, why would you wish to use F/16 or F/22 on a WA lens? The diffraction will be high. But it's your choice ;-)

Cheers

Garry

IDA_ML

Thanks, Garry23,

My comments were not meant as a criticism to your script, which is really great and perfect for interior photography.  I have just shared some feedback from my observations as you requested.

I have no explanation why the beep warning does not work with the 100D.  It does work with Canon's functions though.  But I think, I can live with that.  Much more annoying is the necessity to turn the camera off and on again after each bracketing set to allow me to take the next one. Since Life View stays on after the first set is complete, this creates noise (undesirable in churches, museums, etc.) and wares out the mechanical switch.

When I find some time, I will also test your latest version and I will also try the LED option.  As far as your question about why one would wish to use such closed apertures with WA lenses, the answer is very simple.  Most of them have soft corners at apertures up to F8 or higher, especially the cheaper ones.  If you want to avoid the corner softness, you need to close the lens to F11 or even more.  One example is the Sigma 12-24 which requires this.  Only very expensive WA lenses are sharp edge to edge wide open.  In other situations, where some objects of the scene are very close to you and others are far away, but you want them all perfectly sharp, you also have to close the aperture, accordingly.  If you consider my comment #5 and include this option to the script, then the users will receive a warning (maybe three short beeps) and will know that in rare situations like these they will have to use a tripod to avoid camera shake.  In my opinion, there is nothing wrong about using a tripod when the script decides to use longer exposure times than the hand hold limits. The script will still provide its advantages also in such situations.

garry23

@IDA_ML

Didn't think you were criticising  :)

I wrote the script for my use but published it in case others wish to use/adapt it.

It's use case is hand holding, ie not tripod use.

If I'm on a tripod or similar, I'll use a different workflow, eg ML advanced bracketing, with or without ETTR first.

Cheers

Garry


garry23

@IDA_ML

Just tried the latest version on my 5D3 in LV and with LV off.

Both work as expected, after bracketing I can bracket again.

I personally use the script in non LV mode as I'm looking through the optical view finder and using my face as a stabiser. Also the script runs faster in non LV mode.

Cheers

Garry

ToniX

 >:( sorry,

unexpected impediments prevent me from using the camera for weeks now ..(bad focusing, unreliable color balancing, dim display(!?), slow pc  and so forth and I 'm so bored of all that.

600D - EFs18-55 ISII