S100 DOF stacking pictures - Completed and Working Scripts - CHDK Forum

S100 DOF stacking pictures

  • 8 Replies
  • 7036 Views
S100 DOF stacking pictures
« on: 14 / March / 2013, 19:37:51 »
Advertisements
Anyone has a (for macro) stacking script optimized for S100. I tried some different scripts , what i´ve found, but it was not the result what i hope.

many thanks for help
« Last Edit: 14 / March / 2013, 19:39:29 by DigiFan »

Re: S100 DOF stacking pictures
« Reply #1 on: 14 / March / 2013, 20:23:19 »
I would tend to agree that the two listed on the scripting page are pretty much useless if you don't have the camera the authors used.

http://chdk.wikia.com/wiki/UBASIC/Scripts:_macro_DOFstacker
http://chdk.wikia.com/wiki/UBASIC/Scripts:_yet_another_DOF_stacker

If nobody else posts something better,  I'll add it to my list to do a "universal" stacking script that will work on any CHDK camera.  Might take me a week or so to get to it though.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: S100 DOF stacking pictures
« Reply #2 on: 15 / March / 2013, 18:39:29 »
thanks for the answer,

i will try these 2 scripts and will write what i get as result or maybe "error messages"
maybe it will help to make better :)

i was thinking as i tried some scripts, that it is possible to set (M) mode; MF ;then to start the script
then to set (start macro point) -> (now i correct the end of the object by MF)-> now set on script this is my end point.

ok, i will test as first these 2 scripts and give a feedback
« Last Edit: 15 / March / 2013, 18:44:37 by DigiFan »

Re: S100 DOF stacking pictures
« Reply #3 on: 15 / March / 2013, 19:33:14 »
ok, i will test as first these 2 scripts and give a feedback
Here's the script from the second link ( http://chdk.wikia.com/wiki/UBASIC/Scripts:_yet_another_DOF_stacker ) with the propset values changed to propset4 for the S100 :
Code: [Select]
@title yet another DOF stacker - propset4
@param a move DOF
@default a 3
@param b by (a/b)
@default b 5
@param e take n shots/step
@default e 1
@param g delay 1st shot (sec)
@default g 5
@param j HYP checking
@default j 1
@param o max gaps in DOF
@default o 0

rem S(hooting in progress-propcase):
rem for Propset4 : 210
S=210

rem D(rive mode -property case) - Propset4 : 102
D=102

rem C(ontinuous-value for drive mode)
C=1

if a<1 then a=1
if b<1 then b=2
if e<1 then e=1
if g<1 then g=5
if (j<0 or j>1) then j=1
if o<0 then o=0
G=0

if e>1 then
  if (get_prop D)<>C then
    print "set drive mode"
    print "to continuous"
    goto "the_end"
  endif
endif

f=get_focus

print "-set M/Av"
print "-set focus"
print "-set MF"
print "-zoom_out for nearest"
print "-zoom_in for inf"


wait_click
cls
print "-menu continues"
print "-set MF"
print "-zoom_out for nearest"
print "-zoom_in for inf"

do
if is_pressed "shoot_half" then gosub "press_release_shoot_half"
if is_pressed "left" then gosub "press_release_left"
if is_pressed "down" then gosub "press_release_down"
if is_pressed "right" then gosub "press_release_right"
if is_pressed "up" then gosub "press_release_up"
if is_pressed "set" then gosub "press_release_set"
if is_pressed "macro" then gosub "press_release_macro"
if is_pressed "mf" then gosub "press_release_mf"
if is_pressed "flash" then gosub "press_release_flash"
if is_pressed "erase" then gosub "press_release_erase"
if is_pressed "zoom_in" then goto "set_inf"
if is_pressed "zoom_out" then goto "set_near"
if is_pressed "menu" then goto "theotherside_set"
until 1<0


:set_inf
set_focus 65535
goto "theotherside_set"

:set_near
  rem smallest focus value for A710 is actually 59, what about A6x0 and S3?
set_focus 55

:theotherside_set
cls
for t=0 to g-1
print "waiting", (g-t) "sec"
sleep 930
next t
cls
l=get_focus
if f<l then goto "order_ok"
t=f
f=l
l=t
:order_ok
set_focus f
t=f

:loop_shoot
  rem last shot @ defined focus
if t>=l then goto "shoot_last"
gosub "sub_shoot_count"
  rem no need for additional shots, if last was beyond HYP
if (f>=h and j=1) then goto "beyond_hyp"
  rem new focus @ current_DOF*a/b
m=d*a/b
  rem better move new focus at least a bit
if m<1 then m=1
i=f
t=(f+m)
set_focus t
f=get_focus
if f=t then goto "loop_shoot"
  rem if you don't use review, you can (don't have to) rem the following line (used to cancel review)
click "shoot_half"
  rem if focus didn't move at all/is wrong, move it with right&left
:loop_inc
if f>t then goto "loop_dec"
if f=t then goto "loop_shoot"
click "right"
f=get_focus
goto "loop_inc"
:loop_dec
if f<=t then goto "loop_shoot"
u=get_focus
click "left"
f=get_focus
  rem if wasn't able to move focus
if (f<=i and o=0) then goto "didnt_focus"
if (f<=i and o>0) then
if (G>=o or u<=i) then goto "didnt_focus"
G=G+1
print "gap in DOF (" G " of max. " o ")"
set_focus u
goto "loop_shoot"
endif
goto "loop_dec"

:didnt_focus
print "ERROR:"
if G>0 then print "possible gaps: " G ","
print "couldn't shoot"
print "gapless DOF"
goto "the_end"

:beyond_hyp
if G>0 then print "possible gaps: " G "," else print "all OK:"
print "last shot(s)"
print "beyond HYP"
goto "the_end"

:shoot_last
print "shoot_last"
set_focus l
gosub "sub_shoot_count"
if G>0 then print "possible gaps: " G "," else print "all OK:"
print "last shot(s)"
print "@ defined location"

:the_end

end

:sub_shoot_count
C=get_exp_count
press "shoot_half"
press "shoot_full"
do
until (get_exp_count-C)>=e
d=get_dof
h=get_hyp_dist
release "shoot_full"
do
until get_shooting=0
return

:press_release_shoot_half
press "shoot_half"
while is_pressed "shoot_half"
if is_pressed "down" then gosub "press_release_down"
if is_pressed "mf" then gosub "press_release_mf"
if is_pressed "macro" then gosub "press_release_macro"
wend
release "shoot_half"
return

:press_release_left
press "left"
do
until is_pressed "left" = 0
release "left"
return

:press_release_right
press "right"
do
until is_pressed "right" = 0
release "right"
return

:press_release_up
press "up"
do
until is_pressed "up" = 0
release "up"
return

:press_release_down
press "down"
do
until is_pressed "down" = 0
release "down"
return

:press_release_set
press "set"
do
until is_pressed "set" = 0
release "set"
return

:press_release_erase
press "erase"
do
until is_pressed "erase" = 0
release "erase"
return

:press_release_macro
press "macro"
do
until is_pressed "macro" = 0
release "macro"
return

:press_release_mf
press "mf"
do
until is_pressed "mf" = 0
release "mf"
return

:press_release_flash
press "flash"
do
until is_pressed "flash" = 0
release "flash"
return

You will probably want to read and understand the instructions at that link.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: S100 DOF stacking pictures
« Reply #4 on: 17 / March / 2013, 12:42:16 »
Thanks @waterwings

i've tried the script "yet_another_DOF_stacker" with your changes, but the result is not correctly
after searching i've found a script named "fokus-reihen-dofinfo.lua"
http://forum.chdk-treff.de/viewtopic.php?f=7&t=2510
if script is started u can choos focus begin, focus start and then pressing "set"  sometimes it runs great, but sometime u will get the info ( it will make for example 14 pictures ) but runs, make 2 different and one unsharp photo. my question: " must something changed (on script) for using on S100" ?


thanks in advance

Re: S100 DOF stacking pictures
« Reply #5 on: 17 / March / 2013, 13:46:44 »
i've tried the script "yet_another_DOF_stacker" with your changes, but the result is not correctly
Sorry - when I looked at the script a second time I noticed more things that would not work on your S100.  I should have posted that as they are not easy to fix.

Quote
after searching i've found a script named "fokus-reihen-dofinfo.lua"
http://forum.chdk-treff.de/viewtopic.php?f=7&t=2510
if script is started u can choos focus begin, focus start and then pressing "set"  sometimes it runs great, but sometime u will get the info ( it will make for example 14 pictures ) but runs, make 2 different and one unsharp photo. my question: " must something changed (on script) for using on S100" ?
There are two scripts at the link you posted.  The first should run on any camera.  The second uses key click to control the camera.  There probably need to be changed for the S100 (or any camera other than the one the script was written for).   

The first script looks like this with a bit of cleanup  :
Code: [Select]
--[[
@title Focus-Stacker-LUA
]]
 
set_console_layout(1, 0, 45, 12)
press( "shoot_half" )
repeat
    sleep(50)
until get_shooting() == true

e = get_dofinfo()
f = e.focal_length/100
q = 65535
n = ((e.hyp_dist/(2*e.focus)-e.hyp_dist/(2*q))*e.focus)/((10*e.focus-f)/10)+1

release("shoot_half")
repeat
    sleep(50)
until get_shooting() == false

print ( "Start focus: " ..  e.focus )
print ( "Photos: " ..  n+1 .. ", F" .. e.aperture/1000 .. ", " .. e.focal_length/1000 .. "mm" )
print ( " " )
sleep (1000)
print ( "Focus " .. "Target Focus " ..  "DoF-Target" )

shoot ()

for i=1,n do
    h = e.focus+e.dof
    p = e.dof
    focus = e.focus
    if h > e.focus then
      set_focus (h)
      shoot ()
    end
    e = get_dofinfo()
    focusdiff = e.focus-focus
    if i==n and e.focus_valid==false then
      set_focus (65535)
      shoot ()
      e = get_dofinfo()
      print ( "" .. focus .. "  " .. h .. "-".. e.focus .. "  " .. p .. "-" .. focusdiff )
    end
    print ( "" .. focus .. "  " .. h .. "-".. e.focus .. "  " .. p .. "-" .. focusdiff )
end


I'll take a look at the second one when I get a few minutes.


« Last Edit: 17 / March / 2013, 13:50:53 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: S100 DOF stacking pictures
« Reply #6 on: 17 / March / 2013, 14:03:38 »
Looking at all these script, with fancy hyperfocal and depth of field calculations,  I can't help but wonder if it would not be easier to just write a simple script with user defined parameters to set the initial focus (in mm),  the size of each focus step and the number of steps ?   

I have not used focus stacking software on my PC (yet) so I'm not really sure what the requirements are for the pictures used to create the stack. Feedback on that would be welcome.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: S100 DOF stacking pictures
« Reply #7 on: 05 / May / 2013, 07:15:48 »
hi,

i've checked these script's, but it is not so the result what i would have.

another question (digital zoom) - on S100 is the max. 20x
possible to expand that digital zoom with chdk ?

thanks for answers


Re: S100 DOF stacking pictures
« Reply #8 on: 05 / May / 2013, 10:54:25 »
i've checked these script's, but it is not so the result what i would have.
What result would you like to have?

Quote
another question (digital zoom) - on S100 is the max. 20x
possible to expand that digital zoom with chdk ?
No
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics