supplierdeeply

Landscape focus bracketing without scripting

  • 22 Replies
  • 470 Views
Re: Landscape focus bracketing without scripting
« Reply #10 on: 01 / January / 2019, 14:56:08 »
Advertisements
reyalp

I thought you might say that so I’ve thought of a work around, but it would require a new DoF feedback field, called num_brackets_to_H. This can easily be estimated from (H/focus_pos + 1)/2. Thus, if this was added to the DoF feedback, the user would know how many brackets to dial into the custom timer, ie up to 10 is allowed on the G7x.

Sensibly, however, five brackets from the focus position, which must be less than H, should be enough to cover to H, plus 1 bracket at 2H.

In general the near DoF for the nth bracket, from H, is H/(2n). Thus five brackets covers from H/10 to H, plus our additional bracket at 2H.

Thus, with the additional user feedback, the user would set the custom timer to the correct number of brackets, ie H/focus_pos + 1)/2 + 1, and in CHDK, in the shooting_subject_distance_bracketing function, we could calculate the correct focus position, assuming (sic) that the user has set the number of brackets correctly.

I have worked out how to calculate the correct position, but, as I say, you need to know the number of brackets, or assume the user has requested the correct number on the Canon side.

As to triggering this, one was would a be to let the subj_dist_bracket be allowed to be -1. That is -1 triggers the landscape stacking option.

I know it’s a bit experimental, and some would say messy, but I would like to see it running on my g7X. But I am not a compiler of C, so would need to rely on others.

I could draft out some pseudo code to show my ideas.

What do you think?

Cheers

Garry

*

Offline reyalp

  • ******
  • 11670
Re: Landscape focus bracketing without scripting
« Reply #11 on: 01 / January / 2019, 16:39:47 »
I have worked out how to calculate the correct position, but, as I say, you need to know the number of brackets, or assume the user has requested the correct number on the Canon side.

As to triggering this, one was would a be to let the subj_dist_bracket be allowed to be -1. That is -1 triggers the landscape stacking option.

I know it’s a bit experimental, and some would say messy, but I would like to see it running on my g7X. But I am not a compiler of C, so would need to rely on others.
Rather than pseudocode, could you implement the basic logic in a Lua script?

That gives you an easy way to play with it without worrying about how it fits into the core code. As long as the required information is available to script, it should be fairly straightforward if you don't worry about making it fast / portable / foolproof initially. If some required information isn't available, you could hard code it initially.

Once it's demonstrated, we can see whether it it makes sense as a core feature or whether it's better to just leave it as script. If it's better as a script, we can help finish it off or provide additional information needed from C code.

Don't forget what the H stands for.

Re: Landscape focus bracketing without scripting
« Reply #12 on: 01 / January / 2019, 16:49:24 »
Great minds think a like. That was where I was going.

I’ll play around and report.

Thanks for your support and encouragement.

Cheers

Garry

Re: Landscape focus bracketing without scripting
« Reply #13 on: 02 / January / 2019, 13:09:10 »

OK Worked it out :-)
Confused by Lua vs Basic ;-)

ReyalpIt was not my intention to waste your time with my Lua experiments, as I know Lua and I thought I understood the CHDK environment. Clearly I dont.
This simple test script throws up an error about global variable h, which I don't understand. BTW I have to debug by looking at the flash messages on the camera :-(
I'm sure this script would run in the ML environment.
Can you help get me back on track ;-)
Cheers
Garry

Code: [Select]
--[[
@title Landscape Bracketing
@chdk_version 1.3
--]]

-- main
sleep(3000) -- delay
h = get_hyp_dist
x = get_focus()
x_start = x
repeat
    shoot()
    x = x*h/(h - 2*x) -- next focus position
    set_focus(x)       
    sleep(2000)
until ( get_near_limit > h/2 )

print("...done")

exit_alt()

« Last Edit: 02 / January / 2019, 14:22:24 by pigeonhill »


*

Online msl

  • *****
  • 1243
  • A720 IS, SX220 HS 1.01a
    • CHDK inside
Re: Landscape focus bracketing without scripting
« Reply #14 on: 02 / January / 2019, 14:56:41 »
Your script is a mix of uBASIC and lua. This is not going to work. There is a complex dof command for lua. => https://chdk.wikia.com/wiki/Script_commands#get_dofinfo

Try this:
Code: [Select]
dof=get_dofinfo()
...
x = dof.hyp_dist
...
until ( dof.near > h/2 )

msl
German CHDK pages:  CHDK forum | CHDK Twitter News by msl | Download CHDK-DE (Autobuild)
Note: SDM violates the GPL rules!

Re: Landscape focus bracketing without scripting
« Reply #15 on: 02 / January / 2019, 15:00:19 »
@msl

Fully understood and sorted out my my silly mistake by myself.
I corrected the test script and all working as expected :-)
Thanks for the input.
Cheers
Garry

Re: Landscape focus bracketing without scripting
« Reply #16 on: 02 / January / 2019, 16:53:13 »
Arrived at a sensible place to seek out more help ;-)

My Landscape Bracketing Script (LBS) is running at a proof of principle level.

The script assumes you are starting (focus) bracketing from the nearest point of interest in your scene.

The user can request (dark image) 'bookends', which helps you identify the image sequence in post.

The script will not run if the initial focus is greater than the hyperfocal.

The script will take as many brackets as required to cover from the near image to the image just short of the hyperfocal. It will then take an image at the hyperfocal and one at twice the hyperfocal, ie to get more of the background in better focus that the 'just' taking an image at the hyperfocal.

The focus bracketing in front of the hyperfocal is correct, ie you can not use equally spaced backts when landscape bracketing, as you can with macro focus bracketing.

The test image, which includes our cat Polly, was taken at F/4, ie so not to push the diffraction blur too high. The script took four images before the hyperfocal, one at the hyperfocal and one at twice H.

The post processing was done in Helicon Focus.

As I say, this is just a roof of principle and I intend to add more functionality and error checking.

One matter I could get help on is to answer this question: why does the script show up when I go to Alt mode. None of the other scripts in that folder show up, just mine.

Here is the basic script:

Code: [Select]
--[[
@title Landscape Bracketing
@chdk_version 1.3

@param c Script Delay (s)
    @default c 3
    @range   c 0 5

@param b Bookends?
    @default b 0
    @values  b Yes No
--]]

s_delay = 1000
sleep(c*1000)
dof = get_dofinfo()
h = dof.hyp_dist
x = get_focus()
x_start = x
s=get_tv96()
if x < h then
    if b == 0 then
        set_tv96(960)
        shoot()
        set_tv96(s)
    end
    while ( 2*x < h)
    do
        shoot()
        x = x*h/(h - 2*x) -- next focus position
        set_focus(x)       
        sleep(s_delay)
        dof = get_dofinfo()
    end

    set_focus(h)
    sleep(s_delay)
    shoot()

    set_focus(2*h)
    sleep(s_delay)
    shoot()

    if b == 0 then
        set_tv96(960)
        shoot()
        set_tv96(s)
    end
end

set_focus(x_start)

print("...done")

exit_alt()



PS how do you get line spaces in the post, without putting in two LRs >:( 
« Last Edit: 02 / January / 2019, 17:11:49 by pigeonhill »

*

Offline reyalp

  • ******
  • 11670
Re: Landscape focus bracketing without scripting
« Reply #17 on: 02 / January / 2019, 17:21:30 »
My Landscape Bracketing Script (LBS) is running at a proof of principle level.
Nice, glad you got it working.
Quote
One matter I could get help on is to answer this question: why dos the script show up when I go to Alt mode. None of the other scripts in that folder show up, just mine.
If I understood correctly, this is normal CHDK behavior:
In CHDK, there is always one "currently selected" script, which shows in the alt indicator. That tells you what script will run when you press the shutter in alt mode. To run a different script, you must select it using the script menu.

Quote
PS how do you get line spaces in the post  >:(
You can turn off the WYSIWYG mode (pointer in [ ] icon or permanently in forum profile, "look and layout" turn off "Show WYSIWYG editor on post page by default".)

Some script development tips, FWIWI:
If you miss the error message, you can go to misc->show last console.

I like to use chdkptp (https://app.assembla.com/spaces/chdkptp/wiki) for script development. This allows you to run snippets of code interactively, and also to upload files or run files directly without rebooting or swapping the card around.

msl and rudi made https://chdk.wikia.com/wiki/Execute_Lua_scripts_with_hostlua_%26_notepad%2B%2B which includes chdkptp along with some other tools.
Don't forget what the H stands for.


Re: Landscape focus bracketing without scripting
« Reply #18 on: 03 / January / 2019, 01:11:23 »
Reyalp

Ok, I understand what you say, i.e. "In CHDK, there is always one "currently selected" script, which shows in the alt indicator.", but is there a way to select the scriot that shows.

I don't understand why my script shows up.

Cheers

Garry

*

Offline reyalp

  • ******
  • 11670
Re: Landscape focus bracketing without scripting
« Reply #19 on: 03 / January / 2019, 02:06:51 »
I don't understand why my script shows up.
It's the script you selected in the script menu. You access the script menu with SET in alt mode. This lets you select the script ("Load script from file") and set the options for that script.

If you select a different script in the menu, do you not see the name in alt mode?

If this doesn't make sense, maybe I misunderstood what you are asking and a screenshot would help.
Don't forget what the H stands for.

 

Related Topics