17. Camera
The camera object is a built-in object that provides camera functionality.
Functional overview:
- Supports still image capture function.
Limitations:
- It can be used only when the Spresense camera board (ISX012 camera module) is connected.
- Only JPEG format of QVGA size (Width: 320px, Height: 240px) is available for still images.
Camera Global Object
Methods()/Properties | Summary | Version | Note |
---|---|---|---|
camera.open() | Starts the camera module. | 01.00.00+ | |
camera.close() | Stops the camera module. | 01.00.00+ | |
camera.capture() | Captures a still image. | 01.00.00+ |
Details
camera.open()
Starts the camera module.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
return | boolean | - | true: Success false: Failure | If the camera module is not connected, it will fail. |
camera.close()
Stops the camera module.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
return | undefined | - | - |
camera.capture()
Captures a still image.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
return | ArrayBuffer, undefined | - | Still image data in JPEG format | If capture fails, undefined will be returned. |
Object Usage Examples
Sample1
This is a sample that captures a still image.
camera.open();
var img = camera.capture();
// upload image data
camera.close();
Updated: 2020-06-01