Prerequisites
The following example requires theopencv-python and openai libraries.
/dev/video0.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
OpenCVTools enables agents to capture images and videos from webcam using OpenCV computer vision library.
opencv-python and openai libraries.
uv pip install -U opencv-python openai
export OPENAI_API_KEY="your_openai_api_key_here"
/dev/video0.
from agno.agent import Agent
from agno.tools.opencv import OpenCVTools
agent = Agent(
instructions=[
"You are a computer vision assistant that can capture images and videos",
"Use the webcam to take photos or record videos as requested",
"Provide clear feedback about capture operations",
"Help with basic computer vision tasks",
],
tools=[OpenCVTools()],
)
agent.print_response("Take a photo using the webcam", stream=True)
| Parameter | Type | Default | Description |
|---|---|---|---|
show_preview | bool | False | Whether to show camera preview window during capture. |
enable_capture_image | bool | True | Enable image capture functionality. |
enable_capture_video | bool | True | Enable video capture functionality. |
all | bool | False | Enable all functionality. |
| Function | Description |
|---|---|
capture_image | Capture a single image from the webcam. |
capture_video | Record a video from the webcam for a specified duration. |
Was this page helpful?