Run any work a finished step owes the flow context.
The step that produces the gray or HSV image (RgbaToGray or RgbaToHsv) feeds it to the flow context before the next pixel dispatch overwrites it, when a TrackKeypoints or OpticalFlowDense step lies ahead. Sequences without one never take this branch, and when both are present the pyramid gets the larger level count.
369{
370 const auto& steps = contexts.pass.sequence->steps;
372 if (source_op != VisionOp::RgbaToGray && source_op != VisionOp::RgbaToHsv)
373 return;
374
375 const uint32_t src_channel = source_op == VisionOp::RgbaToHsv ? 2U : 0
U;
376
377 uint32_t levels = 0;
378 bool needs_flow = false;
379 bool confine_seen = false;
380 bool warned = false;
381 for (
size_t i =
index + 1; i < steps.size(); ++i) {
382 if (steps[i].op == VisionOp::Confine)
383 confine_seen = true;
384
385 const bool is_flow = steps[i].op == VisionOp::TrackKeypoints || steps[i].op == VisionOp::OpticalFlowDense;
386 if (is_flow && confine_seen && !warned) {
388 "run_gpu: Confine sits between RgbaToGray and a flow step; the flow pyramid is "
389 "built from the unconfined gray frame, so results are wrong or rejected. "
390 "Place Confine before RgbaToGray");
391 warned = true;
392 }
393
394 if (steps[i].op == VisionOp::TrackKeypoints) {
395 if (const auto* p = std::get_if<TrackKeypointsParams>(&steps[i].params)) {
396 needs_flow = true;
397 levels = std::max(levels, p->levels);
398 }
399 } else if (steps[i].op == VisionOp::OpticalFlowDense) {
400 if (const auto* p = std::get_if<OpticalFlowDenseParams>(&steps[i].params)) {
401 needs_flow = true;
402 levels = std::max(levels, p->levels);
403 }
404 }
405 }
406
407 if (needs_flow)
409}
#define MF_WARN(comp, ctx,...)
static void build_flow_pyramid(VisionGpuContexts &contexts, uint32_t requested_levels, uint32_t src_channel)
Build the current frame's pyramid atlas from the working image.
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
VisionOp
Named operations available in a VisionSequence.