Documentation ¶
Index ¶
- Constants
- func CorrectRectangle(i Image, rect image.Rectangle) (result image.Rectangle)
- func GetBaseFilename(t time.Time, saveDirectory string, name string, title string, ...) string
- func GetImageFilename(t time.Time, saveDirectory string, name string, title string, ...) string
- func GetVideoFilename(t time.Time, saveDirectory string, name string, fileType string, portable bool) (filename string)
- func RectAddHeight(i Image, rect image.Rectangle, height int) (result image.Rectangle)
- func RectAddWidth(i Image, rect image.Rectangle, width int) (result image.Rectangle)
- func RectOverlap(rect1 image.Rectangle, rect2 image.Rectangle) (percentage1 int, percentage2 int)
- func RectPadded(i Image, rect image.Rectangle, paddingPercent int) (result image.Rectangle)
- func RectRect(i Image, rect image.Rectangle) (result image.Rectangle)
- func RectRelative(i Image, child image.Rectangle, parent image.Rectangle) (result image.Rectangle)
- func RectScale(i Image, rect image.Rectangle, scale float64) (result image.Rectangle)
- func RectSquare(i Image, rect image.Rectangle) (result image.Rectangle)
- func SaveImage(img Image, t time.Time, saveDirectory string, jpegQuality int, name string, ...) (savePath string)
- func SavePreview(img Image, t time.Time, saveDirectory string, name string, title string, ...) (savePath string)
- type BaseVideo
- type Color
- type ColorThickness
- type FaceInfo
- type FileSource
- type FrameStats
- type FrameStatsCombo
- type IPCamSource
- type Image
- func (i *Image) ChangeQuality(percent int)
- func (i *Image) Cleanup() (filled bool, closed bool)
- func (i *Image) Clone() *Image
- func (i *Image) EncodedQuality(percent int) []byte
- func (i *Image) GetRegion(rect image.Rectangle) (region Image)
- func (i *Image) Height() int
- func (i *Image) IsFilled() bool
- func (i *Image) Ref() *Image
- func (i *Image) ScaleToWidth(width int) Image
- func (i *Image) Width() int
- type ImageByCreatedTime
- type ImageList
- type MotionInfo
- type ObjectInfo
- type ProcessedImage
- func (p *ProcessedImage) Cleanup()
- func (p *ProcessedImage) Clone() *ProcessedImage
- func (p ProcessedImage) Face(index int) *Image
- func (p *ProcessedImage) HasFace() bool
- func (p *ProcessedImage) HasMotion() bool
- func (p *ProcessedImage) HasObject() bool
- func (p *ProcessedImage) HighlightedAll() *Image
- func (p *ProcessedImage) HighlightedFace() *Image
- func (p *ProcessedImage) HighlightedMotion() *Image
- func (p *ProcessedImage) HighlightedObject() *Image
- func (p ProcessedImage) Motion(index int) *Image
- func (p ProcessedImage) Object(index int) *Image
- func (p *ProcessedImage) Ref() *ProcessedImage
- type ProcessedImageByCreatedTime
- type ProcessedImageByFaceLen
- type ProcessedImageByFacePercent
- type ProcessedImageByObjLen
- type ProcessedImageByObjPercent
- type ProcessedImageFpsChan
- type RingBufferImage
- type RingBufferProcessedImage
- func (r *RingBufferProcessedImage) Len() int
- func (r *RingBufferProcessedImage) Pop() (popped ProcessedImage)
- func (r *RingBufferProcessedImage) PopAll() (popped []ProcessedImage)
- func (r *RingBufferProcessedImage) Push(img ProcessedImage) (popped ProcessedImage)
- func (r *RingBufferProcessedImage) Ready() <-chan bool
- func (r *RingBufferProcessedImage) SortByContent()
- func (r *RingBufferProcessedImage) SortByCreatedTime()
- type VideoReader
- func (v *VideoReader) GetOutputStatsChan() (result <-chan interface{})
- func (v *VideoReader) GetSourceStatsChan() (result <-chan interface{})
- func (v *VideoReader) GetStatsOutput(timeoutMs int) (result *FrameStats)
- func (v *VideoReader) GetStatsSource(timeoutMs int) (result *FrameStats)
- func (v *VideoReader) SetQuality(percent int)
- func (v *VideoReader) Start() <-chan Image
- func (v *VideoReader) Stop()
- func (v *VideoReader) Wait()
- type VideoSource
- type VideoStats
- type VideoWriter
Constants ¶
const ( ActivityImage = 0 ActivityMotion = 1 ActivityObject = 2 ActivityFace = 3 )
VideoWriter constants
Variables ¶
This section is empty.
Functions ¶
func CorrectRectangle ¶
CorrectRectangle will fix a rectangle to fit within the Image i
func GetBaseFilename ¶
func GetBaseFilename(t time.Time, saveDirectory string, name string, title string, percentage string) string
GetBaseFilename will return a formatted base filename with current date time
func GetImageFilename ¶
func GetImageFilename(t time.Time, saveDirectory string, name string, title string, percentage string) string
GetImageFilename will return an image filename
func GetVideoFilename ¶
func GetVideoFilename(t time.Time, saveDirectory string, name string, fileType string, portable bool) (filename string)
GetVideoFilename will return a video filename
func RectAddHeight ¶
RectAddHeight will add height to the rect as evenly as possible
func RectAddWidth ¶
RectAddWidth will add width to the rect as evenly as possible
func RectOverlap ¶
RectOverlap returns the rectangle's percentage overlapped by the other
func RectPadded ¶
RectPadded returns a padded rectangle
func RectRelative ¶
RectRelative returns a relative rectangle given child and parent rectangles
func RectSquare ¶
RectSquare will return a square that fits within the Image i
Types ¶
type BaseVideo ¶
type BaseVideo struct {
// contains filtered or unexported fields
}
BaseVideo contains common video source info
func (*BaseVideo) Initialize ¶
Initialize implements interface
type ColorThickness ¶ added in v1.27.0
func NewColorThickness ¶ added in v1.27.0
func NewColorThickness(color string, thickness int) *ColorThickness
type FaceInfo ¶
type FaceInfo struct { Rect image.Rectangle Percentage int HighlightInfo ColorThickness }
FaceInfo contains the face information
func NewFaceInfo ¶
func NewFaceInfo(rect image.Rectangle, colorThickness ColorThickness) *FaceInfo
NewFaceInfo creates a new FaceInfo
type FileSource ¶
type FileSource struct { BaseVideo // contains filtered or unexported fields }
FileSource is a file source
func (*FileSource) Initialize ¶
func (f *FileSource) Initialize() (ok bool)
Initialize implements interface
func (*FileSource) ReadImage ¶
func (f *FileSource) ReadImage() (done bool, image Image)
ReadImage implements interface
type FrameStats ¶ added in v1.22.0
type FrameStatsCombo ¶ added in v1.26.0
type FrameStatsCombo struct { In FrameStats Out FrameStats }
type IPCamSource ¶
type IPCamSource struct { BaseVideo // contains filtered or unexported fields }
IPCamSource is a ipcam source
func (*IPCamSource) Initialize ¶
func (i *IPCamSource) Initialize() (ok bool)
Initialize implements interface
func (*IPCamSource) ReadImage ¶
func (i *IPCamSource) ReadImage() (done bool, image Image)
ReadImage implements interface
type Image ¶
Image contains an image
func (*Image) ChangeQuality ¶
ChangeQuality will change the Image quality to percent param
func (*Image) EncodedQuality ¶
EncodedQuality returns a JPEG byte array with the given quality percentage
func (*Image) ScaleToWidth ¶
ScaleToWidth will return a copy of the Image to scale given the width
type ImageByCreatedTime ¶
type ImageByCreatedTime []Image
ImageByCreatedTime sorting ascending order
func (ImageByCreatedTime) Len ¶
func (b ImageByCreatedTime) Len() int
func (ImageByCreatedTime) Less ¶
func (b ImageByCreatedTime) Less(i, j int) bool
func (ImageByCreatedTime) Swap ¶
func (b ImageByCreatedTime) Swap(i, j int)
type ImageList ¶
type ImageList struct {
// contains filtered or unexported fields
}
ImageList is a list of Images
type MotionInfo ¶ added in v1.27.0
type MotionInfo struct { Rect image.Rectangle HighlightInfo ColorThickness }
MotionInfo contains the motion information
func NewMotionInfo ¶ added in v1.27.0
func NewMotionInfo(rect image.Rectangle, colorThickness ColorThickness) *MotionInfo
NewMotionInfo creates a new MotionInfo
func (*MotionInfo) Cleanup ¶ added in v1.27.0
func (m *MotionInfo) Cleanup()
Cleanup will cleanup the MotionInfo
func (*MotionInfo) Clone ¶ added in v1.27.0
func (m *MotionInfo) Clone() *MotionInfo
Clone will clone the MotionInfo
func (*MotionInfo) Ref ¶ added in v1.27.0
func (m *MotionInfo) Ref() *MotionInfo
Ref will reference the MotionInfo and underlying SharedMat
type ObjectInfo ¶
type ObjectInfo struct { Rect image.Rectangle Description string Percentage int HighlightInfo ColorThickness }
ObjectInfo contains the object information
func NewObjectInfo ¶
func NewObjectInfo(rect image.Rectangle, colorThickness ColorThickness) *ObjectInfo
NewObjectInfo creates a new ObjectInfo
func (*ObjectInfo) Ref ¶
func (o *ObjectInfo) Ref() *ObjectInfo
Ref will reference the ObjectInfo and underlying SharedMat
type ProcessedImage ¶
type ProcessedImage struct { Original Image Motions []MotionInfo Objects []ObjectInfo Faces []FaceInfo }
ProcessedImage is the result of running through the processes
func NewProcessedImage ¶
func NewProcessedImage(original Image) *ProcessedImage
NewProcessedImage creates a new ProcessedImage
func (*ProcessedImage) Cleanup ¶
func (p *ProcessedImage) Cleanup()
Cleanup will cleanup the ProcessedImage
func (*ProcessedImage) Clone ¶
func (p *ProcessedImage) Clone() *ProcessedImage
Clone will clone the ProcessedImage
func (ProcessedImage) Face ¶ added in v1.27.0
func (p ProcessedImage) Face(index int) *Image
func (*ProcessedImage) HasFace ¶ added in v1.27.0
func (p *ProcessedImage) HasFace() bool
func (*ProcessedImage) HasMotion ¶ added in v1.27.0
func (p *ProcessedImage) HasMotion() bool
func (*ProcessedImage) HasObject ¶ added in v1.27.0
func (p *ProcessedImage) HasObject() bool
func (*ProcessedImage) HighlightedAll ¶ added in v1.27.0
func (p *ProcessedImage) HighlightedAll() *Image
func (*ProcessedImage) HighlightedFace ¶
func (p *ProcessedImage) HighlightedFace() *Image
func (*ProcessedImage) HighlightedMotion ¶
func (p *ProcessedImage) HighlightedMotion() *Image
func (*ProcessedImage) HighlightedObject ¶
func (p *ProcessedImage) HighlightedObject() *Image
func (ProcessedImage) Motion ¶ added in v1.27.0
func (p ProcessedImage) Motion(index int) *Image
func (ProcessedImage) Object ¶ added in v1.27.0
func (p ProcessedImage) Object(index int) *Image
func (*ProcessedImage) Ref ¶
func (p *ProcessedImage) Ref() *ProcessedImage
Ref will reference the ProcessedImage and underlying SharedMats
type ProcessedImageByCreatedTime ¶
type ProcessedImageByCreatedTime []ProcessedImage
ProcessedImageByCreatedTime sorting ascending order
func (ProcessedImageByCreatedTime) Len ¶
func (b ProcessedImageByCreatedTime) Len() int
func (ProcessedImageByCreatedTime) Less ¶
func (b ProcessedImageByCreatedTime) Less(i, j int) bool
func (ProcessedImageByCreatedTime) Swap ¶
func (b ProcessedImageByCreatedTime) Swap(i, j int)
type ProcessedImageByFaceLen ¶
type ProcessedImageByFaceLen []ProcessedImage
ProcessedImageByFaceLen sorting descending order
func (ProcessedImageByFaceLen) Len ¶
func (b ProcessedImageByFaceLen) Len() int
func (ProcessedImageByFaceLen) Less ¶
func (b ProcessedImageByFaceLen) Less(i, j int) bool
func (ProcessedImageByFaceLen) Swap ¶
func (b ProcessedImageByFaceLen) Swap(i, j int)
type ProcessedImageByFacePercent ¶
type ProcessedImageByFacePercent []ProcessedImage
ProcessedImageByFacePercent sorting descending order
func (ProcessedImageByFacePercent) Len ¶
func (b ProcessedImageByFacePercent) Len() int
func (ProcessedImageByFacePercent) Less ¶
func (b ProcessedImageByFacePercent) Less(i, j int) bool
func (ProcessedImageByFacePercent) Swap ¶
func (b ProcessedImageByFacePercent) Swap(i, j int)
type ProcessedImageByObjLen ¶
type ProcessedImageByObjLen []ProcessedImage
ProcessedImageByObjLen sorting descending order
func (ProcessedImageByObjLen) Len ¶
func (b ProcessedImageByObjLen) Len() int
func (ProcessedImageByObjLen) Less ¶
func (b ProcessedImageByObjLen) Less(i, j int) bool
func (ProcessedImageByObjLen) Swap ¶
func (b ProcessedImageByObjLen) Swap(i, j int)
type ProcessedImageByObjPercent ¶
type ProcessedImageByObjPercent []ProcessedImage
ProcessedImageByObjPercent sorting descending order
func (ProcessedImageByObjPercent) Len ¶
func (b ProcessedImageByObjPercent) Len() int
func (ProcessedImageByObjPercent) Less ¶
func (b ProcessedImageByObjPercent) Less(i, j int) bool
func (ProcessedImageByObjPercent) Swap ¶
func (b ProcessedImageByObjPercent) Swap(i, j int)
type ProcessedImageFpsChan ¶
type ProcessedImageFpsChan struct {
// contains filtered or unexported fields
}
ProcessedImageFpsChan will notify caller via ProcessedImage channel at given fps
func NewProcessedImageFpsChan ¶
func NewProcessedImageFpsChan(outFps int) *ProcessedImageFpsChan
NewProcessedImageFpsChan creates a new ProcessedImageFpsChan
func (*ProcessedImageFpsChan) Close ¶
func (p *ProcessedImageFpsChan) Close()
Close notified by caller that input stream is done/closed
func (*ProcessedImageFpsChan) Send ¶
func (p *ProcessedImageFpsChan) Send(img ProcessedImage)
Send ProcessedImage to channel
func (*ProcessedImageFpsChan) Start ¶
func (p *ProcessedImageFpsChan) Start() chan ProcessedImage
Start runs the channel
type RingBufferImage ¶
type RingBufferImage struct {
// contains filtered or unexported fields
}
RingBufferImage is a ring buffer for Image
func NewRingBufferImage ¶
func NewRingBufferImage(maxLen int) *RingBufferImage
NewRingBufferImage creates a new RingBufferImage with maxLen
func (*RingBufferImage) Len ¶
func (r *RingBufferImage) Len() int
Len returns the length of the ring
func (*RingBufferImage) Pop ¶
func (r *RingBufferImage) Pop() (popped Image)
Pop will pop off the ring an Image. Check for valid image.
func (*RingBufferImage) PopAll ¶
func (r *RingBufferImage) PopAll() (popped []Image)
PopAll will pop off all on the ring. Check for valid image.
func (*RingBufferImage) Push ¶
func (r *RingBufferImage) Push(img Image) (popped Image)
Push will push onto the ring the Image and return any popped Image
func (*RingBufferImage) Ready ¶
func (r *RingBufferImage) Ready() <-chan bool
Ready returns the internal ready chan for checking ready to pop
func (*RingBufferImage) SortByCreatedTime ¶
func (r *RingBufferImage) SortByCreatedTime()
SortByCreatedTime sorts the ring buffer
type RingBufferProcessedImage ¶
type RingBufferProcessedImage struct { IsSortByContent bool // contains filtered or unexported fields }
RingBufferProcessedImage is a ring buffer for ProcessedImage
func NewRingBufferProcessedImage ¶
func NewRingBufferProcessedImage(maxLen int) *RingBufferProcessedImage
NewRingBufferProcessedImage creates a new RingBufferProcessedImage
func (*RingBufferProcessedImage) Len ¶
func (r *RingBufferProcessedImage) Len() int
Len returns the length of the ring
func (*RingBufferProcessedImage) Pop ¶
func (r *RingBufferProcessedImage) Pop() (popped ProcessedImage)
Pop will pop off the ring an ProcessedImage. Check for valid image.
func (*RingBufferProcessedImage) PopAll ¶
func (r *RingBufferProcessedImage) PopAll() (popped []ProcessedImage)
PopAll will pop off all on the ring. Check for valid image.
func (*RingBufferProcessedImage) Push ¶
func (r *RingBufferProcessedImage) Push(img ProcessedImage) (popped ProcessedImage)
Push will push onto the ring the ProcessedImage and return any popped ProcessedImage
func (*RingBufferProcessedImage) Ready ¶
func (r *RingBufferProcessedImage) Ready() <-chan bool
Ready returns the internal ready chan for checking ready to pop
func (*RingBufferProcessedImage) SortByContent ¶
func (r *RingBufferProcessedImage) SortByContent()
SortByContent sorts the ring buffer
func (*RingBufferProcessedImage) SortByCreatedTime ¶
func (r *RingBufferProcessedImage) SortByCreatedTime()
SortByCreatedTime sorts the ring buffer
type VideoReader ¶
type VideoReader struct { MaxSourceFps int MaxOutputFps int Quality int // contains filtered or unexported fields }
VideoReader reads a VideoSource
func NewVideoReader ¶
func NewVideoReader(videoSource VideoSource, maxSourceFps int, maxOutputFps int) *VideoReader
NewVideoReader creates a new VideoReader
func (*VideoReader) GetOutputStatsChan ¶ added in v1.26.0
func (v *VideoReader) GetOutputStatsChan() (result <-chan interface{})
GetOutputStatsChan returns the channel
func (*VideoReader) GetSourceStatsChan ¶ added in v1.26.0
func (v *VideoReader) GetSourceStatsChan() (result <-chan interface{})
GetSourceStatsChan returns the channel
func (*VideoReader) GetStatsOutput ¶ added in v1.26.0
func (v *VideoReader) GetStatsOutput(timeoutMs int) (result *FrameStats)
GetStatsOutput returns the FrameStats
func (*VideoReader) GetStatsSource ¶ added in v1.26.0
func (v *VideoReader) GetStatsSource(timeoutMs int) (result *FrameStats)
GetStatsSource returns the FrameStats
func (*VideoReader) SetQuality ¶
func (v *VideoReader) SetQuality(percent int)
SetQuality sets the Image quality
type VideoSource ¶
type VideoSource interface { GetName() string Initialize() (ok bool) Cleanup() ReadImage() (done bool, image Image) }
VideoSource interface for setting up and reading images
func NewFileSource ¶
func NewFileSource(name string, filename string) VideoSource
NewFileSource creates a new FileSource
func NewIPCamSource ¶
func NewIPCamSource(name string, url string) VideoSource
NewIPCamSource creates a new IPCamSource
type VideoStats ¶
type VideoStats struct {
// contains filtered or unexported fields
}
VideoStats contains video statistics
func (*VideoStats) AddAccepted ¶
func (v *VideoStats) AddAccepted()
AddAccepted adds an accepted image
func (*VideoStats) ClearPerSecond ¶ added in v1.26.0
func (v *VideoStats) ClearPerSecond()
ClearPerSecond the VideoStats
func (*VideoStats) GetStats ¶ added in v1.22.0
func (v *VideoStats) GetStats() *FrameStats
GetStats returns the FrameStats
type VideoWriter ¶
type VideoWriter struct { PortableWidth int // contains filtered or unexported fields }
VideoWriter writes Images
func NewVideoWriter ¶
func NewVideoWriter(name string, saveDirectory string, codec string, fileType string, bufferSeconds int, maxPreSec int, timeoutSec int, maxSec int, outFps int, savePreview bool, savePortable bool, saveFull bool, activityType int) *VideoWriter
NewVideoWriter creates a new VideoWriter
func (*VideoWriter) Close ¶
func (v *VideoWriter) Close()
Close notified by caller that input stream is done/closed
func (*VideoWriter) GetStats ¶ added in v1.26.0
func (v *VideoWriter) GetStats(timeoutMs int) (result *FrameStats)
GetStats returns the FrameStats
func (*VideoWriter) Trigger ¶ added in v1.9.0
func (v *VideoWriter) Trigger()
Trigger to start recording