lua commands to get/set ISO and zoom - LUA Scripting - CHDK Forum

lua commands to get/set ISO and zoom

  • 8 Replies
  • 8716 Views
lua commands to get/set ISO and zoom
« on: 19 / June / 2010, 00:11:29 »
Advertisements
What are the lua commands to get/set ISO and zoom?

*

Offline fe50

  • ******
  • 3147
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: lua commands to get/set ISO and zoom
« Reply #1 on: 19 / June / 2010, 02:56:17 »
What are the lua commands to get/set ISO and zoom?
Most commands are the same in uBasic & in Lua;

--> http://chdk.wikia.com/wiki/UBASIC/TutorialScratchpad

Re: lua commands to get/set ISO and zoom
« Reply #2 on: 19 / June / 2010, 03:28:00 »
get_iso() doesn't work. Does get_sv96() return some representation of the ISO? I don't need to understand the value it returns, I just need to be able to initialize the camera to the same settings every time I run my script.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: lua commands to get/set ISO and zoom
« Reply #3 on: 19 / June / 2010, 07:35:19 »
get/set_iso() are not available for lua.

You can use get/set_iso_mode for market ISO values (-1=HiISO, 0=Auto, 1=80 (50), 2=100, 3=200 a.s.o.).

Or you use commands for the real ISO values: get/set_iso_real(). set_iso_real() has the same function as the overrides in CHDK menu.

cu msl

CHDK-DE:  CHDK-DE links


*

Offline reyalp

  • ******
  • 14082
Re: lua commands to get/set ISO and zoom
« Reply #4 on: 19 / June / 2010, 21:11:30 »
Or you can use propcases, which will be platform independent if you use propcase.lua
Don't forget what the H stands for.

*

Offline lapser

  • *****
  • 1093
Re: lua commands to get/set ISO and zoom
« Reply #5 on: 30 / September / 2012, 01:45:30 »
Or you can use propcases, which will be platform independent if you use propcase.lua
Can you tell me how to set SV96 with propcases? That is, which propcases and what values to put in them?

I found 4 of them related to SV:

DELTA_SV=79,
ISO_MODE=149,
SV_MARKET=250,
SV=347,

I tried putting the SV96 value into propcase SV, but it didn't change the exposure (it did change the EXIF values in the jpg). This code from shooting.c may be helpful:

Code: (C) [Select]
void shooting_set_sv96(short sv96, short is_now)
{
    short dsv96=0, iso_mode=shooting_get_canon_iso_mode();
    if ((mode_get()&MODE_MASK) != MODE_PLAY)
    {
        if (is_now)
        {
            if (iso_mode<50)
                dsv96 =sv96-shooting_get_base_sv96();
            else if (sv96_base)
                dsv96=sv96-sv96_base;
            else if (sv96_base_tmp)
                dsv96=sv96-sv96_base_tmp;
            else
            {
                sv96_base_tmp= (short)((shooting_get_svm96_base()*shooting_get_sv96())/shooting_get_svm96());
                dsv96=sv96-sv96_base_tmp;
            }
            while ((shooting_is_flash_ready()!=1) || (focus_busy));
            short svm96_base =shooting_get_svm96_base();
            if (iso_mode>=50)
                shooting_set_iso_mode(0);
            set_property_case(PROPCASE_SV_MARKET, &svm96_base, sizeof(svm96_base));
            set_property_case(PROPCASE_SV, &sv96, sizeof(sv96));
            set_property_case(PROPCASE_DELTA_SV, &dsv96, sizeof(dsv96));
        }
        else   
            photo_param_put_off.sv96=sv96;
    }
}
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline reyalp

  • ******
  • 14082
Re: lua commands to get/set ISO and zoom
« Reply #6 on: 30 / September / 2012, 02:22:04 »
If you want to set iso by propcase, you probably need to set it in halfshoot after get_shooting() becomes true, like the overrides do. If you do that, setting PROPACASE_SV to the desired "real" APEX*96 value should do the trick.

Or you could just use set_sv96 before halfshoot.
Don't forget what the H stands for.

*

Offline lapser

  • *****
  • 1093
Re: lua commands to get/set ISO and zoom
« Reply #7 on: 30 / September / 2012, 03:31:22 »
If you want to set iso by propcase, you probably need to set it in halfshoot after get_shooting() becomes true, like the overrides do. If you do that, setting PROPACASE_SV to the desired "real" APEX*96 value should do the trick.

Or you could just use set_sv96 before halfshoot.
Thanks for the reply. I did try just setting PROPCASE_SV and all it did was change the EXIF data without changing the ISO of the camera (or the exposure of the pictures).

From the C code, it looks like you have to set PROPCASE_SV_MARKET with a base value, and PROPCASE_DELTA_SV with another value. Maybe if you add the two together, you get PROPCASE_SV? I'll do some experimenting. Maybe just setting DELTA_SV with SV-SV_MARKET will work.

It would be nice to be able to measure and set SV without doing two half shoots. I have this working with Tv using PROPCASE_TV, which sets the actual exposure value, and PROPCASE_TV2, which sets the EXIF data value.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


*

Offline lapser

  • *****
  • 1093
Re: lua commands to get/set ISO and zoom
« Reply #8 on: 30 / September / 2012, 14:23:23 »
OK, I think I figured out how to set SV and TV with propcases. Here's what appears to work:
Code: (lua) [Select]
props=require("propcase")
pTV=props.TV
pTV2=props.TV2
pSV=props.SV -- sv96
pDELTA_SV=props.DELTA_SV -- sv96 change from market sv

-- don't need to know SV_MARKET
-- pSV_MARKET=props.SV_MARKET -- market sv is one the camera can produce, i.e. 100,200,400 ISO etc.

--  calcuate tv and sv (Apex96) values based on meter readings after shoot_half

  set_prop(pTV,tv) -- sets actual exposure
  set_prop(pTV2,tv) --sets EXIF data

  set_prop(pDELTA_SV,sv-get_prop(pSV)+get_prop(pDELTA_SV)) -- sets actual exposure
  set_prop(pSV,sv) -- sets EXIF data

-- click shoot_full() to take picture with new sv and tv (without another shoot_half)
Propcase DELTA_SV, combined with SV_MARKET is what what determines the "real" exposure. The camera also stores this real exposure in propcase SV, so you can use this to calculate a new DELTA_SV without worrying about SV_MARKET (which is not Apex96).
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics