Module camera
Basic camera operations and properties
Functions
shoot([should_af=false]) | Take a picture. |
wait() | Wait until the camera is idle (not processing pictures). |
burst(num_pictures) | Take N pictures in burst mode. |
bulb(duration) | Take a picture in bulb mode. |
reboot() | Restart the camera. |
Fields
shutter | Gets a shutter object that represents the camera's current shutter speed. |
aperture | Gets an aperture object that represents the lens' aperture. |
iso | Gets an iso object that represents camera's ISO. |
ec | Gets an ec object that represents exposure compensation. |
flash | Get/set whether the flash is enabled. |
flash_ec | Gets an ec object that represents flash exposure compensation. |
kelvin | Get/Set kelvin white balance. |
mode | Get the current camera mode, possible values defined in constants.MODE. |
metering_mode | Get the current metering mode (see PROP_METERING_MODE in property.h). |
drive_mode | Get the current drive mode (see PROP_DRIVE in property.h). |
model | Get the model name of the camera (e.g. "Canon EOS 60D"). |
model_short | Get the shortened model name of the camera (e.g. "5D3"). |
firmware | Get the Canon firmware version string (e.g. "1.2.3"). |
temperature | Get the temperature from the EFIC chip in raw units. |
gui | Gets a gui object that controls Canon GUI state (PLAY, MENU, QR, various dialogs) |
Class shutter
shutter.raw | Get/Set shutter speed in Canon raw units. |
shutter.apex | Get/Set shutter speed in APEX units (floating point). |
shutter.ms | Get/Set shutter speed in milliseconds. |
shutter.value | Get/Set shutter speed in seconds (floating point). |
shutter:__tostring() | Pretty prints the current shutter speed as a string. |
Class aperture
aperture.raw | Get/Set aperture in Canon raw units. |
aperture.apex | Get/Set aperture in APEX units (floating point). |
aperture.value | Get/Set aperture as f-number (floating point). |
aperture.min | Get minimum (wide open) aperture value (aperture object). |
aperture.max | Get maximum (closed) aperture value (aperture object). |
aperture:__tostring() | Pretty prints the current aperture as a string. |
Class iso
iso.raw | Get/Set ISO in Canon raw units. |
iso.apex | Get/Set ISO in APEX units (floating point). |
iso.value | Get/Set ISO (e.g. 100, 200). |
iso:__tostring() | Pretty prints the current ISO as a string. |
Class ec
ec.raw | Get/Set exposure compensation in Canon raw units. |
ec.value | Get/Set exposure compensation in EV or APEX (both are identical here). |
ec:__tostring() | Pretty prints the exposure compensation as a string. |
Class gui
gui.menu | Get/Set whether Canon menu is active or not. |
gui.play | Get/Set whether the camera is in PLAY mode (image or video review). |
gui.play_photo | Get whether the camera is in PLAY mode with a still photo selected. |
gui.play_movie | Get whether the camera is in PLAY mode with a H.264 movie selected. |
gui.qr | Get whether the camera is in QR (QuickReview) mode. |
gui.idle | Get whether the camera is "idle" (in standby, with no other dialogs active) |
gui.mode | Get/Set current GUI mode from Canon (model-dependent). |
Functions
- shoot([should_af=false])
-
Take a picture.
Parameters:
- should_af bool whether or not to use autofocus. (default false)
- wait()
-
Wait until the camera is idle (not processing pictures).
Normally, camera.shoot() returns as soon as the next picture can be taken, while image compression and saving happen in background.
- burst(num_pictures)
-
Take N pictures in burst mode.
Note: your camera must be already in some continuous drive mode, otherwise the speed will be slow.
Parameters:
- num_pictures int how many pictures to take.
- bulb(duration)
-
Take a picture in bulb mode.
Parameters:
- duration float bulb duration in seconds.
- reboot()
- Restart the camera.
Fields
- shutter
-
Gets a shutter object that represents the camera's current shutter speed.
- shutter shutter
- aperture
-
Gets an aperture object that represents the lens' aperture.
- aperture aperture
- iso
-
Gets an iso object that represents camera's ISO.
- iso iso
- ec
-
Gets an ec object that represents exposure compensation.
- ec ec
- flash
-
Get/set whether the flash is enabled.
Possible values: true, false, "auto", "unknown".
Flash can only be changed from script in simple (non-automatic) modes.
Not tested with external flashes; it may work or it may not.
- flash bool or string
- flash_ec
-
Gets an ec object that represents flash exposure compensation.
- flash_ec ec
- kelvin
-
Get/Set kelvin white balance.
- kelvin int
- mode
-
Get the current camera mode, possible values defined in constants.MODE.
Note: for cameras without a dedicated video mode, it will return MODE.MOVIE whenever your camera is configured to record videos (usually from Canon menu).
- mode int
- metering_mode
-
Get the current metering mode (see PROP_METERING_MODE in property.h).
TODO: add constants and setter.
- metering_mode int readonly
- drive_mode
-
Get the current drive mode (see PROP_DRIVE in property.h).
TODO: add constants and setter.
- drive_mode int readonly
- model
-
Get the model name of the camera (e.g. "Canon EOS 60D").
- model string readonly
- model_short
-
Get the shortened model name of the camera (e.g. "5D3").
- model_short string readonly
- firmware
-
Get the Canon firmware version string (e.g. "1.2.3").
- firmware string readonly
- temperature
-
Get the temperature from the EFIC chip in raw units.
TODO: Celsius.
- temperature int readonly
- gui
-
Gets a gui object that controls Canon GUI state (PLAY, MENU, QR, various dialogs)
- gui gui
Class shutter
Represents the camera's shutter speed setting- shutter.raw
-
Get/Set shutter speed in Canon raw units.
- raw int
- shutter.apex
-
Get/Set shutter speed in APEX units (floating point).
- apex number
- shutter.ms
-
Get/Set shutter speed in milliseconds.
- ms int
- shutter.value
-
Get/Set shutter speed in seconds (floating point).
- value number
- shutter:__tostring()
-
Pretty prints the current shutter speed as a string.
Returns:
Class aperture
Represents the lens's aperture.- aperture.raw
-
Get/Set aperture in Canon raw units.
- raw int
- aperture.apex
-
Get/Set aperture in APEX units (floating point).
- apex number
- aperture.value
-
Get/Set aperture as f-number (floating point).
- value number
- aperture.min
-
Get minimum (wide open) aperture value (aperture object).
- min aperture readonly
- aperture.max
-
Get maximum (closed) aperture value (aperture object).
- max aperture readonly
- aperture:__tostring()
-
Pretty prints the current aperture as a string.
Returns:
Class iso
Represents the camera ISO.- iso.raw
-
Get/Set ISO in Canon raw units.
- raw int
- iso.apex
-
Get/Set ISO in APEX units (floating point).
- apex number
- iso.value
-
Get/Set ISO (e.g. 100, 200).
- value int
- iso:__tostring()
-
Pretty prints the current ISO as a string.
Returns:
Class ec
Represents the exposure compensation.- ec.raw
-
Get/Set exposure compensation in Canon raw units.
- raw int
- ec.value
-
Get/Set exposure compensation in EV or APEX (both are identical here).
- value number
- ec:__tostring()
-
Pretty prints the exposure compensation as a string.
Returns:
Class gui
Canon GUI controls (PLAY, MENU, QR and so on)- gui.menu
-
Get/Set whether Canon menu is active or not.
Can also be used to enter Canon menu: camera.gui.menu = true;
- menu bool
- gui.play
-
Get/Set whether the camera is in PLAY mode (image or video review).
Can also be used to enter PLAY mode: camera.gui.menu = true;
- play bool
- gui.play_photo
-
Get whether the camera is in PLAY mode with a still photo selected.
- play_photo bool
- gui.play_movie
-
Get whether the camera is in PLAY mode with a H.264 movie selected.
- play_movie bool
- gui.qr
-
Get whether the camera is in QR (QuickReview) mode.
QuickReview is the image review mode used right after taking a picture.
It is not the same as the regular PLAY mode, even though they are similar at first sight (both are used for reviewing an image). Important difference: in QR mode, ML has access to raw image data from the last captured picture; this data is not available in PLAY mode.
- qr bool
- gui.idle
-
Get whether the camera is "idle" (in standby, with no other dialogs active)
- idle bool
- gui.mode
-
Get/Set current GUI mode from Canon (model-dependent).
On most models, 0 is "idle" (not exactly identical to what ML considers idle), 1 is PLAY, 2 is MENU.
- mode int