[DONE - lens.focus updated] Lua Request/Idea

Started by garry23, June 18, 2016, 05:53:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

a1ex

Hm... maybe lv.wait(5) or adding some small delay after that?

(I'm not able to try it myself right now)

garry23

@A1ex

I tried this, but no luck:

while not lv.running do msleep(100) end
lv.wait(5)
msleep(200)


where as this approach to delaying works:

repeat -- until lens is ready to continue
err = lens.focus(-1,1,false)
msleep(1000)
until err
err = lens.focus(1,1,false)



BBA

@garry23

to report my trial (If you have spare time, as working on a way to detect "camera.shoot's" end is also very important, for all of us! )

I just tried your new full script (which is user friendly  :)  thanks for sharing ! ) : I have only used the stack focusing, Ev bracketing and bookend (which I think useful) capabilities.
In landscape conditions (going from a few meters to, maybe, a few hundreds of meters range), with FP2INF, and starting with a blurred image towards macro end.
2 brackets of 2 images were taken but the focus point did not move enough to deblur the pictures.

Bottom line : I think it should have taken more brackets towards infinity end.
It seems everything else went fine and fast :  the message "script finished" + beeps at the end.

garry23

@BBA

Have you got the ML depth of field settings at their optimum, ie diffraction aware is on.

I don't understand what you are saying, as if the lens moves from the FP to INF or MAC, a full set of correctly overlapping focus stacks will be taken.

All you need to do then is post process: I use Helicon Focus.

BTW there is some interesting reading here: http://www.georgedouvos.com/douvos/Image_Sharpness_vs_Aperture.html

BBA

@garry23

Maybe I missed something. I can't check for now, I'll retry later.

Thanks !

a1ex

Those graphs are very interesting. I'd definitely like to have an option to display them in ML.

garry23

@BBA

what camera are you using. As I say, my script works on my 5D3.

@A1ex

The DoF equations that I originally put into ML, that you optimised, and my script, achieves what the last curve in the URL implies, ie an optimised focus bracket set, ready for post processing.


garry23

@BBA

Forgot to add the number of focus bracket required to get from, say, macro end to INF is very dependent on FL and aperture.

On a wide angle lens at say F/11 you wont need many.

The secret is to select the optimum aperture for IQ.

a1ex

Quote from: garry23 on July 03, 2016, 06:06:52 PM
The DoF equations that I originally put into ML, that you optimised, and my script, achieves what the last curve in the URL implies, ie an optimised focus bracket set, ready for post processing.

I know that. What I meant was to show these graphs on the camera screen, since they convey a lot more information about the depth of field than the current method (focus distance and far/near limits).

BBA

@garry23

I have checked: diffraction-aware = ON; It is correct
I have a 5D3.
Aperture number is 5.6. Focal length = 200 mm
Believe me the problem is not there : the picture is heavily blurred because the lens barrel is turned to focus near macro end.

The FP should move towards infinity thanks to the script.

Quote
as if the lens moves from the FP to INF

This is the problem, I am afraid  >:( 
downloaded the script again (version 3 "Auto Bracketing.lua") to be sure...

Tried 5 times
Maybe it works on your camera but not on mine ?????
I feel sorry to have to report bad news...

garry23

@A1ex

I know what you are saying, however, once the user has a specified CoC, I'm not sure seeing the curve is that useful.

I use the following simple formula to estimate the required blur circle in microns:

Blur Spot (microns) = (C x M) / (P x L)

Where C is the size of the (cropped) image on the sensor; M is the distance ratio compared to a 'normal' 10in viewing distance, ie if you intend to view at, say, 24 inches away, M would be 2.4; P is the print size; and L is the number of line pairs per mm that you are using as your 'eye sight' criterion (typically between 5 to 8). Note you should keep C and P in the same units, eg mm or in or whatever.

As an example, let's assume we are looking to create a 16 x 20 in (ie about 500mm wide) print, that will be seen in a gallery (so we will use 8 lp/mm) at the closest viewing distance of, say, 24in, and that our image is taken from a slightly cropped area of our full frame image, with a cropped (sensor) dimension of about 30mm (out of the 36mm total sensor width).

The suggested blur spot may be estimated as: 30 x 2.4 / (500 x 8) = 0.018mm (18 microns).

Obviously this is much smaller than is suggested by the generic web number, ie some 29 microns. By the way, the 29 micron (generic number) may now be seen as indicative of 5 lp/mm viewed at 10in; in other words the web-based advice is at the lower end of our acceptable sharpness and eye sight. In other words, OK for snaps and blogs, but maybe not judges!

garry23

@BBA

I think I know what is going on: I just tried my 70-200 F/4L at 200.

If you start at the full macro end the DoF near and far are so close to each other, the script can't handle it.

If you move off the macro and increase aperture to, say, F/11, the script runs fine. BUT, and it is a big but, you will end up taking a hell of a lot of images.

Bottom line: at long FLs, focus stacking will be problematic. Just be aware of this and adjust accordingly, ie move focus away from the full macro end, increase aperture to the optimum for stacking, and reduce FL if you can.

BBA

@garry23

I'll leave it quiet for now.

Thanks again for your informations about focusing, you seem to know a lot on this subject.

garry23

@BBA

I thought I would add in a little helper to my script : You can download this version here: https://gist.github.com/pigeonhill/6620121ebe1548eb1bdaa6bea8598fac

This version estimates (sic) the number of focus brackets that will be taken from the FP to the hyperfocal point and shows this number in the menu.

It dynamically updates in the menu, so you can see the impact of FL.

For example put the focus near the macro end and change the focal length. You will be surprised! At 200mm F/5.6 you will need some 110 brackets!!!

In other words, use focus bracketing with WA lenses.

BTW my delay algorithm is a bit flaky at the macro end: I'll be trying to make it more robust  :)

garry23

@BBA

Off to the dentist now  :(

Here is the latest, most stable version of my script: https://gist.github.com/pigeonhill/6620121ebe1548eb1bdaa6bea8598fac

BTW I found a 'trick' to test if the lens is ready:


local err = false
repeat
err = lens.focus(0,1,false)
msleep(1000)
until err


I would welcome any further testing of my script by you: but watch those long lenses. Best use WA lenses.

BBA

@garry23

Wow ! Your trick is genial   :) !
It doesn't require a lens move => seems perfect.

(Side note : I don't know if camera.shoot doesn't return something undocumented too ???)

I love the idea of "estimating" the number of focus brackets beforehand  :) ; I'll test it for sure and report to you.

I have many questions on focusing and it's use in your script, but I have a hard time writing them...  :-\ :

- I would love to see equations of focal point, near focus, far focus where diffraction is taken into account ?

- do you know the (approximate) formula of the focal point distance in function of the rotation of the focus barrel ; this is important in the near infinity range even if it is approximate. Or, do you have another idea of what could be done in that range. My concern is that it is no more possible to "interpolate" with "infinity"  ???... we have to extrapolate as correctly as possible... The variation of the focal distance becomes more and more important and less and less precise for one single step move: the "near focus" is the only variable that remains "finite" and tends to hyperfocal/2 ? Have others found an (obviously incomplete) answer to this question ?

- I will try if the number of brackets estimated is (approximately) what actually occurs (it's fair, isn't it  ;) )

- this one... : if I use AF and focus on an object, do you think the exact lens focusing point can lie between two stepping motor positions ? In other words, the AF can be more precise than the discrete nature of a stepping motor which,  say with lens.focus(1,1),  will go from one position to the next but cannot go in between (the first argument is an integer, not a real number (evident)). Or in other words, is lens.focus(1,1) the smallest step achievable by the lens focusing mechanism ? (I know it is Canon expertise but we can have ideas on the subject: phase focusing loop/ nowadays, everything is digital,...)   

- the same question arises with manual focus as the manual move is "analogical" rather than digital, or is it converted anyway into digital move ? (It depends on the lens but for new L lenses, for instance)

:-[
 

BBA

@garry23

First report on V3 R1.25 :

My yesterday concerns (number of brackets taken) are gone  :) , I chose to try in the same conditions with the same long lens at 200 mm.

I have seen the number of brackets updating when turning the lens : I think it is very useful for beginners.

It is not useful to start when the whole picture is blurry as those pictures will have to be thrown away. Even further, those unnecessary picture may leave unwanted side effects : the perimeter of light sources, of greater diameter because they are out of focus, may remain visible in the stack focus processing result for instance.   

I have to test further but I needed to tell you that.

Quote from: BBA on July 03, 2016, 05:06:36 PM
@garry23

to report my trial (If you have spare time, as working on a way to detect "camera.shoot's" end is also very important, for all of us! )

I just tried your new full script (which is user friendly  :)  thanks for sharing ! ) : I have only used the stack focusing, Ev bracketing and bookend (which I think useful) capabilities.
In landscape conditions (going from a few meters to, maybe, a few hundreds of meters range), with FP2INF, and starting with a blurred image towards macro end.
2 brackets of 2 images were taken but the focus point did not move enough to deblur the pictures.

Bottom line : I think it should have taken more brackets towards infinity end.
It seems everything else went fine and fast :  the message "script finished" + beeps at the end.


garry23

@BBA

Thanks for all your testing.

BTW here is a short piece I wrote a while ago on DoF equations: http://photography.grayheron.net/2015/04/customising-magic-lantern.html

The key thing to note is the far DoF is much greater than the near. Unlike macro which is symmetric.

As for how many images you need. In theory once you focus at the hyperfocal distance, for the criteria you have selected, eg blur spot (or CoC), you are there. However, most would say also grab an image at 'infinity'. Thus I decided to stop bracketing at infinity, not the HFD.

As for workflow, I suggest you have three options (which I use):

Option A: Put the lens at infinity or macro and let the script grab the brackets to achieve a full set of focus brackets.
Option B: Focus on the nearest object and let the script grab the images to infinity;
Option C: Focus on the furthest object and let the script grab the images to the macro soft stop

In all cases note the number of focus brackets required in the menu feedback when focused at the macro. Also, focus bracketing a full set with a long lens is not the best use of the script, eg you will end up with too many brackets and there is a trade off with time, ie wind and clouds moving.

My experience is, up to 6 is about the limit; but it is your choice.

Bottom line: my script, using the diffraction corrected DoFs is about the best landscape (not macro) focus bracketing you can do: IMHO  ;)

BTW you can't get simpler than this - no lens movement: or can you  ;)


repeat
msleep(1000)
until lens.focus(0,1,false)


Not sure if msleep(1000) is 'optimum'


garry23

@BBA

And so to bed, after some cleaning up and error checking added: https://gist.github.com/pigeonhill/6620121ebe1548eb1bdaa6bea8598fac

garry23