Documentation ¶
Overview ¶
Package piCamera is a simple wrapper for raspivid.
There is a non-RaspberryPi version that is used for local development. This can become handy when the IDE does not know how to handle certain features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWBGains ¶
type AWBGains struct {
// contains filtered or unexported fields
}
AWBGains sets the blue and red gains to be applied when AWBOff is set.
func NewAWBGains ¶
NewAWBGains creates gains to set to Red and Blue. Values are multiplied to the values so 1.5 is 150% and .5 is 50%.
type AWBType ¶
type AWBType int
AWBType is for setting the Automatic White Balance setting.
const ( //AwbAuto is for automatic white balance AwbAuto AWBType = iota //AwbOff is for turning automatic white balance off AwbOff //AwbSun is for sunny mode AwbSun //AwbCloud is for cloudy mode AwbCloud //AwbShade is for shade mode AwbShade //AwbTungsten tungsten lighting mode AwbTungsten //AwbFluorescent fluorescent lighting mode AwbFluorescent //AwbIncandescent incandescent lighting mode AwbIncandescent //AwbFlash flash mode AwbFlash //AwbHorizon horizon mode AwbHorizon )
type ColourEffect ¶
type ColourEffect struct {
// contains filtered or unexported fields
}
ColourEffect is used fo setting which color effect one wants.
func NewColourEffect ¶
func NewColourEffect(u, v int) *ColourEffect
NewColourEffect creates a colour effect of the U and Y channel of the image. Values should be in the range from (0, 255).
func (*ColourEffect) Convert ¶
func (t *ColourEffect) Convert() string
Convert takes the type and returns the string representation of that value.
type ExposureType ¶
type ExposureType int
ExposureType is for setting the exposure mode.
const ( //ExpNone is used to tell this package to use whatever the default is. ExpNone ExposureType = iota //ExpAuto use automatic exposure mode ExpAuto //ExpNight select setting for night shooting ExpNight //ExpBacklight select setting for backlit subject ExpBacklight //ExpSpotlight select setting for spotlit subject ExpSpotlight //ExpSports select setting for sports ExpSports //ExpSnow select setting optimised for snowy scenery ExpSnow //ExpBeach select setting optimised for beach ExpBeach //ExpVerylong select setting for long exposures ExpVerylong //ExpFixedfps constrain fps to a fixed value ExpFixedfps //ExpAntishake turns on antishake mode ExpAntishake //ExpFireworks select setting optimised for fireworks ExpFireworks )
func (ExposureType) Convert ¶
func (t ExposureType) Convert() (string, bool)
Convert takes the type and returns the string representation of that value. Returns true as well if it is the default value.
type ImgEffectType ¶
type ImgEffectType int
ImgEffectType is used for setting the image effect to use.
const ( //ImfxNone no effect ImfxNone ImgEffectType = iota //ImfxNegative invert the image colours ImfxNegative //ImfxSolarise solarise the image ImfxSolarise //ImfxPosterise posterise the image ImfxPosterise //ImfxWhiteboard whiteboard effect ImfxWhiteboard //ImfxBlackboard blackboard effect ImfxBlackboard //ImfxSketch sketch effect ImfxSketch //ImfxDenoise denoise the image ImfxDenoise //ImfxEmboss the image ImfxEmboss //ImfxOilpaint oil paint effect ImfxOilpaint //ImfxHatch hatch sektch effect ImfxHatch //ImfxGPen graphite sketch effect ImfxGPen //ImfxPastel pastel effect ImfxPastel //ImfxWatercolour watercolour effect ImfxWatercolour //ImfxFilm film grain effect ImfxFilm //ImfxBlur blur the image ImfxBlur //ImfxSaturation colour saturate the image ImfxSaturation )
func (ImgEffectType) Convert ¶
func (t ImgEffectType) Convert() (string, bool)
Convert takes the type and returns the string representation of that value. Returns true as well if it is the default value.
type MeteringType ¶
type MeteringType int
MeteringType is used for setting the Metering Mode.
const ( //MeterNone tell this package to use whatever the default is MeterNone MeteringType = iota //MeterAverage average the whole frame for metering MeterAverage //MeterSpot use spot metering MeterSpot //MeterBacklit will assume a backlit image MeterBacklit //MeterMatrix use matrix metering MeterMatrix )
func (MeteringType) Convert ¶
func (t MeteringType) Convert() (string, bool)
Convert takes the type and returns the string representation of that value. Returns true as well if it is the default value.
type PiCamera ¶
type PiCamera struct {
// contains filtered or unexported fields
}
PiCamera creates a way for code to be able to pull images from the camera live. You must start eh raspivid explicitly first but once started, PiCamera will have the latest image available to view.
PiCamera is thread safe so many calls to GetFrame() will not break. Be careful as the more calls to GetFrame() the slower GetFrame() may become due to all the read locks.
func New ¶
func New(parentCtx context.Context, args *RaspividArgs) (*PiCamera, error)
New creates an instance of PiCamera. Width and Height are for the image size. ctx is the parent context. If nil a background context will be created.
This creates the command raspivid with the appropriate settings. The stdErr of the command is redirected to os.Stderr so that one may see why the command may have failed.
func (*PiCamera) GetFrame ¶
GetFrame returns the latest frame from raspivid. If there is no frame available it will throw an error.
type ProfileType ¶
type ProfileType int
ProfileType sets the H264 profile to be used for the encoding.
const ( //ProfileNone tells this package to use whatever the default is. ProfileNone ProfileType = iota //ProfileBaseline is for the baseline profile ProfileBaseline //ProfileMain is for the main profile ProfileMain //ProfileHigh is for a high profile ProfileHigh )
func (ProfileType) Convert ¶
func (t ProfileType) Convert() (string, bool)
Convert takes the type and returns the string representation of that value. Returns true as well if it is the default value.
type RaspividArgs ¶
type RaspividArgs struct { Width int // width of the image Height int // height of the image HorizFlip bool // flip the image horizontally VertFlip bool // flip the camera vertically Sharpness int // change the sharpness of the camera (-100 , 100 DEF 0) Contrast int // change the contrast of the camera (-100 , 100 DEF 0) Brightness int // change the brightness of the camera (0 , 100 DEF 50) Saturation int // change the saturation of the camera (-100 , 100 DEF 0) ISO int // change the sensitivity the camera is to light (100 , 800 DEF 100) VideoStable bool // try to stableize the video EV int // Slightly under or over expose the camera (-10 , 10 DEF 0) ExposureMode ExposureType // set which mode to use for exposure AWB AWBType // set the automatic white balance mode ImageFx ImgEffectType // set the image effect ColourFx *ColourEffect // set the color effects to an image Metering MeteringType // ste the metering mode Rotation int // set the rotation of the image. (0, 90, 180, 270) ROI *RegionOfIntrest // set the cameras region of intrest ShutterSpeed int // set the shutter speed in microseconds (Max 6000000) DRC DRCType // set the dynamic range compression AWBGains *AWBGains // set the AWBGains when AWB is off Mode int // set the mode of the camera by checking the documentation Annotate string // annotate the image according to the documentation AnnotateExtra string // annotate the image according to the documentation Bitrate int // set the bitrate in bits per second. Max is 25000000 FPS int // set the frames per second (2 , 30) IntraRate int // set number of frames before next intra frame Quantization int // set Quantization parameter Profile ProfileType // set the profile type InsertHeaders bool // insert pps, sps headers to every I-Frame }
RaspividArgs are arguments used to set camera settings for the desired output https://www.raspberrypi.org/documentation/raspbian/applications/camera.md
func NewArgs ¶
func NewArgs() *RaspividArgs
NewArgs returns a RaspividArgs with the default settings
type RegionOfIntrest ¶
type RegionOfIntrest struct {
// contains filtered or unexported fields
}
RegionOfIntrest is used to set the cameras area to be used as the source.
func NewROI ¶
func NewROI(tlx, tly, w, h float32) *RegionOfIntrest
NewROI creates a new Region of Intrest. tlx and tly are the top left x and y of ROI. w and h are the width and height of the ROI. All points should be normalized from 0.0 - 1.0.
func (*RegionOfIntrest) Convert ¶
func (t *RegionOfIntrest) Convert() string
Convert takes the type and returns the string representation of that value.