Picam v0.4.1 Picam View Source
This module contains functions to manipulate, capture, and stream MJPEG video on a Raspberry Pi using the camera module.
Link to this section Summary
Functions
Returns a binary with the contents of a single JPEG frame from the camera.
Enable or disable a black background behind the annotation.
Annotate the JPEG frames with the text in annotation
.
Set the Automatic White Balance (AWB) mode.
Set the image brightness.
Set the color effect applied by the camera.
Set the image contrast.
Set the exposure compensation (EV) level.
Set the exposure mode.
Limit the frame rate to the given rate
.
Flip the image horizontally.
Set the image effect.
Set the capture ISO.
Set the metering mode.
Enable or disable video preview output to the attached display(s).
Enable or disable full-screen output for video preview.
Set the location and size of the (non-fullscreen) video preview. This option is ignored when fullscreen preview is enabled.
Set the JPEG quality.
Set the JPEG restart interval.
Set a region of interest.
Set the image rotation angle in degrees.
Set the image saturation.
Set the sensor mode.
Set the image sharpness.
Set the shutter speed in microseconds
Set the image size. One of the dimensions may be set to 0 to auto-calculate it based on the aspect ratio of the camera.
Flip the image vertically.
Enable or disable video stabilization.
Link to this section Functions
next_frame() View Source
Returns a binary with the contents of a single JPEG frame from the camera.
set_annotation_bg(arg1) View Source
Enable or disable a black background behind the annotation.
set_annotation_text(annotation \\ "") View Source
Annotate the JPEG frames with the text in annotation
.
set_awb_mode(mode \\ :auto) View Source
Set the Automatic White Balance (AWB) mode.
The accepted modes are:
:off
:auto
:sun
:cloud
:shade
:tungsten
:fluorescent
:incandescent
:flash
:horizon
set_brightness(brightness \\ 50) View Source
Set the image brightness.
The accepted range is [0, 100].
set_col_effect(effect \\ :none) View Source
Set the color effect applied by the camera.
The effect is set with the tuple {u,v}
.
The accepted range for both values is [0, 255].
If the effect
given is :none
, color effects will be disabled.
Examples
iex> Picam.set_col_effect({128,128}) # Black and white
:ok
set_contrast(contrast \\ 0) View Source
Set the image contrast.
The accepted range is [-100, 100].
set_ev(ev \\ 0) View Source
Set the exposure compensation (EV) level.
The accepted range is [-25, 25].
set_exposure_mode(mode \\ :auto) View Source
Set the exposure mode.
The accepted modes are:
:auto
:night
:nightpreview
:backlight
:spotlight
:sports
:snow
:beach
:verylong
:fixedfps
:antishake
:fireworks
set_fps(rate \\ 0) View Source
Limit the frame rate to the given rate
.
The accepted range is [0.0, 90.0], but the actual rate used is governed
by the current sensor_mode
.
If the rate
given is 0 (or 0.0), frame rate will be automatically regulated.
set_hflip(arg1) View Source
Flip the image horizontally.
set_img_effect(effect \\ :none) View Source
Set the image effect.
The accepted effects are:
:none
:negative
:solarise
:sketch
:denoise
:emboss
:oilpaint
:hatch
:gpen
:pastel
:watercolor
:film
:blur
:saturation
:colorswap
:washedout
:posterise
:colorpoint
:colorbalance
:cartoon
set_iso(iso \\ 0) View Source
Set the capture ISO.
The accepted range is [0, 800].
If the iso
given is 0, it will be automatically regulated by the camera.
set_metering_mode(mode \\ :average) View Source
Set the metering mode.
The accepted modes are:
:average
:spot
:backlit
:matrix
set_preview_enabled(arg1) View Source
Enable or disable video preview output to the attached display(s).
Defaults to false
.
set_preview_fullscreen(arg1) View Source
Enable or disable full-screen output for video preview.
Defaults to true
.
set_preview_window(x, y, width, height) View Source
Set the location and size of the (non-fullscreen) video preview. This option is ignored when fullscreen preview is enabled.
Defaults to true
.
set_quality(quality \\ 15) View Source
Set the JPEG quality.
The accepted range is [1, 100].
set_restart_interval(interval \\ 0) View Source
Set the JPEG restart interval.
If the interval
given is 0, restart intervals will not be used.
set_roi(roi \\ "0:0:1:1") View Source
Set a region of interest.
(x,y,w,h as normalized coordinates [0.0, 1.0])
set_rotation(angle \\ 0) View Source
Set the image rotation angle in degrees.
The accepted angles are 0, 90, 180, or 270.
set_saturation(saturation \\ 0) View Source
Set the image saturation.
The accepted range is [-100, 100].
set_sensor_mode(mode \\ 0) View Source
Set the sensor mode.
Details on the accepted modes (0-7) are listed in the tables below:
V1 Camera Module
# | Resolution | Ratio | FPS Range | Video | Image | FoV | Binning |
---|---|---|---|---|---|---|---|
1 | 1920x1080 | 16:9 | (1, 30] | Y | Partial | None | |
2 | 2592x1944 | 4:3 | (1, 15] | Y | Y | Full | None |
3 | 2592x1944 | 4:3 | [0.16, 1] | Y | Y | Full | None |
4 | 1296x972 | 4:3 | (1, 42] | Y | Full | 2x2 | |
5 | 1296x730 | 16:9 | (1, 49] | Y | Full | 2x2 | |
6 | 640x480 | 4:3 | (42, 60] | Y | Full | 4x4 | |
7 | 640x480 | 4:3 | (60, 90] | Y | Full | 4x4 |
V2 Camera Module
# | Resolution | Ratio | FPS Range | Video | Image | FoV | Binning |
---|---|---|---|---|---|---|---|
1 | 1920x1080 | 16:9 | [0.10, 30] | Y | Partial | None | |
2 | 3280x2464 | 4:3 | [0.10, 15] | Y | N | Full | None |
3 | 3280x2464 | 4:3 | [0.10, 15] | Y | N | Full | None |
4 | 1640x1232 | 4:3 | [0.10, 40] | Y | Full | 2x2 | |
5 | 1640x922 | 16:9 | [0.10, 40] | Y | Full | 2x2 | |
6 | 1280x720 | 16:9 | (40, 90] | Y | Partial | 2x2 | |
7 | 640x480 | 4:3 | (40, 90] | Y | Partial | 2x2 |
If the mode
given is 0, the camera will select a mode automatically.
set_sharpness(sharpness \\ 0) View Source
Set the image sharpness.
The accepted range is [-100, 100].
set_shutter_speed(speed \\ 0) View Source
Set the shutter speed in microseconds
If the speed
given is 0, it will be automatically regulated.
set_size(width, height) View Source
Set the image size. One of the dimensions may be set to 0 to auto-calculate it based on the aspect ratio of the camera.
set_vflip(arg1) View Source
Flip the image vertically.
set_vstab(arg1) View Source
Enable or disable video stabilization.