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.
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:
--jsonwrites 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 helpserves 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
Install the tool globally using the .NET CLI (installing requires the .NET SDK):
dotnet tool install -g DemaConsulting.AgentVision.ToolAdd the reusable library to a project with:
dotnet add package DemaConsulting.AgentVision.Core# 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 stopWithout a daemon, agentvision snap opens the camera itself, which is slower.
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.
The User Guide covers everything else:
- Listing Cameras, Saving a Picture, and Glance, Then Focus
- Running the Daemon, its Security Model, and Camera Quirks
- Capturing Frames with the Library and Troubleshooting Pictures
- Command-Line Options, JSON Output, and Error Handling
- Built-in Help and Self-Validation
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.
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.

