image

package
v0.0.0-...-36644ff Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package image implements fetching images from video sources, and classifying images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classifier

type Classifier struct {
	Events chan ClassifyEvent
	// contains filtered or unexported fields
}

Classifier receives images from a recorder, classifies them, and sends the results on channel Events.

func NewClassifier

func NewClassifier(runner edgeimpulse.Runner, recorder Recorder, opts *ClassifierOpts) (*Classifier, error)

NewClassifier returns a new classifier that receives messages from recorder, classifies them using runner, and sends ClassifyEvents on its channel Events.

Callers must call Close to clean up the classifier, and separately close the runner and recorder.

func (*Classifier) Close

func (c *Classifier) Close() error

Close shuts down the classifier. The runner and recorder must be stopped by the caller.

type ClassifierOpts

type ClassifierOpts struct {
	Verbose  bool   // Print verbose logging.
	TraceDir string // If not empty, directory to write images sent to runner.
}

ClassifierOpts are options for the classifier.

type ClassifyEvent

type ClassifyEvent struct {
	// If not nil, an error occurred and other fields are not meaningful.
	Err error

	// The classification response from the model. Always a successful
	// response.
	edgeimpulse.RunnerClassifyResponse

	// How long classifying took.
	Classifying time.Duration

	// The image that was classified, after transforming to fit the
	// requirements for the model.
	Image image.Image
}

ClassifyEvent is the result of classifying one image.

type Device

type Device struct {
	Name string
	ID   string
	Caps []DeviceCap
}

Device is a camera device capable of recording images.

type DeviceCap

type DeviceCap struct {
	Width     int
	Height    int
	Framerate int
}

DeviceCap describes a capability of a device.

type Event

type Event struct {
	// If not nil, an error occurred.
	Err error

	// Image read from recorder. If Err is set, Image is not valid.
	Image image.Image
}

Event is a single image (or error) coming from a Recorder.

type Recorder

type Recorder interface {
	// Events returns a channel from which ImageEvents can be read, each
	// containing an image.
	Events() chan Event

	// Close shuts down the image recorder. No further ImageEvents will be
	// sent.
	Close() error
}

Recorder is a source of images, for example a webcam.

Directories

Path Synopsis
Package ffmpeg implements an image recorder with the ffmpeg command.
Package ffmpeg implements an image recorder with the ffmpeg command.
Package gstreamer implements an image recorder with the gstreamer tools.
Package gstreamer implements an image recorder with the gstreamer tools.
Package imagesnap implements an image recorder with the imagesnap command for macOS.
Package imagesnap implements an image recorder with the imagesnap command for macOS.

Jump to

Keyboard shortcuts

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