--[[ @title Kurventest 2.0 by CHDKLover ]] curve_file_name="A/CHDK/CURVES/curve_test.ctc" curves={} curves.red={} curves.red.r ={0,0, 302,648, 1023,1023} curves.red.g1={0,0, 878,671, 1023,1023} curves.red.g2={0,0, 878,671, 1023,1023} curves.red.b ={0,0, 878,671, 1023,1023} curves.green1={} curves.green1.r ={0,0, 878,671, 1023,1023} curves.green1.g1={0,0, 302,648, 1023,1023} curves.green1.g2={0,0, 878,671, 1023,1023} curves.green1.b ={0,0, 878,671, 1023,1023} curves.green2={} curves.green2.r ={0,0, 878,671, 1023,1023} curves.green2.g1={0,0, 878,671, 1023,1023} curves.green2.g2={0,0, 302,648, 1023,1023} curves.green2.b ={0,0, 878,671, 1023,1023} curves.blue={} curves.blue.r ={0,0, 878,671, 1023,1023} curves.blue.g1={0,0, 878,671, 1023,1023} curves.blue.g2={0,0, 878,671, 1023,1023} curves.blue.b ={0,0, 302,648, 1023,1023} curves.ev1={} curves.ev1.r ={0,0, 512,1023, 1023,1023} curves.ev1.g1={0,0, 512,1023, 1023,1023} curves.ev1.g2={0,0, 512,1023, 1023,1023} curves.ev1.b ={0,0, 512,1023, 1023,1023} curves.ev2={} curves.ev2.r ={0,0, 256,1023, 1023,1023} curves.ev2.g1={0,0, 256,1023, 1023,1023} curves.ev2.g2={0,0, 256,1023, 1023,1023} curves.ev2.b ={0,0, 256,1023, 1023,1023} curves.ev3={} curves.ev3.r ={0,0, 128,1023, 1023,1023} curves.ev3.g1={0,0, 128,1023, 1023,1023} curves.ev3.g2={0,0, 128,1023, 1023,1023} curves.ev3.b ={0,0, 128,1023, 1023,1023} function log(...) io.write(...) io.write("\n") end function existFile(name) local ret=false local f=io.open(name,"r") if f~=nil then ret=true f:close() end return ret end function restore() if raw_state~=nil then set_raw(raw_state) end if curve_state~=nil and curve_interp_mode~=nil and curve_type~=nil then set_curve_state(curve_state,curve_interp_mode,curve_type) end if curve_file~=nil then set_curve_file(curve_file) end if existFile(curve_file_name) then os.remove(curve_file_name) end end function createCurve(name) local fdest=io.open(curve_file_name,"w") function writeValue(value,value2) if((value%2)==0) then fdest:write(value2.."\n") else fdest:write(value2..",") end end fdest:write("4\n") fdest:write((#(curves.red.r)/2).."\n") table.foreach(curves[akt_curve].r,writeValue) fdest:write((#(curves.red.g1)/2).."\n") table.foreach(curves[akt_curve].g1,writeValue) fdest:write((#(curves.red.g2)/2).."\n") table.foreach(curves[akt_curve].g2,writeValue) fdest:write((#(curves.red.b)/2).."\n") table.foreach(curves[akt_curve].b,writeValue) fdest:close() end function fastshoot() press("shoot_half") repeat sleep(1) until get_shooting() == true press("shoot_full") release("shoot_full") release("shoot_half") time_start = get_tick_count() repeat sleep(1) until get_shooting() ~= true time_end = get_tick_count() print("Erstellungszeit =", (time_end-time_start).."ms") log("Erstellungszeit = "..(time_end-time_start).."ms") end function getImageDirs() local dcimList = os.listdir("A/DCIM", false) local i=1 local j if(dcimList) then table.sort(dcimList) local count=#dcimList for j=1,count do if string.upper(string.sub(dcimList[i],4))~="CANON" then table.remove(dcimList,i) else i=i+1 end end end return dcimList end function getLastRAW() local ret=nil local dcimList = getImageDirs() local dirCount = table.getn(dcimList) local i local a local s for i=1,dirCount do local imgDirList = os.listdir("A/DCIM/"..dcimList[i], false) local imgCount = table.getn(imgDirList) table.sort(imgDirList) for a=1,imgCount do s=string.sub(string.upper("A/DCIM/"..dcimList[i].."/"..imgDirList[a]),-3) if(s=="CRW" or s=="CR2") then ret="A/DCIM/"..dcimList[i].."/"..imgDirList[a] end end end return ret end --interpol_mode: 0=Auto, 1=Spline, 2=Linear --curve_type: 0=Auto, 1=RGB, 2=LUM function doTest(interpol_mode,curve_type) akt_curve=next(curves,nil) while(akt_curve~=nil) do print("Test:",akt_curve) log("Test:",akt_curve) createCurve(akt_curve) set_raw_develop(raw) set_curve_state(1,interpol_mode,curve_type) fastshoot() akt_curve=next(curves,akt_curve) end end --MAIN log_path = "A/CHDK/LOGS/" log_file_name = "curve.log" log_name = log_path..log_file_name logfile=io.open(log_name,"wb") io.output(logfile) raw_state=get_raw() curve_state,curve_interp_mode,curve_type=get_curve_state() curve_file=get_curve_file() set_curve_state(0) set_raw(1) sleep (100) fastshoot() sleep (100) set_raw(0) sleep (100) raw=getLastRAW() if(raw~=nil) then print(raw) log("verwendete RAW-Datei: "..raw) set_curve_file(curve_file_name); doTest(1,2) --Spline, LCurve doTest(2,1) --Linear, RGB else print("Skriptfehler: DNG deaktivieren, RAW Endung auf CRW oder CR2 stellen") end restore()