sds011

package module
v0.0.0-...-30f419b Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 18 Imported by: 0

README


stars long exposure icon
Timelapse module for Viam

Warning: this module is in beta its config may change in future versions.

Captures frames from a camera at a designated frequency, saves them to the local device in ($VIAM_MODULE_DATA) and then plays back the timelapse on the control tab

Models

zaporter:timelapse:v1
zaporter:timelapse:v1-fake

Example Config

{
  "capture_camera": "webcam_name_here",
  "capture_interval_seconds": 10.0,
  "playback_fps": 20,
  "timelapse_name" : "default" #optional
}

Output

A camera stream on the control page that shows the timelapse (if using the fake model, it will show a sample timelapse)

Missing functionality

Save or export the timelapse: I want to do this eventually. If someone wants this, feel free to file an issue and I'll find time to do it. Otherwise, you can just grab the images yourself and use imagemagick

Intelligently pick frames for the timelapse: Right now, the module just shows all frames. However, this is likely not what you want for long timelapses because it would show things like nighttime. It would be best to pick clear frames (low noise) that have a high similarity to either the previous frame or to a reference frame (perhaps the average of the last n frames?)

Preserve timelapse frame time between viam-server restarts: If you are set to take a photo 1x per day and restart the module at midnight, the clock will shift and it will start taking photos at midnight instead of at the middle of the day. There should be some way to say when to take photos (maybe cronjob syntax?)

Building

make build -> bin/module

Linting

make lint

Documentation

Overview

Package sds011 is the package for sds011

Index

Constants

This section is empty.

Variables

View Source
var (
	Model     = resource.NewModel("zaporter", "timelapse", "v1")
	ModelFake = resource.NewModel("zaporter", "timelapse", "v1-fake")
	DataDir   = os.Getenv("VIAM_MODULE_DATA")

	FakeFolder = filepath.Join(DataDir, "fake")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	CaptureCamera          string  `json:"capture_camera"`
	CaptureIntervalSeconds float64 `json:"capture_interval_seconds"`
	PlaybackFPS            float64 `json:"playback_fps"`
	TimelapseName          string  `json:"timelapse_name"`
}

func (*Config) Validate

func (cfg *Config) Validate(path string) ([]string, error)

Validate takes the current location in the config (useful for good error messages). It should return a []string which contains all of the implicit dependencies of a module. (or nil,err if the config does not pass validation).

type TimelapseStream

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

func (*TimelapseStream) Close

func (t *TimelapseStream) Close(ctx context.Context) error

Close signals this stream is no longer needed and releases associated resources.

func (*TimelapseStream) Next

func (t *TimelapseStream) Next(ctx context.Context) (image.Image, func(), error)

Next returns the next media element in the sequence (best effort). Note: This element is mutable and shared globally; it MUST be copied before it is mutated.

func (*TimelapseStream) NextPath

func (t *TimelapseStream) NextPath() (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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