Picam v0.1.0 Picam

This module contains functions to manipulate, capture, and stream MJPEG video on a Raspberry Pi using the camera module.

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

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

Functions

next_frame()

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

set_annotation_bg(arg1)

Enable or disable a black background behind the annotation.

set_annotation_text(annotation \\ "")

Annotate the JPEG frames with the text in annotation.

set_awb_mode(mode \\ :auto)

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)

Set the image brightness.

The accepted range is [0, 100].

set_col_effect(effect \\ :none)

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_colfx({128,128}) # Black and white
:ok
set_contrast(contrast \\ 0)

Set the image contrast.

The accepted range is [-100, 100].

set_ev(ev \\ 0)

Set the exposure compensation (EV) level.

The accepted range is [-25, 25].

set_exposure_mode(mode \\ :auto)

Set the exposure mode.

The accepted modes are:

  • :auto
  • :night
  • :nightpreview
  • :backlight
  • :spotlight
  • :sports
  • :snow
  • :beach
  • :verylong
  • :fixedfps
  • :antishake
  • :fireworks
set_fps(rate \\ 0)

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)

Flip the image horizontally.

set_img_effect(effect \\ :none)

Set the image effect.

The accepted effects are:

  • :none
  • :negative
  • :solarise
  • :sketch
  • :denoise
  • :emboss
  • :oilpaint
  • :hatch
  • :gpen
  • :pastel
  • :watercolour | :watercolor
  • :film
  • :blur
  • :saturation
  • :colourswap | :colorswap
  • :washedout
  • :posterise
  • :colourpoint | :colorpoint
  • :colourbalance | :colorbalance
  • :cartoon
set_iso(iso \\ 0)

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)

Set the metering mode.

The accepted modes are:

  • :average
  • :spot
  • :backlit
  • :matrix
set_quality(quality \\ 15)

Set the JPEG quality.

The accepted range is [1, 100].

set_restart_interval(interval \\ 0)

Set the JPEG restart interval.

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

set_roi(roi \\ "0:0:1:1")

Set a region of interest.

(x,y,w,h as normalized coordinates [0.0, 1.0])

set_rotation(angle \\ 0)

Set the image rotation angle in degrees.

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

set_saturation(saturation \\ 0)

Set the image saturation.

The accepted range is [-100, 100].

set_sensor_mode(mode \\ 0)

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.

set_sharpness(sharpness \\ 0)

Set the image sharpness.

The accepted range is [-100, 100].

set_shutter_speed(speed \\ 0)

Set the shutter speed in microseconds

If the speed given is 0, it will be automatically regulated.

set_size(width, height)

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)

Flip the image vertically.

set_vstab(arg1)

Enable or disable video stabilization.