Module ctr.cam
The cam module.
Usage:
local cam = require("ctr.cam")
Functions
init () | Initialize the camera module. |
shutdown () | Disable the camera module. |
activate (camera) | Activate a camera. |
setExposure (camera, exposure) | Set the exposure of a camera. |
setWhiteBalance (camera, white) | Set the white balance of a camera. |
setSharpness (camera, sharpness) | Set the sharpness of a camera. |
setAutoExposure (camera, auto) | Set the auto exposure mode of a camera. |
isAutoExposure (camera) | Check if the auto exposure mode is enabled for a camera. |
setAutoWhiteBalance (camera, auto) | Set the auto white balance mode for a camera. |
isAutoWhiteBalance (camera) | Check if the auto white balance mode is enabled for a camera. |
setContrast (camera, contrast) | Set the contrast on a camera. |
setLensCorrection (camera, correction) | Set the lens correction of a camera. |
setAutoExposureWindow (x, y, w, h) | Set the window where the exposure will be check. |
setAutoWhiteBalanceWindow (x, y, w, h) | Set the window where the white balance will be check. |
setNoiseFilter (camera, filter) | Enable or disable the noise filter on a camera. |
playShutterSound (sound) | Play a shutter sound. |
setSize (camera, size, context) | Set the size of the base camera image. |
setEffect (camera, effect, context) | Set the effect applied on the image. |
setFrameRate (camera, rate) | Set the frame rate of a camera. |
takePicture (camera, w, h[, place=PLACE_RAM]) | Take a picture and put it in a texture. |
Fields
Functions
- init ()
-
Initialize the camera module.
Returns:
-
boolean
true
if everything went fineOr
-
boolean
false
in case of error - integer error code
-
boolean
- shutdown ()
- Disable the camera module.
- activate (camera)
-
Activate a camera.
Parameters:
- camera
number
camera to activate (
SELECT_x
)
- camera
number
camera to activate (
- setExposure (camera, exposure)
-
Set the exposure of a camera.
Parameters:
- camera
number
(
SELECT_x
) - exposure
number
(from
-128
to127
)
- camera
number
(
- setWhiteBalance (camera, white)
-
Set the white balance of a camera.
Parameters:
- camera
number
(
SELECT_x
) - white
number
white balance (
WHITE_BALANCE_x
)
- camera
number
(
- setSharpness (camera, sharpness)
-
Set the sharpness of a camera.
Parameters:
- camera
number
(
SELECT_x
) - sharpness
number
from (from
-128
to127
)
- camera
number
(
- setAutoExposure (camera, auto)
-
Set the auto exposure mode of a camera.
Parameters:
- camera
number
(
SELECT_x
) - auto
boolean
true
to enable,false
to disable
- camera
number
(
- isAutoExposure (camera)
-
Check if the auto exposure mode is enabled for a camera.
Parameters:
- camera
number
(
SELECT_x
)
Returns:
-
boolean
true
if enabled,false
if not - camera
number
(
- setAutoWhiteBalance (camera, auto)
-
Set the auto white balance mode for a camera.
Parameters:
- camera
number
(
SELECT_x
) - auto
boolean
true
to enable,false
to disable
- camera
number
(
- isAutoWhiteBalance (camera)
-
Check if the auto white balance mode is enabled for a camera.
Parameters:
- camera
number
(
SELECT_x
)
Returns:
-
boolean
true
if enabled,false
if not - camera
number
(
- setContrast (camera, contrast)
-
Set the contrast on a camera.
Parameters:
- camera
number
(
SELECT_x
) - contrast
number
(
CONTRAST_x
)
- camera
number
(
- setLensCorrection (camera, correction)
-
Set the lens correction of a camera.
Parameters:
- camera
number
(
SELECT_x
) - correction
number
lens correction (
LENS_CORRECTION_x
)
- camera
number
(
- setAutoExposureWindow (x, y, w, h)
-
Set the window where the exposure will be check.
Parameters:
- x number x starting position of the window
- y number y starting position of the window
- w number width of the window
- h number height of the window
- setAutoWhiteBalanceWindow (x, y, w, h)
-
Set the window where the white balance will be check.
Parameters:
- x number x starting position of the window
- y number y starting position of the window
- w number width of the window
- h number height of the window
- setNoiseFilter (camera, filter)
-
Enable or disable the noise filter on a camera.
Parameters:
- camera
number
(
SELECT_x
) - filter
boolean
true
to enable,false
to disable
- camera
number
(
- playShutterSound (sound)
-
Play a shutter sound.
Parameters:
- sound
number
shutter sound type (
SHUTTER_x
)
- sound
number
shutter sound type (
- setSize (camera, size, context)
-
Set the size of the base camera image.
Parameters:
- camera
number
(
SELECT_x
) - size
number
(
SIZE_x
) - context
number
(
CONTEXT_x
)
- camera
number
(
- setEffect (camera, effect, context)
-
Set the effect applied on the image.
Parameters:
- camera
number
(
SELECT_x
) - effect
number
(
EFFECT_x
) - context
number
(
CONTEXT_x
)
- camera
number
(
- setFrameRate (camera, rate)
-
Set the frame rate of a camera.
Parameters:
- camera
number
(
SELECT_x
) - rate
number
frame rate (
FRAME_RATE_x
)
- camera
number
(
- takePicture (camera, w, h[, place=PLACE_RAM])
-
Take a picture and put it in a texture.
Parameters:
- camera
number
should be PORT_CAM1 if you have only 1 camera activated (
PORT_x
) - w number width of the picture
- h number height of the picture
- place number where to put the texture (default PLACE_RAM)
Returns:
-
texture
the texture object
- camera
number
should be PORT_CAM1 if you have only 1 camera activated (
Fields
- PORT_CAM1
-
First camera activated.
- PORT_CAM1
- PORT_CAM2
-
Second camera activated.
- PORT_CAM2
- PORT_BOTH
-
The two activated camera. Should not be used ATM.
- PORT_BOTH
- SELECT_NONE
-
- SELECT_NONE
- SELECT_OUT1
-
- SELECT_OUT1
- SELECT_IN1
-
- SELECT_IN1
- SELECT_OUT2
-
- SELECT_OUT2
- SELECT_IN1_OUT1
-
- SELECT_IN1_OUT1
- SELECT_OUT1_OUT2
-
- SELECT_OUT1_OUT2
- SELECT_IN1_OUT2
-
- SELECT_IN1_OUT2
- SELECT_ALL
-
- SELECT_ALL
- CONTEXT_NONE
-
- CONTEXT_NONE
- CONTEXT_A
-
- CONTEXT_A
- CONTEXT_B
-
- CONTEXT_B
- CONTEXT_BOTH
-
- CONTEXT_BOTH
- FLIP_NONE
-
- FLIP_NONE
- FLIP_HORIZONTAL
-
- FLIP_HORIZONTAL
- FLIP_VERTICAL
-
- FLIP_VERTICAL
- FLIP_REVERSE
-
- FLIP_REVERSE
- SIZE_VGA
-
640x480
- SIZE_VGA
- SIZE_QVGA
-
320x240
- SIZE_QVGA
- SIZE_QQVGA
-
160x120
- SIZE_QQVGA
- SIZE_CIF
-
352x288
- SIZE_CIF
- SIZE_QCIF
-
176x144
- SIZE_QCIF
- SIZE_DS_LCD
-
256x192
- SIZE_DS_LCD
- SIZE_DS_LCDx4
-
512x384
- SIZE_DS_LCDx4
- SIZE_CTR_TOP_LCD
-
400x240
- SIZE_CTR_TOP_LCD
- SIZE_BOTTOM_LCD
-
320x240
- SIZE_BOTTOM_LCD
- FRAME_RATE_15
-
- FRAME_RATE_15
- FRAME_RATE_15_TO_5
-
- FRAME_RATE_15_TO_5
- FRAME_RATE_15_TO_2
-
- FRAME_RATE_15_TO_2
- FRAME_RATE_10
-
- FRAME_RATE_10
- FRAME_RATE_8_5
-
- FRAME_RATE_8_5
- FRAME_RATE_5
-
- FRAME_RATE_5
- FRAME_RATE_20
-
- FRAME_RATE_20
- FRAME_RATE_20_TO_5
-
- FRAME_RATE_20_TO_5
- FRAME_RATE_30
-
- FRAME_RATE_30
- FRAME_RATE_TO_5
-
- FRAME_RATE_TO_5
- FRAME_RATE_15_TO_10
-
- FRAME_RATE_15_TO_10
- FRAME_RATE_20_TO_10
-
- FRAME_RATE_20_TO_10
- FRAME_RATE_30_TO_10
-
- FRAME_RATE_30_TO_10
- WHITe_BALANCE_AUTO
-
- WHITe_BALANCE_AUTO
- WHITE_BALANCE_3200K
-
- WHITE_BALANCE_3200K
- WHITE_BALANCE_4150K
-
- WHITE_BALANCE_4150K
- WHITE_BALANCE_5200K
-
- WHITE_BALANCE_5200K
- WHITE_BALANCE_6000K
-
- WHITE_BALANCE_6000K
- WHITE_BALANCE_7000K
-
- WHITE_BALANCE_7000K
- WHITE_BALANCE_TUNGSTEN
-
- WHITE_BALANCE_TUNGSTEN
- WHITE_BALANCE_WHITE_FLUORESCENT_LIGHT
-
- WHITE_BALANCE_WHITE_FLUORESCENT_LIGHT
- WHITE_BALANCE_DAYLIGHT
-
- WHITE_BALANCE_DAYLIGHT
- WHITE_BALANCE_CLOUDY
-
- WHITE_BALANCE_CLOUDY
- WHITE_BALANCE_HORIZON
-
- WHITE_BALANCE_HORIZON
- WHITE_BALANCE_SHADE
-
- WHITE_BALANCE_SHADE
- PHOTO_MODE_NORMAL
-
- PHOTO_MODE_NORMAL
- PHOTO_MODE_PORTRAIT
-
- PHOTO_MODE_PORTRAIT
- PHOTO_MODE_LANDSCAPE
-
- PHOTO_MODE_LANDSCAPE
- PHOTO_MODE_NIGHTVIEW
-
- PHOTO_MODE_NIGHTVIEW
- PHOTO_MODE_LETTER
-
- PHOTO_MODE_LETTER
- EFFECT_NONE
-
- EFFECT_NONE
- EFFECT_MONO
-
- EFFECT_MONO
- EFFECT_SEPIA
-
- EFFECT_SEPIA
- EFFECT_NEGATIVE
-
- EFFECT_NEGATIVE
- EFFECT_NEGAFILM
-
- EFFECT_NEGAFILM
- EFFECT_SEPIA01
-
- EFFECT_SEPIA01
- CONTRAST_01
-
- CONTRAST_01
- CONTRAST_02
-
- CONTRAST_02
- CONTRAST_03
-
- CONTRAST_03
- CONTRAST_04
-
- CONTRAST_04
- CONTRAST_05
-
- CONTRAST_05
- CONTRAST_06
-
- CONTRAST_06
- CONTRAST_07
-
- CONTRAST_07
- CONTRAST_08
-
- CONTRAST_08
- CONTRAST_09
-
- CONTRAST_09
- CONTRAST_10
-
- CONTRAST_10
- CONTRAST_11
-
- CONTRAST_11
- CONTRAST_LOW
-
- CONTRAST_LOW
- CONTRAST_NORMAL
-
- CONTRAST_NORMAL
- CONTRAST_HIGH
-
- CONTRAST_HIGH
- LENS_CORRECTION_OFF
-
- LENS_CORRECTION_OFF
- LENS_CORRECTION_NORMAL
-
- LENS_CORRECTION_NORMAL
- LENS_CORRECTION_BRIGHT
-
- LENS_CORRECTION_BRIGHT
- SHUTTER_NORMAL
-
- SHUTTER_NORMAL
- SHUTTER_MOVIE
-
- SHUTTER_MOVIE
- SHUTTER_MOVIE_END
-
- SHUTTER_MOVIE_END