Route every completed sequence result into one VisionAnalysis, apply context filtering and run the GPU reductions.
551{
552 Kinesis::Vision::VisionAnalysis analysis;
553 std::optional<std::vector<Kinesis::Vision::TrackResult>> raw_tracks;
554 std::optional<std::vector<Kinesis::Vision::Keypoint>> raw_keypoints;
555
556 for (size_t lane = 0; lane < results.size(); ++lane) {
557 const auto& result = results[lane];
558 const auto& entry = resolved[lane];
559
560 collect_into(raw_tracks, raw_keypoints, analysis, result);
561
562 if (result.images.sobel) {
563 const auto& gray = result.gray || !entry.seed_field ? result.gray : results[entry.seed_lane].gray;
565 }
566 }
567
570 if (ctx.subject_track_id) {
571 const auto id = *ctx.subject_track_id;
572 std::erase_if(*raw_tracks, [&](const auto& t) { return t.id != id; });
573 } else if (ctx.subject_bounds) {
574 const auto& bounds = *ctx.subject_bounds;
575 std::erase_if(*raw_tracks, [&](const auto& t) { return !inside(bounds, t.position); });
576 }
577 }
578
579 if (raw_tracks)
581
584 std::erase_if(*raw_keypoints, [&](const auto& k) { return !inside(bounds, k.position); });
585 }
586
587 if (raw_keypoints)
589
590 if (analysis.find_elements)
592
593 return analysis;
594}
Kinesis::Vision::MeasureAppearanceAnalysis measure_appearance(const Kinesis::Vision::VisionResult &result, const std::shared_ptr< Core::VKImage > &gray, uint32_t w, uint32_t h)
MeasureAppearance's whole-frame gradient sample (region_sample.comp over result.images....
void compute_shapes(Kinesis::Vision::FindElementsAnalysis &fe, uint32_t w, uint32_t h)
Shape descriptors (element_shape.comp) and nearest-neighbour distances (nearest_neighbor....
Kinesis::Vision::DetectFeaturesAnalysis reduce_keypoints(const std::vector< Kinesis::Vision::Keypoint > &keypoints)
Dispatch track_reduce.comp over keypoint positions (fed as their own previous, so velocity reduces to...
Kinesis::Vision::VisionAnalysisContext m_context
Kinesis::Vision::TrackObjectsAnalysis reduce_tracks(const std::vector< Kinesis::Vision::TrackResult > &tracks, uint32_t w, uint32_t h)
Dispatch track_reduce.comp over tracks and fill centroid/velocity/bounds/mean_speed_px/age stats on t...
std::optional< TrackObjectsContext > track_objects
std::optional< BoundingBox > detect_features_bounds