manual exposure control and the ND filter - Script Writing - CHDK Forum

manual exposure control and the ND filter

  • 8 Replies
  • 5198 Views
manual exposure control and the ND filter
« on: 27 / July / 2013, 14:56:41 »
Advertisements
While testing a sunset script on my A1200,  I noticed that while most shots were taken at f3.5,  the occasional shot was at f10.  The A1200 does not have a adjustable aperture and I was not moving the zoom or focus.  I decided that the ND filter must have been engaging. 

I was setting Tv, Av and Sv manually like this :
Code: [Select]
   set_sv96(sv96)
   set_av96_direct(av96)
   set_tv96_direct(tv96)
   shoot()
The av96 value was locked at f3.5 in the script while the tv96 and sv96 values were calculated from the bv96 value.   

When I reviewed the results, some shots (taken into bright sunlight) were showing up underexposed and the exif says they were at f10.   So my conclusion here is that set_av96_direct() does not play well with the camera's ND filter logic.  (i.e. my exposure calculations assumed f3.5 and when the ND filter engaged, my shots were underexposed)

I've now modified the script like this to force the ND filter not to engage.
Code: [Select]
   set_sv96(sv96)
   set_av96_direct(av96)
   set_tv96_direct(tv96)
   if(get_nd_present()>0) then set_nd_filter(2) end
   shoot()
I will test tonight to see if that "fixes it".

« Last Edit: 27 / July / 2013, 15:51:19 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: manual exposure control and the ND filter
« Reply #1 on: 27 / July / 2013, 16:02:54 »
There's also a CHDK menu parameter to set the ND filter IN, OUT, or OFF. I wonder if setting it to OUT would work.

I'd like to use the ND filter for setting exposure, but I need to know the precise Apex96 exposure change of the filter. I assume it's different for each camera. Has anyone every tested ND exposure change with a script? I think you could just measure bv96 with the filter in and out and the camera pointed at the wall with constant lighting.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: manual exposure control and the ND filter
« Reply #2 on: 27 / July / 2013, 16:16:21 »
I'd like to use the ND filter for setting exposure, but I need to know the precise Apex96 exposure change of the filter. I assume it's different for each camera.
Its about 3 stops on my A1200.  I've read that's a common value for Canon P&S cameras.

Quote
There's also a CHDK menu parameter to set the ND filter IN, OUT, or OFF. I wonder if setting it to OUT would work.
It should.  My preference is to have scripts setup things as much as they can on their own.  That way I don't need to remember that "the camera needs to be in XYZ mode when using this script" stuff.

Quote
I'd like to use the ND filter for setting exposure, but I need to know the precise Apex96 exposure change of the filter. I assume it's different for each camera. Has anyone every tested ND exposure change with a script? I think you could just measure bv96 with the filter in and out and the camera pointed at the wall with constant lighting.

This might save you five minutes :
Code: [Select]
--[[
 @title ND Filter
@param a Av96 Offset
  @default a 0
  @range   a 0 480
 --]]
 
--setup
  set_console_layout(1, 0, 45, 12)

-- switch to shooting mode
  print("test started...")
  if ( get_mode() == false ) then
    sleep(1000)
    set_record(1)
    while ( get_mode() == false) do
       sleep(100)
    end
  end
  sleep(100)
 
  set_nd_filter(2)  --out
  sleep(1000)
  print("checking exposure - ND out")
  press("shoot_half")
  repeat
    sleep(50)
  until get_shooting() == true
  release("shoot_half")
  repeat
    sleep(50)
  until get_shooting() == false
  bv=get_bv96()
  av=get_av96()
  sv=get_sv96()
  tv=get_tv96()
  print("bv:"..bv.." tv:"..tv.." sv:"..sv.." av:"..av)
  set_tv96_direct(tv)
  set_av96_direct(av)
  set_sv96(sv)
  set_nd_filter(2)  --out
  sleep(1000)  print("shoot")
  shoot()
  sleep(2000)
  bv=get_bv96()
  av=get_av96()
  sv=get_sv96()
  tv=get_tv96()
  print("bv:"..bv.." tv:"..tv.." sv:"..sv.." av:"..av)
  sleep(1000)

  print("checking exposure - ND in")
  press("shoot_half")
  repeat
    sleep(50)
  until get_shooting() == true
  set_nd_filter(1)  --in
  sleep(500)
  release("shoot_half")
  repeat
    sleep(50)
  until get_shooting() == false
  bv=get_bv96()
  av=get_av96()
  sv=get_sv96()
  tv=get_tv96()
  print("bv:"..bv.." tv:"..tv.." sv:"..sv.." av:"..av)
  set_tv96_direct(tv-a)
  set_av96_direct(av)
  set_sv96(sv)
  set_nd_filter(1)  --in
  sleep(1000)
  print("shoot")
  shoot()
  sleep(1000)
  bv=get_bv96()
  av=get_av96()
  sv=get_sv96()
  tv=get_tv96()
  print("bv:"..bv.." tv:"..tv.." sv:"..sv.." av:"..av)
  set_nd_filter(0)  --auto
  sleep(1000)


On my A1200 the ND filter only engages at the actual shoot - doing a half press to check exposure does not cause the filter to engage, even if its overridder by the script.

Edit : added script parameter to add offset to tv96 value so that exposures can match
« Last Edit: 01 / February / 2014, 15:15:45 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14126
Re: manual exposure control and the ND filter
« Reply #3 on: 27 / July / 2013, 18:16:58 »
When I reviewed the results, some shots (taken into bright sunlight) were showing up underexposed and the exif says they were at f10.   So my conclusion here is that set_av96_direct() does not play well with the camera's ND filter logic.  (i.e. my exposure calculations assumed f3.5 and when the ND filter engaged, my shots were underexposed)
Right, set_av* only sets an actual aperture if present, it doesn't know anything about the ND filter. (on cameras like SD990 that have only an ND filter, and have manual "av" control, set_user_av96 may do the right thing in manual mode, I don't remember for sure)

Canon firmware will still do it's own ND logic, using whatever exposure it calculated. So if you are calculating everything yourself, it is a good idea to force the ND to whatever state you want. Note that set_nd_filter should be noop on cameras that don't have them, so you ought to be able to just set it all the time if you want.

You can get the value of the ND filter from the platform/shooting.c aperture_sizes_table if the port was done correctly. Typically, it's 3 stops I think.
Don't forget what the H stands for.

Re: manual exposure control and the ND filter
« Reply #4 on: 27 / July / 2013, 18:44:14 »
Canon firmware will still do it's own ND logic, using whatever exposure it calculated. So if you are calculating everything yourself, it is a good idea to force the ND to whatever state you want.
The tricky bit here is that if you use a "half-press" to measure the Bv96 value,  the filter does not engage even if you set it to be "in".  So you get a Bv96 value without filter.   As long as you know it works that way,  you can compensate your exposure calculations appropriately.

Also,  the exif exposure information will be wrong as the camera does not "subract" the 3-stop difference from the f-stop reported or otherwise indicate that the ND filter was active (although there is a field for that in the maker notes, it does not appear to be used even when the camera itself inserts the filter - it just changes the f-stop reported in the exif instead).
« Last Edit: 27 / July / 2013, 19:20:35 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14126
Re: manual exposure control and the ND filter
« Reply #5 on: 27 / July / 2013, 19:51:34 »
The tricky bit here is that if you use a "half-press" to measure the Bv96 value,  the filter does not engage even if you set it to be "in".  So you get a Bv96 value without filter.
The Bv should be independent of whether the filter is in or not, it's a measure of the absolute brightness  of the scene. If the camera selects the filter, the Av in it's calculation should change, not the Bv (though if you override before your metering press, I'm not sure it will handle that correctly...)

If you explicitly set Tv, Av (including the filter value, if you used it) and Sv such that Tv + Av - Sv = Bv, then you should get "correct" exposure, whether or not the camera thought it was going to use the filter.

On cameras without adjustable aperture, you should be able to tell if the camera wanted to use the ND filter by comparing the Av prop and the MIN_AV prop.

I used that in the script posted here http://chdk.setepontos.com/index.php?topic=8066.0

Quote
Also,  the exif exposure information will be wrong as the camera does not "subract" the 3-stop difference from the f-stop reported or otherwise indicate that the ND filter was active (although there is a field for that in the maker notes, it does not appear to be used even when the camera itself inserts the filter - it just changes the f-stop reported in the exif instead).
You might be able to adjust the recorded f-stop by setting propcases.
Don't forget what the H stands for.

Re: manual exposure control and the ND filter
« Reply #6 on: 27 / July / 2013, 20:46:55 »
On cameras without adjustable aperture, you should be able to tell if the camera wanted to use the ND filter by comparing the Av prop and the MIN_AV prop.
Thanks - this gives the right answer after a half-press or shoot()

Code: [Select]
   av=get_av96()
   min_av96 = get_prop(props.MIN_AV)
   if av ~= min_av96 then
      print("  ND in")
   else
      print("  ND out")
   end

Quote
I used that in the script posted here http://chdk.setepontos.com/index.php?topic=8066.0
   :-[
Ported :   A1200    SD940   G10    Powershot N    G16

Re: manual exposure control and the ND filter
« Reply #7 on: 29 / July / 2013, 09:55:56 »
An updated script for playing with exposure settings and detecting the presence of the ND filter :

Code: [Select]
--[[
 @title ND2 Filter
 --]]
 
tv_ref = {
     -576, -544, -512, -480, -448, -416, -384, -352, -320, -288,
     -256, -224, -192, -160, -128,  -96,  -64,  -32,    0,   32,
       64,   96,  128,  160,  192,  224,  256,  288,  320,  352,
      384,  416,  448,  480,  512,  544,  576,  608,  640,  672,
      704,  736,  768,  800,  832,  864,  896,  928,  960,  992,
     1021, 1053, 1080 }
av_ref = {176,208,240,272,304,336,368,400,432,464,496,512,528,560,592,624,656,688,720,752}
sv_ref = {378,420,440,462,486,531,576,612,645,678,709,739,772,805}

function print_tv(val)
    local i = 1
    local tv_str = {
       ">64",
        "64",    "50",    "40",   "32",   "25",   "20",   "16",   "12",    "10",   "8.0",
       "6.0",   "5.0",   "4.0",  "3.2",  "2.5",  "2.0",  "1.6",  "1.3",   "1.0",   "0.8",
       "0.6",   "0.5",   "0.4",  "0.3",  "1/4",  "1/5",  "1/6",  "1/8",  "1/10",  "1/13",
      "1/15",  "1/20",  "1/25", "1/30", "1/40", "1/50", "1/60", "1/80", "1/100", "1/125",
     "1/160", "1/200", "1/250","1/320","1/400","1/500","1/640","1/800","1/1000","1/1250",
    "1/1600","1/2000","off"  }
    while (i <= #tv_ref) and (val > tv_ref[i]-1) do i=i+1 end
    return tv_str[i]
end

function print_av(val)
    local i = 1
    local av_str = {"n/a","2.0","2.2","2.5","2.8","3.2","3.5","4.0","4.5","5.0",
                    "5.6","5.9","6.3","7.1","8.0","9.0","10.0","11.0","13.0","14.0","16.0"}
    while (i <= #av_ref) and (val > av_ref[i]-1) do i=i+1 end
    return av_str[i]
end

function print_sv(val)
    local i = 1
    local sv_str = {"n/a","80","100","125","160","200","250","320","400","500","640","800","1250","1600"}
    while (i <= #sv_ref) and (val > sv_ref[i]-1) do i=i+1 end
    return sv_str[i]
end

--setup
  set_console_layout(1, 0, 45, 12)
  props=require("propcase")

-- switch to shooting mode
  print("test started...")
  if ( get_mode() == false ) then
    sleep(1000)
    set_record(1)
    while ( get_mode() == false) do
       sleep(100)
    end
  end
  sleep(100)
 
  sleep(1000)
  print("checking exposure")
  press("shoot_half")
  repeat
    sleep(50)
  until get_shooting() == true
  release("shoot_half")
  repeat
    sleep(50)
  until get_shooting() == false
  bv=get_bv96()
  av=get_av96()
  sv=get_sv96()
  tv=get_tv96()
  print("meter bv:"..bv.." tv:"..tv.." sv:"..sv.." av:"..av)
min_av96 = get_prop(props.MIN_AV)
if av ~= min_av96 then
print("   ND in", min_av96, av)
else
print("   ND out", min_av96, av)
end
  print(" Tv: "..print_tv(tv).."ISO "..print_sv(sv).." f"..print_av(av))

  sleep(100) 
  print("shoot")
  shoot()
  sleep(200)
  bv=get_bv96()
  av=get_av96()
  sv=get_sv96()
  tv=get_tv96()
  print("shoot bv:"..bv.." tv:"..tv.." sv:"..sv.." av:"..av)
min_av96 = get_prop(props.MIN_AV)
if av ~= min_av96 then
print("  ND in", min_av96, av)
else
print("  ND out", min_av96, av)
end
 print(" Tv: "..print_tv(tv).."ISO "..print_sv(sv).." f"..print_av(av))

Seems to work best doing this outdoors where you can switch between really bright and normal lighting just by pointing the camera appropriately.

Update : script cleanup
« Last Edit: 29 / July / 2013, 22:23:41 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: manual exposure control and the ND filter
« Reply #8 on: 29 / July / 2013, 19:40:31 »
Upon further testing,  its apparent that the script above does not quite do what I wanted  (detect if the ND filter is engaged or not).

While  get_prop(props.MIN_AV) will return the lowest AV value supported by the camera,  changing the zoom position by zooming in means that the actual minimum Av goes up.  So the test shown above to determine if the ND filter is engaged or not only works at the most wide angle position of the lens.

Back to the drawing board - probably need to make the assumption that the camera's aperature changes less than 3 stops (the ND filters effect)  from max wide to max zoom and do the math that way.


PEBKAC - I forgot that you can't look at props.MIN_AV until you have done at least one "half-press" after the camera starts.   Once you do that, it gets the right value for the aperature at the current zoom position.

« Last Edit: 29 / July / 2013, 22:24:39 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal