rawopint v0.25 - Fast, accurate intervalometer with raw exposure metering
- 1 Overview
- 2 Links
- 3 Script usage
- 4 Examples
- 5 Script Options
- 5.1 Shots
- 5.2 Interval sec/10
- 5.3 USB remote interval control
- 5.4 Meter width %
- 5.5 Meter height %
- 5.6 Meter step
- 5.7 Max Ev change
- 5.8 Use initial Ev as target
- 5.9 Ev Shift
- 5.10 Bv Ev shift %
- 5.11 Bv Ev shift base Ev
- 5.12 Max Tv Sec/1000
- 5.13 Min Tv Sec/100K
- 5.14 Target ISO
- 5.15 ISO adj TV Sec/1000
- 5.16 Max ISO
- 5.17 ND Tv Sec/10000
- 5.18 ND hysteresis Ev
- 5.19 ND value APEX*96
- 5.20 Meter high thresh Ev
- 5.21 Meter high limit Ev
- 5.22 Meter high max weight
- 5.23 Meter low thresh Ev
- 5.24 Meter low limit Ev
- 5.25 Meter high max weight
- 5.26 Overexp thresh x/100k
- 5.27 Overexp Ev range
- 5.28 Overexp max weight
- 5.29 Overexp prio
- 5.30 Underexp thresh x/100k
- 5.31 Underexp -Ev
- 5.32 Underexp max weight
- 5.33 Underexp prio
- 5.34 Histogram step
- 5.35 Zoom mode
- 5.36 Zoom value
- 5.37 Focus override mode
- 5.38 Focus dist (mm)
- 5.39 Image size
- 5.40 Use raw
- 5.41 Use cont. mode if set
- 5.42 Start hour (-1 off) / Start min / Start sec
- 5.43 Display
- 5.44 Shutdown on finish
- 5.45 Shutdown on low battery
- 5.46 Shutdown on low space
- 5.47 Interval warn LED
- 5.48 Interval warn beep
- 5.49 Draw Debug info
- 5.50 Meter Area
- 5.51 Gauge Y offset %
- 5.52 Log mode
- 5.53 Raw hook sleep
- 5.54 Disable script yield
- 5.55 Run simulation
- 6 Log file description
- 7 Control keys
- 8 Information for developers
Overview[edit | edit source]
This script requires CHDK 1.4.1 or later
The basic idea is to shoot rapidly without invoking Canon firmware auto-focus or auto-exposure between shots. The exposure for each subsequent shot is calculated from the previous image data. Shooting is done either using Canon continuous mode with delays inserted to maintain the desired interval, or by simulating holding the shutter button at half press and repeatedly clicking full press. In continuous mode, the script can achieve a frame rate close to the Canon continuous shooting specification.
This script intended for situations where a relatively high frame rate, smooth exposure change and fixed focus are desired. Because exposure is calculated from the raw image data, it performs well in low light but may not perform well in situations where the light changes rapidly. It is well suited for daytime landscapes, clouds, sunsets, sunrises etc.
This is still under development, and is not considered entirely finished. In particular:
- Doesn't handle aperture adjustments yet. This means the initial aperture value set by the canon firmware or CHDK overrides will be used for every shot.
- ND filter value must be set manually, unless 1) The camera does not have an adjustable aperture 2) The Canon firmware attempted to use the ND for the initial shot.
- Over exposure control doesn't deal well with really strict limits.
- There are too many options, and their meanings are not clear.
- There are not enough options to adjust all the things a user might want to adjust.
Despite the above, it can still produce good results in many situations.
Change History[edit | edit source]
Version 0.25 - May 6, 2018[edit | edit source]
- Add workaround to prevent aperture changes on cameras incorrectly defined to have ND even when ND threshold is disabled. Thanks c_joerg for reporting
- Added options to start at a particular clock time
- Added options for zoom and focus distance
Version 0.24 - Mar 4, 2018[edit | edit source]
- Fixed bug that prevented intervals > ~10 seconds from working. Thanks SkepticaLee for the report.
- Removed "Force initial ND" option. Cameras formerly thought to have a "hidden" ND without detectable state are now known to operate on the aperture. To use ND control on these cameras (not recommended), set the aperture to full open in the Canon firmware. If ND state isn't detected correctly on a camera with manual ND, set it open in the Canon firmware.
Version 0.23[edit | edit source]
- Add support for ND filter control on cameras with both ND and iris.
- Add options "ND value", "Force initial ND" and "ND hysteresis". See option descriptions below for details and caveats.
Version 0.22[edit | edit source]
- If "ISO Adj Tv" is set longer than "Max Tv", it is now set to "Max Tv", meaning the ISO adjustment will start when shutter adjestment ends. This fixes a bug where the "Max Tv" limit would be ignored. To disable ISO adjustment, set "Target ISO" and "Max ISO" to the same value. Thanks SkepticaLee for the report.
- Add battery temperature to log.
Version 0.21[edit | edit source]
- Fixed a bug that caused exposure to stop increasing when Max ISO was hit, regardless of Max Tv. Thanks udo for the report.
Version 0.20[edit | edit source]
- Added USB remote interval control option
Version 0.19[edit | edit source]
- Added interval warning LED and beep options, suggested by c_joerg in http://chdk.setepontos.com/index.php?topic=11081.msg125794#msg125794
- Changed some defaults. Meter now defaults to 90%, meter step 15.
- Log mode now has options for "none", "replace" and "append", defaults to append.
- Fix delay on script exit reported by c_joerg in http://chdk.setepontos.com/index.php?topic=11081.msg125651#msg125651
Links[edit | edit source]
Discussion / Bug reporting thread: http://chdk.setepontos.com/index.php?topic=12697.0
Download version 0.25: https://app.box.com/s/k4w85tnsf4gl2pvwh4mvu35vejkup53j
Earlier discussion can be found in the raw hook development thread: http://chdk.setepontos.com/index.php?topic=11081.msg119265#msg119265
Many of the concepts in the script and CHDK shooting hooks were inspired by Lapser's work in: http://chdk.setepontos.com/index.php?topic=8997.0
Script usage[edit | edit source]
This script has a lot of options which affect the final behavior. While the defaults can produce reasonable results in many situations, some experimentation is recommended to get a feel for the impact of the various options. The log file provides a wealth of information to understand what happened in a given run. Some general descriptions and usage guidelines are provided below.
Terms like Ev and Bv below are used loosely to mean APEX-like increments of exposure and scene brightness, but may not correspond exactly to their APEX definitions.
Shooting interval[edit | edit source]
Under optimal conditions, the shortest achievable interval should be slightly more than the Canon continuous mode specification.
If the interval is long enough to accommodate all processing, the interval between shots will be maintained with high accuracy, generally well under 1/10th of a second.
Interval should be long enough that the camera can keep up, including time for metering and the actual exposure. For nighttime, sunrises or sunsets, exposure time can be significant. Canon firmware dark frame subtraction and noise reduction may also substantially reduce the achievable interval. These are described in the Exposure Limits section below.
SD card firmware garbage collection, wear leveling etc. may cause shots to occasionally take much longer than normal. Unfortunately, this behavior is not well specified, and does not necessarily correspond to card cost or speed rating.
Metering and exposure control[edit | edit source]
Metering is done using an adjustable sized rectangle in the middle of the sensor, referred to below as the "meter". Additionally, a histogram of the entire sensor area is analyzed to limit the fraction of over and under exposed pixels to user specified ranges. The relative influence of these limits may be adjusted, and exposure changes are smoothed to avoid flickering. The target exposure defaults to a "neutral" value, roughly equivalent to what the Canon firmware auto-exposure would use for an evenly lit subject.
To meter the whole scene, use large meter height and width, e.g. 90%. Use smaller sizes for a "spot" meter. Note that the meter value is the average value of the metered area, so a scene that is half light and half shadow will be treated the same as a even value half way between the two.
With the default settings, the influence of the meter, over and under exposure balance in way that tends to keep the whole scene reasonably well exposed, at the expense of allowing some under or over exposure. For some scenes, you may want to make one dominant over the others. For example, to keep the moon from getting over-exposed at night, the under exposure limits should be turned off. On the other hand, if the sun will pass through the scene, you may want an over exposure fraction heigh enough to let it be blown out, without driving the rest of the scene completely dark.
Bv /Ev Shift[edit | edit source]
By default, the script tries to keep the meter area at a fixed exposure value. This means the subject will stay the same brightness as lighting changes, which looks unnatural in many situations. For example, if a cloud passes in front of the sun, the shadows get lighter but the overall scene brightness changes little. Similarly, a sunset will only change colors without getting any darker, until the exposure limits are hit, at which point the scene rapidly darkens. The Bv / Ev Shift setting can be used to avoid this. This setting changes the target exposure (equivalent to an Ev shift in the Canon firmware P mode etc) in response to the absolute brightness of the scene (Bv). A value of 30% means that for every stop of actual brightness, the exposure will change by ~1/3 of a stop. This shift is limited by the over and under exposure limits and the meter limits.
The Bv/Ev shift base Ev controls what absolute brightness is unshifted (i.e., what real light level will correspond to the "neutral".) This can either "first" to use the initial scene, or a fixed Bv value. For fixed values, a scene in mid-day sun is around 10, while indoor artificial lighting might be around 1. For a sunset, you could use "first", causing the scene to go from normal exposure to darkness. For a sunrise, using a daylight value like 10 would give better results.
Exposure limits[edit | edit source]
Very high shutters speeds have been observed to cause unstable exposure. Setting Min Tv Sec/100K to less than or equal to the cameras factory shutter limit is suggested. High shutter speeds may also impact shutter life.
Long exposures may trigger Canon dark frame, which doubles shooting time. This can be overridden in CHDK on most cameras, but quality may suffer.
The Target ISO should normally be set to the lowest value supported by the Canon firmware. It should not be set lower.
High ISOs usually trigger noise reduction (separate from dark frame) which can substantially increase processing time and affect the ability of the script to maintain the desired interval. The value where this occurs is camera dependent, but is often at 400, 800 or 1600. Set the Max ISO to a value slightly below the value that triggers the "busy" screen to maintain shorter intervals.
On cameras which have an ND filter, the ND will be put in or out based on the ND TV Sec/10000 setting. This is recommended to keep shutter speeds from getting too short. Due to CHDK limitations, the exposure value of the ND filter should be set as described in "ND value" section to avoid jumps in exposure level when the ND state changes.
Focus[edit | edit source]
The focus distance of the initial shot is used for all shots in a run. By default, the initial focus is determined by normal Canon and CHDK settings. You can use the "Focus override mode" and "Focus dist" options described below to set a specific focus distance, but CHDK focus control often has camera specific quirks so it may not work as expected.
If available, setting focus through the Canon UI using Canon firmware MF, AF Lock, "focus at infinity" mode should be reliable.
Controlling start time[edit | edit source]
The "Start hour", "Start min" and "Start sec" options allow you to set the script to start shooting at a particular camera clock time. When using this feature, starting the script with the camera in playback will preserve battery life, and on most P&S cameras should keep the shutter closed until shooting begins. When starting the script in playback mode, the focus option should be used to set focus distance. The CHDK OSD subject distance display may help you determine the correct focus distance.
Tethered shooting[edit | edit source]
As of chdkptp r832, the script can be used in conjunction with chdkptp to save files directly to a USB connected computer. A glue script is available in the chdkptp lua/extras directory. For additional details, see https://chdk.setepontos.com/index.php?topic=13386.msg136688#msg136688
Camera specific issues[edit | edit source]
- D10 has been observed shoot with the shutter closed with some combinations of settings, particularly if the debug OSD is off, and either raw hook sleep is zero, or disable script yield is not set. It's unclear whether this represents a hardware failure, or is a side effect of how the script interacts with the canon firmware. This has only been observed on one camera, and has not been seen other models. See http://chdk.setepontos.com/index.php?topic=12258.0
- G1x has problems with ISO over 320. See http://chdk.setepontos.com/index.php?topic=12165.30
- SX230 has problems with raw in continuous mode.
Tuning[edit | edit source]
The script has a lot of options which interact in non-obvious ways. The log file can provide insight into why the script behaved in a particular way. The _weight columns show the relative contribution of meter, under exposure protection and over exposure protection to the final exposure value.
Examples[edit | edit source]
- Moonrises, with settings posted
- Moonrise, sunset https://www.youtube.com/watch?v=XguvoBYP2vE
- Sunset, clouds, moonset https://www.youtube.com/watch?v=OIPLE-G8QKw
Note the settings described in posts linked above may not be for the most recent version of the script. Saved script settings files posted in the forum are generally only valid for the specific version they were saved with.
- Markb https://chdk.setepontos.com/index.php?topic=12766.0 (includes extensive discussion of settings)
- c_joerg https://chdk.setepontos.com/index.php?topic=12761.0
Script Options[edit | edit source]
Shots[edit | edit source]
Number of shots. If set to 0, script will end on menu key press or low battery/low remaining space only.
Interval sec/10[edit | edit source]
Time between shots, in 10ths of a second.
USB remote interval control[edit | edit source]
Uses the CHDK USB Remote to trigger shooting. In this mode, the script will wait up to the interval value for a pulse (low-hi-low) on the USB power input. If a pulse isn't received in time, it will shoot anyway. If the pulse is received during the shooting process, the next shot will trigger as soon as the possible. The CHDK USB remote enable option will be set by the script if this option is enabled, and restored to its previous state on script exit. If the script is ended with the menu key, one additional shot may be taken.
Meter width %[edit | edit source]
Width of meter area, in percent of active area.
Meter height %[edit | edit source]
Height of meter area, in percent of active area.
Meter step[edit | edit source]
Every step-th pixel is measured. To sample all colors, it should be odd. To prevent overflow, the total number of pixels (size/step)^2 must be less than unsigned_max / white_level. (~1M for 12 bpp, 250K for 14 bpp). Larger numbers of pixels will be slower.
Max Ev change[edit | edit source]
Maximum exposure change in a single step, in fractions of a stop. The actual exposure change is smoothed, so the max value will be only used if there is a sufficiently large, consistent trend in scene brightness.
Use initial Ev as target[edit | edit source]
Use the exposure of the initial shot as the target Ev instead of the pre-defined neutral value.
Ev Shift[edit | edit source]
Shift the target exposure by specified number of stops. If "Use initial Ev as target" is enabled, the shift is applied to the initial value. Otherwise, it is relative to the neutral value.
Bv Ev shift %[edit | edit source]
Vary target Ev based on absolute scene brightness, so every stop of scene brightness from the base Bv corresponds to x % change in target Ev. The range is limited by Meter thresh and limit options described below. Use the option to make the exposure follow scene brightness, so for example, a sunset will get darker instead of maintaining constant exposure.
Bv Ev shift base Ev[edit | edit source]
If Bv Ev shift is in effect, this sets the Bv at which the target Ev will equal the initial target Ev. If set to "First", the Bv of the first shot is used. A light surface in mid day sun is around 10.
Max Tv Sec/1000[edit | edit source]
Longest shutter speed to use, in 1/1000ths of a sec. If required exposure is longer, ISO will be used up to ISO limits.
Min Tv Sec/100K[edit | edit source]
Shortest shutter speed to use, in 1/100000ths of a sec. If required exposure is shorter, it will be limited to this value.
Target ISO[edit | edit source]
ISO value to use if shutter limits (described below) not reached. Should normally be lowest ISO. In Canon UI units.
ISO adj TV Sec/1000[edit | edit source]
Shutter speed (in 1/1000ths of a sec) at which ISO will start to be increased. If the exposure time exceeds this value, exposure will changes are split 50/50 between shutter and ISO, subject to limits below. Set Max ISO equal to this value to disable ISO adjustment.
Max ISO[edit | edit source]
Absolute max ISO to be used. In Canon UI units.
ND Tv Sec/10000[edit | edit source]
Shutter speed (in 1/10000ths of a sec) below which ND filter is put in. 0 disables.
ND hysteresis Ev[edit | edit source]
Fractions of a stop shutter speed must fall below "ND Tv Sec/10000" before the ND is put out. This will limit "flapping" if the light level is fluctuating near the point where the ND filter is put in.
ND value APEX*96[edit | edit source]
The exposure value of the ND filter, in APEX*96 units. This is camera model specific, and can only be determined by the script in limited situations. If this value is not set correctly, there will be a small jump in exposure when the filter state changes.
If set to 0, the value will be auto detected, or set to 288 (3 stops) if auto-detection is not possible. Auto detection is only possible if
- The camera does not have an adjustable aperture
- Canon firmware attempted put the ND filter in for the initial shot
Finding the correct value
- The ndtest.lua script included with CHDK 1.5 or later (available from https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk/CHDK/SCRIPTS/TEST/ndtest.lua) can be used to measure the ND value.
- On cameras with only an ND filter (most ixus/elph/SD, many A series) subtract the value of the MIN_AV propcase from the value of the AV propcase after half pressing in a scene were the Canon firmware would use the ND. You can also get it from the with / without ND values of the AV table in platform/shooting.c, if they are set up correctly.
- On cameras with an ND filter exposed in the Canon UI (many G and S series), there are one or more currently unnamed (not defined in propsetN.h) propcases that gives the value. This can be detected by comparing propcases values with / without the ND filter enabled and looking for one that changes by ~3 stops. On G7 X, propcases 85, 93 and 94 contain the value. 85 is associated with the string GetDeltaNDResu and 93 is associated with PCH_DELTAND_MEASU
- Some cameras report an ND present in CHDK but actually change the aperture in response to ND functions. On these cameras, putting the ND out moves the aperture to full open, and putting it in moves it to full close, often beyond the Av limit exposed in the canon UI. These cameras are sometimes referred to as having a "hidden" ND, due earlier mistaken conclusion that an ND was involved. Use of ND settings is not recommended on these cameras, but if used, the aperture should be set to full in the Canon firmware prior to running the script, and ND value should the number of stops to fully closed.
Meter high thresh Ev[edit | edit source]
Meter value in to start limiting under exposure protection, in stops above neutral. As the meter value exceeds this value, the influence of under exposure protection and positive Bv / Ev shift is reduced.
Meter high limit Ev[edit | edit source]
Maximum meter value allowed from under exposure protection, in stops above neutral.
Meter high max weight[edit | edit source]
Controls the maximum influence of the meter high limit relative to histogram under exposure. The influence of the meter increases proportional to the square of the fraction by which it exceeds the threshold, such that the max weight value is be reached at the limit Ev. If set to 100 (the standard weight before threshold), this behavior is disabled.
Meter low thresh Ev[edit | edit source]
Meter value to start limiting over-exposure protection, in stops below neutral. As the meter value falls the number of stops specified below neutral, the amount that over exposure protection or Bv / Ev shift can reduce exposure is reduced.
Meter low limit Ev[edit | edit source]
Minimum meter value allowed from over exposure protection, in stops below neutral.
Meter high max weight[edit | edit source]
Controls the maximum influence of the meter high limit relative to histogram over exposure, similar to max weight.
Overexp thresh x/100k[edit | edit source]
The fraction in parts per 100,000 of pixels that must be near to white level to trigger over exposure protection. 0 Disables over exposure protection. Note: for low values to work, the histogram step (described below) must be set to allow a sufficient number of pixels to be sampled. If the threshold represents less than 10 pixels, a warning is recorded in the log.
Overexp Ev range[edit | edit source]
What fraction of a stop below white level is considered over exposed.
Overexp max weight[edit | edit source]
Maximum weight for over exposure protection. This controls how far beyond the overexposure threshold the weight continues to increase.
Overexp prio[edit | edit source]
Priority modifier for over exposure protection. If greater than 0, the weight of under exposure and meter driven exposure increases is reduced proportional to the amount of over exposure, such that the "prio" value is subtracted from the weight when overexp thresh is reached.
Underexp thresh x/100k[edit | edit source]
Similar to overexp thresh above, but for pixels near black level. 0 Disabled under exposure protection.
Underexp -Ev[edit | edit source]
Number of stops below neutral a value must be to count as underexposed. Pixels with 0-4 histogram value are not counted as underexposure, since this usually indicates defective pixels.
Underexp max weight[edit | edit source]
Maximum weight for under exposure protection, similar to Overexp max weight above.
Underexp prio[edit | edit source]
Priority modifier for under exposure protection, similar to Overexp prio above.
Histogram step[edit | edit source]
The step between pixels sampled for under / over protection. Smaller values sample more pixels, allowing smaller areas to be detected and lower under/over thresholds to be used, at the expense of increased processing time. On D10 (12 megapixel) a step of 11 samples ~100k pixels, and takes 60-70ms to process, equating to ~1500 pixels/msec.
Zoom mode[edit | edit source]
Control zoom override
- "Off" = Zoom not be set by script, position was set prior to running the script will be used
- "Pct" = Zoom value is treated as a percentage of total zoom range
- "Step" = Zoom value is camera specific step
Zoom value[edit | edit source]
Value used if "Zoom mode" is not off.
Focus override mode[edit | edit source]
Control focus override and set preferred mode
- "Off" = Focus not be set by script, mode and distance set prior to running the script will be used
- "MF" = Prefer manual focus
- "AFL" = Prefer AF Lock
- "AF" = Prefer auto focus
Some CHDK ports can only override focus in certain modes. If the preferred mode is not supported, the script will attempt to use a supported mode.
Focus dist (mm)[edit | edit source]
Focus distance in millimeters, if "Focus override mode" is not "Off".
- There is no "infinity" setting, but using the maximum possible (9999999) value should be equivalent
- Focus distances are not calibrated, so the value that gives best focus may be quite different from the actual subject distance. Some cameras may need to be focused closer than infinity to produce good images of distant objects, and some cameras may not be able to achieve good focus at all using overrides
Image size[edit | edit source]
Override Canon jpeg resolution. "Default" uses current Canon UI setting, remaining values correspond to Canon UI. Not all values are valid on all cameras, and sizes for some modes vary between models.
Use raw[edit | edit source]
Override current CHDK raw setting. "Default" uses current CHDK UI setting, otherwise, force on or off.
Use cont. mode if set[edit | edit source]
Shoot by holding the shutter button down, if continuous shooting is enabled in the Canon menu. If not checked, or if continuous mode is not enabled in the Canon menu, shooting is done by holding down half shoot and clicking full.
Start hour (-1 off) / Start min / Start sec[edit | edit source]
Start at the given time according to the camera clock. Set hour to -1 to use delay instead. If the given time is more than 1 minute in the past, the time is assumed to be the next day. If the time is less than one minute in the past, the shooting starts immediately. While the camera waits, the set key can be used to toggle the display and show the remaining time, and the menu key exits.
If the camera is in playback mode, it will switch to rec and set zoom and focus 15 seconds before the scheduled start time
Beware that camera clocks can drift many seconds per day.
Display[edit | edit source]
Display power saving mode.
- On = always on,
- Off use set_lcd_display off.
- Blt_Off use set_backlight every shot.
Pressing set while the script is running turns the display on for 30 sec.
Shutdown on finish[edit | edit source]
Shutdown after "shots" images are taken.
Shutdown on low battery[edit | edit source]
Shutdown if the battery voltage falls below the CHDK OSD low battery value.
Shutdown on low space[edit | edit source]
Shutdown if the SD card space falls below 50 MB.
Interval warn LED[edit | edit source]
Blink LED if shooting falls below the rate specified by Interval above. The mapping of LED numbers to LEDs is cameras specific, and not all cameras support script LED control.
Interval warn beep[edit | edit source]
Play a beep if shooting falls below the rate specified by Interval above. The beep will only be played the Canon UI has not been set to Mute.
Draw Debug info[edit | edit source]
Draw metering information on the raw buffer. From top to bottom
- A bar near the top of the screen, representing the metered value as a % of white level (log scale), with tick marks at 1 EV intervals. The larger ticks are black level, neutral, white level, and Ev shift if enabled. Yellow and red ticks above the bar show the meter thresh and limit values, respectively.
- A bar showing the change in exposure as a fraction of the max EV change value described below. The origin is at the center, with longer exposure to the right, and shorter exposure to the left.
- A bar extending from left to right, representing % underexposed pixels. Red if above threshold, max at middle of screen.
- A bar extending from right to left, representing % overexposed pixels. Red if above threshold, max at middle of screen.
- A box or reticle around the meter area, controlled by Meter Area option below
Drawing takes adds a small amount to shooting time (e.g. 20 ms on d10.) The log contains this information and much more, but having it in the images makes it easier to see what the code is doing.
Meter Area[edit | edit source]
Controls whether the metering area is drawn, either just the corners or a box
Gauge Y offset %[edit | edit source]
Controls the vertical location of the debug info, in % of full resolution jpeg area height. 0 uses a default offset of 80 pixels. Use to make the debug info visible on jpegs with a different aspect ration form the sensor.
Log mode[edit | edit source]
If enabled, the log is written to A/rawopint.csv
- None = Do not record a log.
- Append = append to existing log. A new header row is written each time the script is started.
- Replace = Replace any existing log.
The log is described in more detail below.
Raw hook sleep[edit | edit source]
Insert a script sleep just before the raw hook is released. This appears to avoid issues with D10 taking some shots with the shutter closed when debug drawing is not enabled.
Disable script yield[edit | edit source]
Disable automatic script yielding. May prevent D10 shutter issues mentioned above, and possibly reduce interval. May have other side effects.
Run simulation[edit | edit source]
PROBABLY BROKEN IN CURRENT SCRIPT VERSION. Read A/rawopsim.csv and feed the initial exposure values, scene brightness and over/under % to the metering algorithm without actually shooting. The CSV should be in the same format as the log file. Output will be written to A/rawopint.csv as usual, but some columns will not be filled in or will have values different form what the column label indicates.
Log file description[edit | edit source]
The log is a CSV with a bunch of columns. Some of the more relevant/useful ones are described below.
Values in the first line of data are from the pre-shoot before the first shot. The desc column in this line includes a summary of script settings, chdk version, and zoom + focus state.
sv, tv, av[edit | edit source]
exposure values for the shot with the image number indicated in the exp column. Note the aperture (Av) is not controlled by the script, but on cameras without an adjustable aperture, the ND value is added to the Av value when the ND is active.
bv96[edit | edit source]
Scene brightness in APEX*96 units. For pre-shoot, this comes from the canon firmware. Otherwise, calculated from exposure params and meter value. The calculated value only roughly corresponds to the real definition of Bv.
meter, meter96[edit | edit source]
Average value of the metered area: meter is the raw sensor value, *96 gives this as an APEX96 value where the target exposure is 0. In meter96, negative values indicate an underexposure, positive is overexposure.
over_frac, under_frac[edit | edit source]
Fraction of pixel in the over and under ranges, in percent.
meter_weight, over_weight, under_weight[edit | edit source]
Weights controlling the relative contribution of the meter area, under and over exposure protection to the final exposure change.
bv_ev_shift[edit | edit source]
The amount the target Ev was shifted to reflect scene brightness, in APEX*96 units.
d_ev[edit | edit source]
exposure change requested for the next shot. Positive values mean more exposure (longer Tv, higher ISO)
desc[edit | edit source]
various cases in the metering process trigger messages here, e.g if shutter limits hit etc. The first row contains initial settings.
sleep[edit | edit source]
How long the script waited between shots. If it's negative, it means the script wasn't able to maintain the requested frame rate.
start[edit | edit source]
The tick count (milliseconds since boot) of the start of the main loop. The values of shoot_ready, exp_start, raw_ready and raw_done are offsets form this value
Control keys[edit | edit source]
Pressing menu ends the script. Pressing set turns on the display for 30 sec.
Information for developers[edit | edit source]
The code is broken up into several isolated "modules" for easier understanding and re-use. For ease of distribution, the "modules" are all contained in the file rather than separate files loaded with require. The modules are identified with comments like
-- exposure module -- end exposure module
Each module is a Lua table which encapsulates the required state and methods.
In addition to the modules, there is code at the top of the script to deal with the values from the CHDK script menu, and at the bottom to run the main logic. Values directly derived from the CHDK script menu are prefixed with ui_, and are not used directly inside any of the modules. In many cases, the values need to be translated to different units for the script. UI values ending with _e are "enum" values, where the UI value is used to look up a value.