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

Returns a binary with the contents of a single JPEG frame from the camera.

Enable or disable a black background behind the annotation.

Link to this function

set_annotation_text(annotation \\ "") View Source

Annotate the JPEG frames with the text in annotation.

Link to this function

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
Link to this function

set_brightness(brightness \\ 50) View Source

Set the image brightness.

The accepted range is [0, 100].

Link to this function

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
Link to this function

set_contrast(contrast \\ 0) View Source

Set the image contrast.

The accepted range is [-100, 100].

Set the exposure compensation (EV) level.

The accepted range is [-25, 25].

Link to this function

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

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.

Flip the image horizontally.

Link to this function

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 the capture ISO.

The accepted range is [0, 800].

If the iso given is 0, it will be automatically regulated by the camera.

Link to this function

set_metering_mode(mode \\ :average) View Source

Set the metering mode.

The accepted modes are:

  • :average
  • :spot
  • :backlit
  • :matrix
Link to this function

set_preview_enabled(arg1) View Source

Enable or disable video preview output to the attached display(s).

Defaults to false.

Link to this function

set_preview_fullscreen(arg1) View Source

Enable or disable full-screen output for video preview.

Defaults to true.

Link to this function

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.

Link to this function

set_quality(quality \\ 15) View Source

Set the JPEG quality.

The accepted range is [1, 100].

Link to this function

set_restart_interval(interval \\ 0) View Source

Set the JPEG restart interval.

If the interval given is 0, restart intervals will not be used.

Link to this function

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])

Link to this function

set_rotation(angle \\ 0) View Source

Set the image rotation angle in degrees.

The accepted angles are 0, 90, 180, or 270.

Link to this function

set_saturation(saturation \\ 0) View Source

Set the image saturation.

The accepted range is [-100, 100].

Link to this function

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

#ResolutionRatioFPS RangeVideoImageFoVBinning
11920x108016:9(1, 30]YPartialNone
22592x19444:3(1, 15]YYFullNone
32592x19444:3[0.16, 1]YYFullNone
41296x9724:3(1, 42]YFull2x2
51296x73016:9(1, 49]YFull2x2
6640x4804:3(42, 60]YFull4x4
7640x4804:3(60, 90]YFull4x4

V2 Camera Module

#ResolutionRatioFPS RangeVideoImageFoVBinning
11920x108016:9[0.10, 30]YPartialNone
23280x24644:3[0.10, 15]YNFullNone
33280x24644:3[0.10, 15]YNFullNone
41640x12324:3[0.10, 40]YFull2x2
51640x92216:9[0.10, 40]YFull2x2
61280x72016:9(40, 90]YPartial2x2
7640x4804:3(40, 90]YPartial2x2

If the mode given is 0, the camera will select a mode automatically.

Link to this function

set_sharpness(sharpness \\ 0) View Source

Set the image sharpness.

The accepted range is [-100, 100].

Link to this function

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 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.