Skip to content

About

Vision library for agents

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AgentVision: Low-latency webcam capture for AI agents

GitHub forks GitHub stars GitHub contributors License Build Quality Gate Security NuGet NuGet

AgentVision gives AI agents fast access to webcams. It keeps cameras open ("hot") so that frames can be captured, cropped, scaled, and saved with almost no delay, using FlashCap and DemaConsulting.CanvasNet. It is delivered as the DemaConsulting.AgentVision.Core .NET library and the DemaConsulting.AgentVision.Tool .NET tool (command agentvision), which is a thin command-line front-end for the library.

Status: under active development. Both packages can already list cameras, save pictures (whole or in part, scaled down, with a labeled grid), and keep cameras open; the tool reaches the hot cameras through a background daemon.

The workflow below shows how an AI agent uses it: the agent runs agentvision commands, the daemon holds the cameras hot, and each picture comes back to the agent as an image file.

Workflow: an AI agent runs agentvision commands, the commands talk through a per-user pipe to a daemon that keeps the cameras open, the daemon writes PNG, JPEG, or BMP image files, and the agent opens the files and looks at the pictures

Features

AgentVision provides:

  • πŸ“· Camera Listing: Lists each physical camera once, with its formats; opening a camera then picks the best backend
  • πŸ”₯ Hot Cameras: A background daemon keeps opened cameras hot, so after the first snap each picture is a read of the newest frame
  • πŸ” Glance, Then Focus: Takes a small overview with a labeled grid, then crops cells or regions that keep full resolution unless you scale them
  • πŸ–ΌοΈ Several Pictures per Frame: Saves an overview and details from one frame in a single command
  • 🧩 All Cameras in One Picture: Composes every camera into one labeled picture
  • πŸŒ‘ Dark-Picture Warning: Flags pictures that are too dark, for example behind a closed privacy shutter
  • πŸ€– JSON Output: --json writes exactly one JSON object per command, for programs that drive the tool
  • πŸ“¦ Reusable Library: Opens cameras, takes snapshots, and edits and saves frames from any .NET application
  • βœ… Self-Validation: Built-in validation tests with TRX and JUnit output
  • ❓ Built-in Help: agentvision help serves help topics with runnable examples, search, and JSON output for AI agents (DemaConsulting.HelpCards)
  • πŸ–₯️ Multi-Platform Support: Builds and runs on Windows and Linux
  • βš™οΈ Multi-Runtime Support: Targets .NET 10 and 11
  • πŸ” Comprehensive CI/CD: GitHub Actions workflows for quality checks, builds, and tests
  • πŸ›‘οΈ Continuous Compliance: CI generates evidence using Continuous Compliance
  • πŸ“š Documentation Tooling: Automates build notes, user guide, and compliance reports

Installation

Install the tool globally using the .NET CLI (installing requires the .NET SDK):

dotnet tool install -g DemaConsulting.AgentVision.Tool

Add the reusable library to a project with:

dotnet add package DemaConsulting.AgentVision.Core

Tool Quick Start

# List the built-in help topics, then the cameras of this machine (<n> below is the camera number it shows)
agentvision help
agentvision cameras

# Start the background daemon that keeps opened cameras hot, then pre-warm camera <n> (otherwise its first snap opens it)
agentvision start
agentvision open --camera <n>

# Glance at the whole frame, small and with a labeled grid, then focus on cells C3 to D4 (a crop keeps full
# resolution unless scaled; here it is scaled down to 800), both from one frame
agentvision snap --camera <n> --output glance.png --max-size 640 --grid --output focus.png --cell C3:D4 --max-size 800

# Close the cameras and end the daemon
agentvision stop

Without a daemon, agentvision snap opens the camera itself, which is slower.

Library Quick Start

Open a camera once, keep it hot, and save an overview and a detail of one frame:

using DemaConsulting.AgentVision.Core.Capture;
using DemaConsulting.AgentVision.Core.Imaging;

// Opening is the slow step: do it once and keep the session for as long as pictures may be wanted.
// The camera is an index, a name, or an Id from CameraEnumerator.Enumerate (the numbers that `agentvision cameras` shows)
using var session = new CameraOpener().Open("0", new CameraOpenOptions { Width = 1920, Height = 1080 });

// Every snapshot after the first one is almost free: it returns the latest frame
var frame = session.Snapshot();
Console.WriteLine($"Frame {frame.Sequence}: {frame.EncodedData.Length} bytes");

// SaveAll decodes the frame once and writes every picture; the extension chooses the format (png, jpg, jpeg, or bmp)
var saved = frame.SaveAll(
[
    ("overview.png", new ImageOutputOptions { Scale = ImageScale.FromMaxSize(640), ShowGrid = true }),
    ("detail.png", new ImageOutputOptions { Region = ImageRegion.FromCells("A3:C5") })
]);
Console.WriteLine(saved[0].IsDark ? "Very dark picture." : $"Saved {saved[0].Width}x{saved[0].Height}.");

Failures are reported with documented exceptions that derive from CameraException, and disposing the session stops the camera.

More Information

The User Guide covers everything else:

See also CONTRIBUTING.md for how to report bugs, suggest features, run the hardware tests, and submit pull requests, and the releases and the NuGet packages (tool, library) for downloads.

License

Copyright (c) DEMA Consulting. Licensed under the MIT License. See LICENSE for details.

By contributing to this project, you agree that your contributions will be licensed under the MIT License.

About

Vision library for agents

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages