Author Topic: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)  (Read 17655 times)

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
When shooting stills with tripod and thin depth of field, it would be nice to have the camera automatically shoot a couple of exposures with slightly different focus.

Possible implementation: Expand Focus->Stack focus menu to include a manual selection for "Number of Pictures". If it's "auto" use stack focus as it is, if it's set to a number take this amount, each with the focus changed to "Step Size". If a dev is in the mood, another option "Bracketing" would be nice to tell the camera in which direction to change the focus: "near", "far" or "both", the latter doing something like the traditional exposure bracketing around the original focus point.

EDIT: In general, I hope we'll see even more still shooting features, too, because imho that would expand the ml userbase significantly - mostly folks still seem to see ml as a video gimmick for one reason or another.

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #1 on: August 22, 2012, 01:42:59 PM »
How about a menu item equivalent to HDR bracketing called focus bracketing? With the following options in it:
- Number of shots
- Step size
- Delay (like in HDR)
- Sequence (like in HDR: +++, ---, 0 + - ++ --)

I think this can be done "easily"
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #2 on: August 22, 2012, 01:46:01 PM »
Should this replace focus stacking, or complement it?

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #3 on: August 22, 2012, 01:47:42 PM »
Good question, I'd say we can integrate the two options actually. A rack-controlled mode that works like it does now and a manual mode that works like the OP asked: i.e.

Mode 1 -> Automated
Number of shots: from rack focusing
Step size: customizable
Delay: customizable
Sequence: derived from rack focusing, not customizable

Mode 2 -> Manual
Number of shots: customizable
Step size: customizable
Delay: customizable
Sequence: customizable, like HDR bracketing
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #4 on: August 22, 2012, 02:00:39 PM »
For the impatient:

Code: [Select]
void run_test()
{
    msleep(2000);
    lens_take_picture(64, 0);
    while (!lv) msleep(20);
    while (!DISPLAY_IS_ON) msleep(20);
    LensFocus(1);
    lens_take_picture(64, 0);
    while (!lv) msleep(20);
    while (!DISPLAY_IS_ON) msleep(20);
    LensFocus(-2);
    lens_take_picture(64, 0);
    while (!lv) msleep(20);
    while (!DISPLAY_IS_ON) msleep(20);
    LensFocus(1);
}

and run it from "don't click me", with image review off :)

I think this is the fastest focus bracket possible with current knowledge.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #5 on: August 22, 2012, 03:57:11 PM »
For integrating the two modes, the sequence item could be used:

- "from Rack Focus"
- 0 + ++: focus from current point towards infinity
- 0 - --: focus from current point towards the camera (more "macro")
- 0 + -: that's what most people understand by bracketing, no?

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #6 on: August 23, 2012, 01:03:44 AM »
Good question, I'd say we can integrate the two options actually. A rack-controlled mode that works like it does now and a manual mode that works like the OP asked

Great you like the idea - and yes, do what the OP asked - hey wait, that was me :->

For integrating the two modes, the sequence item could be used:
- "from Rack Focus"
- 0 + ++: focus from current point towards infinity
- 0 - --: focus from current point towards the camera (more "macro")
- 0 + -: that's what most people understand by bracketing, no?

I wonder if the "0 + -" has any drawbacks because the lens keeps focusing more than necessary around the zero point if done like in exposure bracketing? If so, another option would be to zoom out, and then start to zoom in beyond the zero point.

Btw: If possible please implement a check if the lens has reached infinity or max. macro to prevent duplicate exposures.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #7 on: August 24, 2012, 09:54:00 AM »
First frame has to be at zero point (because it's taken by Canon firmware). We can't intercept the full shutter press yet (it's handled in another CPU, not in ARM).

The check for infinity or max macro should be already there, doesn't work in stack focus?


Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #8 on: August 24, 2012, 11:31:43 AM »
The check for infinity or max macro should be already there, doesn't work in stack focus?

Actually I don't think I ever tried, my focus stacks obviously never were up to 1:1 with its ridiculously thin depth of field - I just wrote that as an innocent reminder to implement this check in focus bracketing, too.

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #9 on: September 21, 2012, 03:43:57 PM »
It is a request from the Canon rumors forum, but I think it makes sense, too and should be easy to implement:

It was so easy I've just done it myself :-), working just fine. I'll test it a little and then upload it as a Mercurial pull request.

MatthewD

  • New to the forum
  • *
  • Posts: 7
  • Develop specialised lights to capture the iris
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #10 on: December 17, 2015, 02:06:27 PM »
Not sure if i should start a new thread...
I've been trying (unsuccessfully) to figure out how ML can do "Focus Bracketing" on my 70D.

I take macro photos of the iris (http://www.irislab.com/pages/iris-photos). It's a very difficult task to get the focus just right (The iris moves constantly, is sensitive to light, has a reflective quality, is spherical... to name just a few difficulties...).

Focus bracketing wish:
Without a tripod
step 1) half press : Autofocus
step 2) full press : snap photo "0"
step 3) keep the shutter btn pressed : ML automatically takes 2, 4, or 6 extra photos  -  (0,-,+  or  0,--,-,+,++)

It sounds like you guys are talk exactly about this... Please spare a couple of minutes to explain how to do this in the ML menu.
(I'll make youtube video when i figure out how)
Thank you

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8421
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #11 on: December 17, 2015, 03:07:37 PM »
Not exactly sure if we really need another focus bracketing/stacking workflow.

Premise: Eye size and therefore DOF and reproduction ratio are within known limits.
Why not use a preset for focus stacking and let the machine this routine:
0 pics in front
y pics behind
and step size/focus steps according to your needs?

Store it as config preset, use liveview focus peak to adjust start point. Now point and shoot.

MatthewD

  • New to the forum
  • *
  • Posts: 7
  • Develop specialised lights to capture the iris
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #12 on: December 17, 2015, 05:07:20 PM »
Hi Walter thank you for you swift reply.
Looking more closely i realise why i'm confused... some of focus features for the 70D are disabled at the current development stage.

This is best result with focus trap... manuel focus without ML (and lots of luck) gets better results... i will either wait or try to get my hands on different camera
Thank you



Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8421
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #13 on: December 17, 2015, 05:32:33 PM »
Just an idea (stolen, of course): Try using MLV recording in crop mode. Continuous recording is limited to about 720p25 but you should be able to get higher resolutions for shorter durations and - I hope - there will be enough sharp frames for stacking. Start recording and zoom in by moving cam forward.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2218
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #14 on: December 17, 2015, 07:08:17 PM »
I have been waiting for the Lua scripting to become accessible to me, as I have a workflow for landscape focus stacking, which completely different to macro ficus stacking.

What I do is switch of diffraction corrected DoF, must use a lens that reports duistance etc, and manually focus to the nearest 'slice' of focus. Note the far DoF distance and refocus the near DoF to this, i.e. so it slightly overlaps. Keep repeating until the far DoF is infinity.

It should be simple to write a script to do this, i.e. step the lens through the sequence.

The above is different to macro stacking, where you repeat the same focus increment each time.

As I say, I'm waiting to personally be able to use the Lua scripting engine.

MatthewD

  • New to the forum
  • *
  • Posts: 7
  • Develop specialised lights to capture the iris
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #15 on: December 17, 2015, 07:18:52 PM »
thanks for that.
I will have a play with that. If it works it will be nice to have a few very sharp shots...
However, this option is not easy to implement in a clinic setting with a patient present and waiting. The idea is to take a few photos and quickly get them onscreen to start analysis.

I'll try to buy a second hand 700D it may have ML nice and stable on that one. If there are any other cameras recommended that do the focus bracketing really well, keen to hear... Full frame cameras don't seem to add much (DOF not the best for Macro it seems), although haven't tried them with ML... (I'm currently testing the 5Ds, but doesn't add much so going to sell it)

Thank you guys for all the work and enthusiasm.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2218
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #16 on: December 17, 2015, 07:44:04 PM »
Matthew

I've written about my landscape stacking experiments, eg here: http://photography.grayheron.net/2015/05/magic-tweak.html

MatthewD

  • New to the forum
  • *
  • Posts: 7
  • Develop specialised lights to capture the iris
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #17 on: January 09, 2016, 03:18:40 PM »
Again many thanks Walter and Garry

After multiple tests (on 70D and a new 5Diii), still no success. :-(
It seems to me that a very simple "Focus Bracketing" with a basic and fast burst of "0,-,+" (with ability to set the number and distance between the steps) would be really beneficial...

My specific needs of capturing a persons iris make it impossible to have something that requires setting anything up, ie. tripod, setting the front and back frames... even Live View autofocus is too slow, as the subject is live and in constant movement, yet sensitive to bright light (More light is not an option, thus faster shutter and/or small aperture not possible).
It's a bit like taking a photo of a young fidgety child :-) ... Only something very quick and automatic ... click, click, click in less than a second.
I can think of so many other situations this feature could help get a sharper photo and save the day...

If it's technically too difficult to implement, does anyone know of a camera that has this ability?

EDIT: I'm aware of my low level of experience with ML and that maybe what i'm needing may be possible (if thats the case i'd be very grateful for some tips on how to do this...).
 thanks all you guys involved in making ML


Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8421
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #18 on: January 09, 2016, 03:35:25 PM »
Sorry, I don't get it.

Focus bracketing in macro dimensions will most likely interfere with diffraction blur. I don't use this method with macro and cannot recommend it.

You stress the point about not being able to use tripod or else. Why not? See this device:

Same for devices testing visual acuity.
What am I missing?

MatthewD

  • New to the forum
  • *
  • Posts: 7
  • Develop specialised lights to capture the iris
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #19 on: January 09, 2016, 04:36:46 PM »
:-)
The slip lamp (the above photo) is a little different, it most often is used to observe the anterior (or posterior part of the eye), often without photography (the price is also 5k-20k).
The light is also a strong "slit" thus a narrow focused line (less blinding)

(I'm not thinking of using the focus bracketing to do stacking)
The reason i believe the focus bracketing will work is that often a photo will be sharp (or even part of the photo is sharp... see the photo above of the iris, certain areas are sharper). The difference between sharp and not is fractions of a millimetre and in the short moment between autofocus and taking the photo there is often a slight shift in the distance. A compounding difficulty is that in some eyes the camera tends to focus on the "skin" (anterior surface) thus forcing the camera to take extra shots near the autofocus point would be able to catch the right focus distance.

Does the code you added in "Reply #4" do anything like what i'm describing? (if yes how can it be added to my ML)

(thanks for your enthusiasm)



LucasA

  • Just arrived
  • *
  • Posts: 1
Re: [DONE] focus bracketing (i.e. focus stacking w/o endpoint selection)
« Reply #20 on: January 13, 2016, 08:28:46 PM »
I'd also love this feature and would find it valuable to get more chances of having the sharpness in my photos exactly where I want it, especially for close up portraits where getting eyes in focus is critical. Also for macro wildlife. This sounds like a great addition....