MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ patches()

std::shared_ptr< Core::VKImage > MayaFlux::Yantra::VisionExtractor::patches ( const std::shared_ptr< Core::VKImage > &  source,
const Kinesis::Vision::VisionAnalysis &  analysis,
uint32_t  patch_w,
uint32_t  patch_h,
uint32_t  source_w,
uint32_t  source_h 
)

One fixed-size crop per keypoint, else per track, side by side in one atlas.

Definition at line 569 of file VisionExtractor.cpp.

574{
575 const auto centers = points_for_analysis(analysis);
576 if (centers.empty())
577 return nullptr;
578
579 const auto count = static_cast<uint32_t>(centers.size());
580
581 auto& ctx = image_context();
582 use_shader(ctx, "vision_patch_extract.comp.spv", k_wg_image, sizeof(PatchExtractPC));
583 ctx.stage_image(source);
584 ctx.set_binding_data(3, std::span<const float>(
585 reinterpret_cast<const float*>(centers.data()), centers.size() * 2));
586 ctx.set_push_constants(PatchExtractPC {
587 .patch_w = patch_w, .patch_h = patch_h, .count = count,
588 .src_w = source_w, .src_h = source_h });
589 return dispatch_image(ctx, patch_w * count, patch_h);
590}
size_t count
uint32_t patch_w
uint32_t patch_h
std::vector< glm::vec2 > points_for_analysis(const Kinesis::Vision::VisionAnalysis &analysis) const
TextureExecutionContext & image_context()
The two contexts every method shares, one shader swapped in per call.

References count, image_context(), patch_h, patch_w, and points_for_analysis().

Referenced by run_operation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: