vision
April 7, 2026 ยท View on GitHub
{#visionmodule}
vision
Video intelligence primitives for sampled frame processing and event output.
Namespaces
| Name | Description |
|---|---|
vision |
{#vision}
vision
Classes
| Name | Description |
|---|---|
DetectionQueue | Async queue for decoded video frames. |
FrameSampler | PacketProcessor that forwards a sampled subset of decoded video frames. |
MotionDetector | |
Detection | |
FrameRef | |
FrameSamplerConfig | |
FrameSamplerStats | |
MotionDetectorConfig | |
MotionDetectorStats | |
Region | |
VisionEvent |
Functions
| Return | Name | Description |
|---|---|---|
Vision_APIFrameRef | makeFrameRef | |
Vision_APIjson::Value | toJson | |
Vision_APIjson::Value | toJson | |
Vision_APIjson::Value | toJson | |
Vision_APIjson::Value | toJson |
{#makeframeref}
makeFrameRef
Vision_APIFrameRef makeFrameRef(const av::PlanarVideoPacket & packet, uint64_t sequence)
{#tojson-3}
toJson
Vision_APIjson::Value toJson(const Region & region)
{#tojson-4}
toJson
Vision_APIjson::Value toJson(const FrameRef & frame)
{#tojson-5}
toJson
Vision_APIjson::Value toJson(const Detection & detection)
{#tojson-6}
toJson
Vision_APIjson::Value toJson(const VisionEvent & event)
{#detectionqueue}
DetectionQueue
#include <icy/vision/detectionqueue.h>
Inherits:
PlanarVideoPacket >
Async queue for decoded video frames.
This is the intentional clone boundary for detection work. Upstream stages can keep borrowed, zero-copy semantics until a frame enters this queue.
Public Methods
| Return | Name | Description |
|---|---|---|
DetectionQueue inline explicit |
{#detectionqueue-1}
DetectionQueue
inline explicit
inline explicit DetectionQueue(int maxFrames)
{#framesampler}
FrameSampler
#include <icy/vision/framesampler.h>
Inherits:
PacketProcessor
PacketProcessor that forwards a sampled subset of decoded video frames.
The sampler is intentionally zero-copy on its synchronous path: sampled frames are forwarded by reference and dropped frames are discarded before any queue hop. Pair it with DetectionQueue when a worker-thread boundary is required.
Public Attributes
| Return | Name | Description |
|---|---|---|
PacketSignal | emitter |
{#emitter-8}
emitter
PacketSignal emitter
Public Methods
| Return | Name | Description |
|---|---|---|
FrameSampler inline explicit | ||
void | setConfig inline | |
FrameSamplerConfig | config const inline | |
FrameSamplerStats | stats const inline | |
void | reset inline | |
void | process virtual inline | This method performs processing on the given packet and emits the result. |
bool | accepts virtual inline | This method ensures compatibility with the given packet type. Return false to reject the packet. |
{#framesampler-1}
FrameSampler
inline explicit
inline explicit FrameSampler(FrameSamplerConfig config)
{#setconfig-1}
setConfig
inline
inline void setConfig(FrameSamplerConfig config)
{#config-1}
config
const inline
inline FrameSamplerConfig config() const
{#stats-1}
stats
const inline
inline FrameSamplerStats stats() const
{#reset-16}
reset
inline
inline void reset()
{#process-8}
process
virtual inline
virtual inline void process(IPacket & packet)
This method performs processing on the given packet and emits the result.
Processors that defer work asynchronously must either clone the packet or retain an owned equivalent. See retention().
{#accepts-3}
accepts
virtual inline
virtual inline bool accepts(IPacket *)
This method ensures compatibility with the given packet type. Return false to reject the packet.
Private Attributes
| Return | Name | Description |
|---|---|---|
FrameSamplerConfig | _config | |
std::atomic< uint64_t > | _seen | |
std::atomic< uint64_t > | _forwarded | |
std::atomic< uint64_t > | _dropped | |
std::atomic< int64_t > | _lastForwardedTimeUsec |
{#_config-1}
_config
FrameSamplerConfig _config
{#_seen-1}
_seen
std::atomic< uint64_t > _seen {0}
{#_forwarded}
_forwarded
std::atomic< uint64_t > _forwarded {0}
{#_dropped}
_dropped
std::atomic< uint64_t > _dropped {0}
{#_lastforwardedtimeusec}
_lastForwardedTimeUsec
std::atomic< int64_t > _lastForwardedTimeUsec {kUnsetTimeUsec}
Private Methods
| Return | Name | Description |
|---|---|---|
bool | shouldForward const inline |
{#shouldforward}
shouldForward
const inline
inline bool shouldForward(const av::PlanarVideoPacket & frame, uint64_t seen) const
Private Static Methods
| Return | Name | Description |
|---|---|---|
FrameSamplerConfig | sanitize static inline |
{#sanitize-1}
sanitize
static inline
static inline FrameSamplerConfig sanitize(FrameSamplerConfig config)
{#motiondetector}
MotionDetector
#include <icy/vision/motiondetector.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
Signal< void(const VisionEvent &)> | Event |
{#event-6}
Event
Signal< void(const VisionEvent &)> Event
Public Methods
| Return | Name | Description |
|---|---|---|
MotionDetector explicit | ||
void | setConfig | |
MotionDetectorConfig | config const | |
MotionDetectorStats | stats const | |
void | reset | |
void | process |
{#motiondetector-1}
MotionDetector
explicit
explicit MotionDetector(MotionDetectorConfig config)
{#setconfig-2}
setConfig
void setConfig(MotionDetectorConfig config)
{#config-2}
config
const
MotionDetectorConfig config() const
{#stats-2}
stats
const
MotionDetectorStats stats() const
{#reset-17}
reset
void reset()
{#process-9}
process
void process(const av::PlanarVideoPacket & packet)
Private Attributes
| Return | Name | Description |
|---|---|---|
MotionDetectorConfig | _config | |
uint64_t | _sequence | |
uint64_t | _seen | |
uint64_t | _emitted | |
uint32_t | _warmedFrames | |
int | _width | |
int | _height | |
int64_t | _lastEventTimeUsec | |
float | _lastScore | |
std::vector< uint8_t > | _previousGrid | |
std::vector< uint8_t > | _currentGrid |
{#_config-2}
_config
MotionDetectorConfig _config
{#_sequence-1}
_sequence
uint64_t _sequence = 0
{#_seen-2}
_seen
uint64_t _seen = 0
{#_emitted-1}
_emitted
uint64_t _emitted = 0
{#_warmedframes}
_warmedFrames
uint32_t _warmedFrames = 0
{#_width}
_width
int _width = 0
{#_height}
_height
int _height = 0
{#_lasteventtimeusec}
_lastEventTimeUsec
int64_t _lastEventTimeUsec = 0
{#_lastscore}
_lastScore
float _lastScore = 0.0f
{#_previousgrid}
_previousGrid
std::vector< uint8_t > _previousGrid
{#_currentgrid}
_currentGrid
std::vector< uint8_t > _currentGrid
Private Methods
| Return | Name | Description |
|---|---|---|
void | sampleLumaGrid const | |
float | diffScore const | |
void | emitEvent |
{#samplelumagrid}
sampleLumaGrid
const
void sampleLumaGrid(const av::PlanarVideoPacket & packet, std::vector< uint8_t > & out) const
{#diffscore}
diffScore
const
float diffScore(const std::vector< uint8_t > & current) const
{#emitevent-1}
emitEvent
void emitEvent(const av::PlanarVideoPacket & packet, float score)
Private Static Methods
| Return | Name | Description |
|---|---|---|
MotionDetectorConfig | sanitize static |
{#sanitize-2}
sanitize
static
static MotionDetectorConfig sanitize(MotionDetectorConfig config)
{#detection}
Detection
#include <icy/vision/event.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
std::string | label | |
float | confidence | |
int64_t | trackId | |
Region | region | |
json::Value | data |
{#label-1}
label
std::string label
{#confidence}
confidence
float confidence = 0.0f
{#trackid}
trackId
int64_t trackId = -1
{#region}
region
Region region
{#data-7}
data
json::Value data = json::Value::object()
{#frameref}
FrameRef
#include <icy/vision/event.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
uint64_t | sequence | |
int64_t | timeUsec | |
int | width | |
int | height | |
std::string | pixelFmt |
{#sequence-1}
sequence
uint64_t sequence = 0
{#timeusec-1}
timeUsec
int64_t timeUsec = 0
{#width-3}
width
int width = 0
{#height-3}
height
int height = 0
{#pixelfmt-2}
pixelFmt
std::string pixelFmt
{#framesamplerconfig}
FrameSamplerConfig
#include <icy/vision/framesampler.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
uint32_t | everyNthFrame | |
int64_t | minIntervalUsec |
{#everynthframe}
everyNthFrame
uint32_t everyNthFrame = 1
{#minintervalusec}
minIntervalUsec
int64_t minIntervalUsec = 0
{#framesamplerstats}
FrameSamplerStats
#include <icy/vision/framesampler.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
uint64_t | seen | |
uint64_t | forwarded | |
uint64_t | dropped |
{#seen-1}
seen
uint64_t seen = 0
{#forwarded}
forwarded
uint64_t forwarded = 0
{#dropped}
dropped
uint64_t dropped = 0
{#motiondetectorconfig}
MotionDetectorConfig
#include <icy/vision/motiondetector.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
std::string | source | |
std::string | detectorName | |
uint32_t | gridWidth | |
uint32_t | gridHeight | |
uint32_t | warmupFrames | |
float | threshold | |
int64_t | minEventIntervalUsec |
{#source-2}
source
std::string source
{#detectorname-1}
detectorName
std::string detectorName = "motion"
{#gridwidth}
gridWidth
uint32_t gridWidth = 32
{#gridheight}
gridHeight
uint32_t gridHeight = 18
{#warmupframes}
warmupFrames
uint32_t warmupFrames = 2
{#threshold}
threshold
float threshold = 0.08f
{#mineventintervalusec}
minEventIntervalUsec
int64_t minEventIntervalUsec = 500000
{#motiondetectorstats}
MotionDetectorStats
#include <icy/vision/motiondetector.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
uint64_t | seen | |
uint64_t | emitted | |
float | lastScore |
{#seen-2}
seen
uint64_t seen = 0
{#emitted-1}
emitted
uint64_t emitted = 0
{#lastscore}
lastScore
float lastScore = 0.0f
{#region-1}
Region
#include <icy/vision/event.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
float | x | |
float | y | |
float | width | |
float | height |
{#x}
x
float x = 0.0f
{#y}
y
float y = 0.0f
{#width-4}
width
float width = 0.0f
{#height-4}
height
float height = 0.0f
{#visionevent}
VisionEvent
#include <icy/vision/event.h>
Public Attributes
| Return | Name | Description |
|---|---|---|
std::string | type | |
std::string | source | |
std::string | detector | |
int64_t | emittedAtUsec | |
FrameRef | frame | |
std::vector< Detection > | detections | |
json::Value | data |
{#type-24}
type
std::string type = "detect"
{#source-3}
source
std::string source
{#detector-1}
detector
std::string detector
{#emittedatusec-1}
emittedAtUsec
int64_t emittedAtUsec = 0
{#frame-2}
frame
FrameRef frame
{#detections}
detections
std::vector< Detection > detections
{#data-8}
data
json::Value data = json::Value::object()