argus

package module
v0.0.0-...-002dbf7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2023 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Argus

Motion detection and alerting.

MacOS Setup

# Install prerequisites
brew install pkg-config opencv4

# Clone this repo
git clone git@github.com:catalinc/argus.git

# Build
cd argus
make test
make build

# Run
./argus

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Fps         uint          `json:"fps"`
	DeviceID    string        `json:"deviceId"`
	MinInterval time.Duration `json:"minInterval"`
	MinArea     float64       `json:"minArea"`
	ShowVideo   bool          `json:"showVideo"`
	Handlers    []string      `json:"handlers"`
	DataDir     string        `json:"dataDir"`
	MailConfig  MailConfig    `json:"mailConfig"`
}

Configuration holds application wide parameters

func DefaultConfiguration

func DefaultConfiguration() Configuration

DefaultConfiguration returns a configuration suitable for most cases

func LoadConfiguration

func LoadConfiguration(path string) (Configuration, error)

LoadConfiguration loads configuration from file

type MailConfig

type MailConfig struct {
	From           string `json:"from"`
	To             string `json:"to"`
	ServerHost     string `json:"serverHost"`
	ServerPort     int    `json:"serverPort"`
	ServerUser     string `json:"serverUser"`
	ServerPassword string `json:"serverPassword"`
}

MailConfig holds mail sender configuration

type MotionDetector

type MotionDetector interface {
	// OpenDevice opens video capture device for motion detection
	OpenDevice(deviceID string) error
	// DetectMotion motion in the video capture
	// Returns non nil MotionEvent when motion has been detected
	// Called at fixed intervals by the driver program
	DetectMotion(showVideo bool, minArea float64) (*MotionEvent, error)
	// Close video capture device and perform any additional cleanup
	Close()
}

MotionDetector uses the video capture device to detect motion

func NewMotionDetector

func NewMotionDetector() MotionDetector

NewMotionDetector creates a motion detector based on OpenCV

type MotionEvent

type MotionEvent struct {
	Frame     image.Image
	Timestamp time.Time
}

MotionEvent holds the image frame and the time when motion is detected

type MotionHandler

type MotionHandler interface {
	// Handle motion event
	Handle(event *MotionEvent) error
}

MotionHandler represents a callback invoked when motion is detected

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner is the main driver for motion detection and handling

func NewRunner

func NewRunner(config Configuration, detector MotionDetector) *Runner

NewRunner returns a new Runner instance

func (*Runner) Close

func (r *Runner) Close()

Close closes the video capture device

func (*Runner) Init

func (r *Runner) Init() error

Init opens the video capture device and registers motion handlers

func (*Runner) Run

func (r *Runner) Run() error

Run contains the logic to detect and handle motion Called periodically by the main program loop

Directories

Path Synopsis
cmd
argus command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址