filtered_camera

package module
v0.0.0-...-b160ee9 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 17 Imported by: 0

README

Viam filtered camera module

If your smart machine captures a lot of data, you can filter captured data to selectively store only the data that meets certain criteria. This module allows you to filter image data by:

  • Specified classification labels and required confidence scores
  • Detected objects and their associated required confidence scores

This allows you to:

  • Classify images and only sync images that have the required label
  • Look for objects in an image and sync the images that have a certain object

This module also allows you to specifcy a time window for syncing the data captured in the N seconds before the capture criteria were met.

Configure your filtered camera

[!NOTE]
Before configuring your camera, you must create a robot.

Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and click Create component. Select the camera type, then select the filtered-camera model and click Add module. Enter a name for your camera and click Create.

On the new component panel, copy and paste the following attribute template into your base’s Attributes box.

{
    "camera": "<your_camera_name>",
    "vision": "<your_vision_service_name>",
    "window_seconds": <time_window_for_capture>,
    "classifications": {
        "<label>": <confidence_score>,
        "<label>": <confidence_score>
    },
    "objects": {
        "<label>": <confidence_score>,
        "<label>": <confidence_score>
    }
}

[!NOTE]
For more information, see Configure a Robot.

Attributes

The following attributes are available for erh:camera:filtered-camera bases:

Name Type Inclusion Description
camera string Required The name of the camera to filter images for.
vision string Required The vision service used for image classifications or detections.
window_seconds float64 Optional The size of the time window during which images are buffered. When a condition is met, a confidence score for a detection/classification exceeds the required confidence score, the buffered images are stored, allowing us to see the photos taken in the N number of seconds preceding the condition being met.
in seconds for capturing and sending images.
classifications float64 Optional A map of
classification labels and the confidence scores required for filtering.
objects float64 Optional A map of object detection
labels and the confidence scores required for filtering.
Example configurations:
{
    "camera": "my_camera",
    "vision": "my_red_car_detector",
    "windowSeconds": 5,
    "objects": {
        "red_car": 0.6
    }
}

Local Development

To use the filtered_camera module, clone this repository to your machine’s computer, navigate to the module directory, and run:

go build

On your robot’s page in the Viam app, enter the [module’s executable path](/registry/create/#prepare-the-module-for-execution, then click Add module. The name must use only lowercase characters. Then, click Save config.

Next Steps

License

Copyright 2021-2023 Viam Inc.
Apache 2.0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Model = resource.ModelNamespace("erh").WithFamily("camera").WithModel("filtered-camera")

Functions

This section is empty.

Types

type Config

type Config struct {
	Camera        string
	Vision        string
	WindowSeconds int `json:"window_seconds"`

	Classifications map[string]float64
	Objects         map[string]float64
}

func (*Config) Validate

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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