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 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 FaceInfo
- type FileSource
- type IPCamSource
- type Image
- func (i *Image) ChangeQuality(percent int)
- func (i *Image) Cleanup() 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 ObjectInfo
- type 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
- type VideoSource
- type VideoStats
- type VideoWriter
Constants ¶
const ( ActivityObject = 0 ActivityFace = 1 )
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 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 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 ObjectInfo ¶
ObjectInfo contains the object information
func NewObjectInfo ¶
func NewObjectInfo(img Image) *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 HighlightedMotion Image HighlightedObject Image HighlightedFace Image Motions []Image MotionRects []image.Rectangle Objects []ObjectInfo ObjectRects []image.Rectangle Faces []FaceInfo FaceRects []image.Rectangle }
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) 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 { SourceStats *VideoStats OutputStats *VideoStats 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) 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 { AcceptedTotal int AcceptedPerSecond int DroppedTotal int DroppedPerSecond int // contains filtered or unexported fields }
VideoStats contains video statistics
func (*VideoStats) AddAccepted ¶
func (v *VideoStats) AddAccepted()
AddAccepted adds an accepted image
type VideoWriter ¶
type VideoWriter struct { Record bool VideoStats *VideoStats PortableWidth int // contains filtered or unexported fields }
VideoWriter writes Images
func NewVideoWriter ¶
func NewVideoWriter(name string, saveDirectory string, codec string, fileType string, maxPreSec int, timeoutSec int, maxSec int, outFps int, savePreview bool, savePortable 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