LifeLua 21-08-2025
Documentation for LifeLua, a Lua interpreter for the PS Vita
Loading...
Searching...
No Matches
camera

Using the front and back cameras. More...

Detailed Description

Start a camera with camera.start(), then get each new frame as an image with camera.output(). Only one camera can be running at a time. All the setting functions work the same way: call them with a value to change the setting, or without one to get the current value. They raise an error if the camera wasn't started.

while true do
controls.update()
local frame = camera.output()
frame:display(160, 32)
local qr = frame:qrscan()
if qr then draw.text(10, 10, "QR code: "..qr, color.new(255, 255, 255)) end
if controls.pressed(SCE_CTRL_CIRCLE) then break end
draw.swapbuffers()
end
camera.stop()
SceCameraEffect SCE_CAMERA_EFFECT_SEPIA
Sepia.
Definition lj_camera.h:71
SceCameraDevice SCE_CAMERA_DEVICE_BACK
Back camera.
Definition lj_camera.h:30
SceCameraResolution SCE_CAMERA_RESOLUTION_640_480
640 × 480 (VGA)
Definition lj_camera.h:36
SceCtrlButtons SCE_CTRL_CIRCLE
Circle (○) button.
Definition lj_controls.h:34

Functions

nil camera.start (SceCameraDevice device, SceCameraResolution resolution, SceCameraFrameRate fps)
 
image camera.output ()
 
nil camera.stop ()
 
boolean camera.active ()
 
SceCameraReverse camera.reverse (SceCameraReverse mode)
 
SceCameraEffect camera.effect (SceCameraEffect effect)
 
number camera.zoom (number level)
 
number camera.brightness (number level)
 
SceCameraSaturation camera.saturation (SceCameraSaturation level)
 
number camera.contrast (number level)
 
SceCameraSharpness camera.sharpness (SceCameraSharpness level)
 
SceCameraExposureCompensation camera.exposure (SceCameraExposureCompensation level)
 
SceCameraAntiFlicker camera.antiflicker (SceCameraAntiFlicker mode)
 
SceCameraISO camera.iso (SceCameraISO mode)
 
SceCameraGain camera.gain (SceCameraGain mode)
 
SceCameraWhiteBalance camera.whitebalance (SceCameraWhiteBalance mode)
 
SceCameraBacklight camera.backlight (SceCameraBacklight mode)
 
SceCameraNightmode camera.nightmode (SceCameraNightmode mode)
 
number camera.noisereduction (number level)
 

Devices

Used with camera.start()

SceCameraDevice SCE_CAMERA_DEVICE_FRONT
 Front camera.
 
SceCameraDevice SCE_CAMERA_DEVICE_BACK
 Back camera.
 

Resolutions

Used with camera.start()

SceCameraResolution SCE_CAMERA_RESOLUTION_0_0
 Invalid resolution.
 
SceCameraResolution SCE_CAMERA_RESOLUTION_640_480
 640 × 480 (VGA)
 
SceCameraResolution SCE_CAMERA_RESOLUTION_320_240
 320 × 240 (QVGA), supports 120 FPS
 
SceCameraResolution SCE_CAMERA_RESOLUTION_160_120
 160 × 120 (QQVGA), supports 120 FPS
 
SceCameraResolution SCE_CAMERA_RESOLUTION_352_288
 352 × 288 (CIF), supports 120 FPS
 
SceCameraResolution SCE_CAMERA_RESOLUTION_176_144
 176 × 144 (QCIF)
 
SceCameraResolution SCE_CAMERA_RESOLUTION_480_272
 480 × 272 (PSP screen size)
 
SceCameraResolution SCE_CAMERA_RESOLUTION_640_360
 640 × 360
 

Frame rates

Used with camera.start()

SceCameraFrameRate SCE_CAMERA_FRAMERATE_3_FPS
 3 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_5_FPS
 5 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_7_FPS
 7 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_10_FPS
 10 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_15_FPS
 15 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_20_FPS
 20 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_30_FPS
 30 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_60_FPS
 60 FPS
 
SceCameraFrameRate SCE_CAMERA_FRAMERATE_120_FPS
 120 FPS (only at 320 × 240, 160 × 120 and 352 × 288, otherwise 60 FPS is used)
 

Reverse modes

Used with camera.reverse()

SceCameraReverse SCE_CAMERA_REVERSE_OFF
 Normal picture.
 
SceCameraReverse SCE_CAMERA_REVERSE_MIRROR
 Mirrored horizontally.
 
SceCameraReverse SCE_CAMERA_REVERSE_FLIP
 Flipped vertically.
 
SceCameraReverse SCE_CAMERA_REVERSE_MIRROR_FLIP
 Mirrored and flipped.
 

Effects

Used with camera.effect()

SceCameraEffect SCE_CAMERA_EFFECT_NORMAL
 No effect.
 
SceCameraEffect SCE_CAMERA_EFFECT_NEGATIVE
 Inverted colors.
 
SceCameraEffect SCE_CAMERA_EFFECT_BLACKWHITE
 Black & white.
 
SceCameraEffect SCE_CAMERA_EFFECT_SEPIA
 Sepia.
 
SceCameraEffect SCE_CAMERA_EFFECT_BLUE
 Blue tint.
 
SceCameraEffect SCE_CAMERA_EFFECT_RED
 Red tint.
 
SceCameraEffect SCE_CAMERA_EFFECT_GREEN
 Green tint.
 

Saturation levels

Used with camera.saturation(), from least to most saturated

SceCameraSaturation SCE_CAMERA_SATURATION_0
 0.0
 
SceCameraSaturation SCE_CAMERA_SATURATION_5
 0.5
 
SceCameraSaturation SCE_CAMERA_SATURATION_10
 1.0 (normal)
 
SceCameraSaturation SCE_CAMERA_SATURATION_20
 2.0
 
SceCameraSaturation SCE_CAMERA_SATURATION_30
 3.0
 
SceCameraSaturation SCE_CAMERA_SATURATION_40
 4.0
 

Sharpness levels

Used with camera.sharpness()

SceCameraSharpness SCE_CAMERA_SHARPNESS_100
 100% (normal)
 
SceCameraSharpness SCE_CAMERA_SHARPNESS_200
 200%
 
SceCameraSharpness SCE_CAMERA_SHARPNESS_300
 300%
 
SceCameraSharpness SCE_CAMERA_SHARPNESS_400
 400%
 

Exposure compensation levels

Used with camera.exposure(). The number is the exposure value × 10, e.g. NEGATIVE_15 is -1.5 EV.

SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_20
 -2.0 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_17
 -1.7 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_15
 -1.5 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_13
 -1.3 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_10
 -1.0 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_7
 -0.7 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_5
 -0.5 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_NEGATIVE_3
 -0.3 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_0
 0 EV (normal)
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_3
 +0.3 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_5
 +0.5 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_7
 +0.7 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_10
 +1.0 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_13
 +1.3 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_15
 +1.5 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_17
 +1.7 EV
 
SceCameraExposureCompensation SCE_CAMERA_EV_POSITIVE_20
 +2.0 EV
 

Anti-flicker modes

Used with camera.antiflicker(). Reduces flickering caused by lights running at 50 or 60 Hz.

SceCameraAntiFlicker SCE_CAMERA_ANTIFLICKER_AUTO
 Detect automatically.
 
SceCameraAntiFlicker SCE_CAMERA_ANTIFLICKER_50HZ
 50 Hz
 
SceCameraAntiFlicker SCE_CAMERA_ANTIFLICKER_60HZ
 60 Hz
 

ISO levels

Used with camera.iso()

SceCameraISO SCE_CAMERA_ISO_AUTO
 Automatic.
 
SceCameraISO SCE_CAMERA_ISO_100
 ISO 100.
 
SceCameraISO SCE_CAMERA_ISO_200
 ISO 200.
 
SceCameraISO SCE_CAMERA_ISO_400
 ISO 400.
 

Gain levels

Used with camera.gain()

SceCameraGain SCE_CAMERA_GAIN_AUTO
 Automatic.
 
SceCameraGain SCE_CAMERA_GAIN_1
 Gain 1.
 
SceCameraGain SCE_CAMERA_GAIN_2
 Gain 2.
 
SceCameraGain SCE_CAMERA_GAIN_3
 Gain 3.
 
SceCameraGain SCE_CAMERA_GAIN_4
 Gain 4.
 
SceCameraGain SCE_CAMERA_GAIN_5
 Gain 5.
 
SceCameraGain SCE_CAMERA_GAIN_6
 Gain 6.
 
SceCameraGain SCE_CAMERA_GAIN_7
 Gain 7.
 
SceCameraGain SCE_CAMERA_GAIN_8
 Gain 8.
 
SceCameraGain SCE_CAMERA_GAIN_9
 Gain 9.
 
SceCameraGain SCE_CAMERA_GAIN_10
 Gain 10.
 
SceCameraGain SCE_CAMERA_GAIN_11
 Gain 11.
 
SceCameraGain SCE_CAMERA_GAIN_12
 Gain 12.
 
SceCameraGain SCE_CAMERA_GAIN_13
 Gain 13.
 
SceCameraGain SCE_CAMERA_GAIN_14
 Gain 14.
 
SceCameraGain SCE_CAMERA_GAIN_15
 Gain 15.
 
SceCameraGain SCE_CAMERA_GAIN_16
 Gain 16.
 

White balance modes

Used with camera.whitebalance()

SceCameraWhiteBalance SCE_CAMERA_WB_AUTO
 Automatic.
 
SceCameraWhiteBalance SCE_CAMERA_WB_DAY
 Daylight.
 
SceCameraWhiteBalance SCE_CAMERA_WB_CWF
 Cool white fluorescent light.
 
SceCameraWhiteBalance SCE_CAMERA_WB_SLSA
 Standard light source A (incandescent light)
 

Backlight modes

Used with camera.backlight()

SceCameraBacklight SCE_CAMERA_BACKLIGHT_OFF
 Backlight compensation off.
 
SceCameraBacklight SCE_CAMERA_BACKLIGHT_ON
 Backlight compensation on.
 

Night modes

Used with camera.nightmode()

SceCameraNightmode SCE_CAMERA_NIGHTMODE_OFF
 Night mode off.
 
SceCameraNightmode SCE_CAMERA_NIGHTMODE_LESS10
 For 10 lux or below.
 
SceCameraNightmode SCE_CAMERA_NIGHTMODE_LESS100
 For 100 lux or below.
 
SceCameraNightmode SCE_CAMERA_NIGHTMODE_OVER100
 For 100 lux or over.
 

Function Documentation

◆ camera.active()

boolean camera.active ( )

Checks if the camera is running

Returns
true if it's running

◆ camera.antiflicker()

SceCameraAntiFlicker camera.antiflicker ( SceCameraAntiFlicker mode)

Gets or sets the anti-flicker mode

Parameters
modeOne of the anti-flicker constants (optional)
Returns
The current anti-flicker mode if mode is omitted

◆ camera.backlight()

SceCameraBacklight camera.backlight ( SceCameraBacklight mode)

Gets or sets backlight compensation

Parameters
modeOne of the backlight constants (optional)
Returns
The current backlight mode if mode is omitted

◆ camera.brightness()

number camera.brightness ( number level)

Gets or sets the brightness

Parameters
levelBrightness from 0 to 255 (optional)
Returns
The current brightness if level is omitted

◆ camera.contrast()

number camera.contrast ( number level)

Gets or sets the contrast

Parameters
levelContrast from 0 to 255 (optional)
Returns
The current contrast if level is omitted

◆ camera.effect()

SceCameraEffect camera.effect ( SceCameraEffect effect)

Gets or sets the color effect

Parameters
effectOne of the effect constants (optional)
Returns
The current effect if effect is omitted

◆ camera.exposure()

SceCameraExposureCompensation camera.exposure ( SceCameraExposureCompensation level)

Gets or sets the exposure compensation

Parameters
levelOne of the exposure compensation constants (optional)
Returns
The current exposure compensation if level is omitted

◆ camera.gain()

SceCameraGain camera.gain ( SceCameraGain mode)

Gets or sets the gain

Parameters
modeOne of the gain constants (optional)
Returns
The current gain if mode is omitted

◆ camera.iso()

SceCameraISO camera.iso ( SceCameraISO mode)

Gets or sets the ISO

Parameters
modeOne of the ISO constants (optional)
Returns
The current ISO if mode is omitted

◆ camera.nightmode()

SceCameraNightmode camera.nightmode ( SceCameraNightmode mode)

Gets or sets the night mode, which helps in dark places

Parameters
modeOne of the night mode constants (optional)
Returns
The current night mode if mode is omitted

◆ camera.noisereduction()

number camera.noisereduction ( number level)

Gets or sets the noise reduction

Parameters
levelNoise reduction level, a higher value removes more noise (optional)
Returns
The current noise reduction level if level is omitted

◆ camera.output()

image camera.output ( )

Gets the latest camera frame

Returns
The frame as an image. It's always the same image object, updated with the new frame each time you call this, so save it with image.save() if you want to keep a frame (e.g. to take a photo).

◆ camera.reverse()

SceCameraReverse camera.reverse ( SceCameraReverse mode)

Gets or sets the mirroring/flipping of the picture

Parameters
modeOne of the reverse mode constants (optional)
Returns
The current reverse mode if mode is omitted

◆ camera.saturation()

SceCameraSaturation camera.saturation ( SceCameraSaturation level)

Gets or sets the saturation

Parameters
levelOne of the saturation constants (optional)
Returns
The current saturation if level is omitted

◆ camera.sharpness()

SceCameraSharpness camera.sharpness ( SceCameraSharpness level)

Gets or sets the sharpness

Parameters
levelOne of the sharpness constants (optional)
Returns
The current sharpness if level is omitted

◆ camera.start()

nil camera.start ( SceCameraDevice device,
SceCameraResolution resolution,
SceCameraFrameRate fps )

Starts a camera. Raises an error if a camera is already running.

Parameters
deviceWhich camera, one of the device constants
resolutionOne of the resolution constants
fpsOne of the frame rate constants (optional, default: SCE_CAMERA_FRAMERATE_60_FPS)

◆ camera.stop()

nil camera.stop ( )

Stops the camera

◆ camera.whitebalance()

SceCameraWhiteBalance camera.whitebalance ( SceCameraWhiteBalance mode)

Gets or sets the white balance

Parameters
modeOne of the white balance constants (optional)
Returns
The current white balance if mode is omitted

◆ camera.zoom()

number camera.zoom ( number level)

Gets or sets the zoom

Parameters
levelZoom level, a higher value zooms in more (optional)
Returns
The current zoom level if level is omitted