Documentation
¶
Overview ¶
Package raspicam provides basic Go APIs for interacting with the Raspberry Pi camera.
All captures are prepared by first creating a CaptureCommand (Still, StillYUV or Vid structs via calls to the NewStill, NewStillYUV or NewVid functions respectively). The Capture function can then be used to perform the capture.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRaspiStillCommand = "raspistill"
DefaultRaspiStillCommand is the default command for capturing stills.
var DefaultRaspiStillYUVCommand = "raspiyuv"
DefaultRaspiStillYUVCommand is the default command for capturing YUV stills.
var DefaultRaspiVidCommmand = "raspivid"
DefaultRaspiVidCommmand is the default command for capturing video.
Functions ¶
Types ¶
type BaseStill ¶
type BaseStill struct { CamSelect int Timeout time.Duration // Delay before image is taken Width, Height int // Image dimensions Timelapse int // The number of pictures to take in the given timeout interval Camera Camera Preview Preview // The command to run when making a still capture. If left blank, the default // command is used. Command string // Additional arguments. Default is empty. Args []string }
BaseStill represents the common elements between a Still and StillYUV as described in their equivalents found in RaspiStill.c and RaspiStillYUV.c respectively.
type Camera ¶
type Camera struct { Sharpness int // -100 to 100 Contrast int // -100 to 100 Brightness int // 0 to 100 Saturation int // -100 to 100 ISO int // TODO: what range? (see RaspiCamControl.h) VideoStabilisation bool ExposureCompensation int // -10 to 10? (see RaspiCamControl.h) ExposureMode ExposureMode MeteringMode MeteringMode AWBMode AWBMode ImageEffect ImageFX ColourEffects ColourFX Rotation int // 0 to 359 HFlip, VFlip bool RegionOfInterest FloatRect // Assumes Normalised to [0.0,1.0] ShutterSpeed time.Duration }
Camera represents a camera configuration.
type CaptureCommand ¶
CaptureCommand represents a prepared capture command.
type Encoding ¶
type Encoding uint
Encoding represents an enumeration of the supported encoding types.
type ExposureMode ¶
type ExposureMode uint
ExposureMode is an enumeration of supported exposure modes.
const ( ExposureOff ExposureMode = iota ExposureAuto ExposureNight ExposureNightPreview ExposureBacklight ExposureSpotlight ExposureSports ExposureSnow ExposureBeach ExposureVerylong ExposureFixedFPS ExposureAntishake ExposureFireworks )
func (ExposureMode) String ¶
func (e ExposureMode) String() string
String returns the command line parameter for the given ExposureMode.
type FloatRect ¶
type FloatRect struct {
X, Y, W, H float64
}
FloatRect contains the information necessary to construct a rectangle with dimensions in floating point.
type MeteringMode ¶
type MeteringMode uint
A MeteringMode specificies an exposure metering mode.
const ( MeteringAverage MeteringMode = iota MeteringSpot MeteringBacklit MeteringMatrix )
func (MeteringMode) String ¶
func (m MeteringMode) String() string
String returns the command line parameter for the given MeteringMode.
type Preview ¶
type Preview struct { Mode PreviewMode Opacity int // Opacity of window (0 = transparent, 255 = opaque) Rect Rect // Used when Mode is PreviewWindow }
Preview contains the settings for the camera previews.
type PreviewMode ¶
type PreviewMode uint
PreviewMode represents an enumeration of preview modes.
const ( PreviewFullscreen PreviewMode = iota // Enabled by default PreviewWindow PreviewDisabled )
func (PreviewMode) String ¶
func (p PreviewMode) String() string
String returns the parameter string for the given PreviewMode.
type Rect ¶
type Rect struct {
X, Y, Width, Height uint32
}
Rect represents a rectangle defined by integer parameters.
type Still ¶
type Still struct { BaseStill Quality int // Quality (for lossy encoding) Raw bool // Want a raw image? Encoding Encoding }
Still represents the configuration necessary to call raspistill.
func NewStill ¶
func NewStill() *Still
NewStill returns a *Still with the default values set by the raspistill command (see userland/linux/apps/raspicam/RaspiStill.c).
type StillYUV ¶
StillYUV represents the configuration necessary to call raspistillYUV.
func NewStillYUV ¶
func NewStillYUV() *StillYUV
NewStillYUV returns a *StillYUV with the default values set by the raspiyuv command (see userland/linux/apps/raspicam/RaspiStillYUV.c).
type Vid ¶
type Vid struct { Timeout time.Duration // Delay before image is taken Width, Height int // Image dimensions Bitrate int // Requested bitrate Framerate int // Requested framerate (fps) IntraPeriod int // Intra-refresh period (key frame rate) // Flag to specify whether encoder works in place or creates a new buffer. // Result is preview can display either the camera output or the encoder // output (with compression artifacts). ImmutableInput bool Camera Camera Preview Preview // The command to run when making a video capture. If left blank, the default // command is used. Command string // Additional arguments. Default is empty. Args []string }
Vid represents the the configuration used to call raspivid.
func NewVid ¶
func NewVid() *Vid
NewVid returns a new *Vid struct setup with the default configuration.