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

◆ select_label() [2/2]

std::shared_ptr< Core::VKImage > MayaFlux::Yantra::VisionGpuExecutor::select_label ( VisionGpuContexts &  contexts,
const std::shared_ptr< Core::VKImage > &  source,
uint32_t  target_label,
uint32_t  w,
uint32_t  h 
)

Isolate one ConnectedComponents label's silhouette on GPU, through the explicit context set that produced the label buffer.

Dispatches vision_label_select.comp through contexts.component_contours, the same context ConnectedComponents/FindContours already own: reads dense_label in place at its existing binding, no cross-context buffer copy. Requires a ConnectedComponents step to have already run against these exact contexts (this run or an earlier one); dense_label holds whichever frame's labels were computed last.

Parameters
contextsThe same context set a prior run() populated.
sourceFrame to select pixels from, eShaderReadOnlyOptimal.
target_label1-based label id, matching BoundingBox::label_id / Contour::label_id from that same run.
wFrame width in pixels.
hFrame height in pixels.
Returns
New image, transparent everywhere outside the selected label's silhouette.

Definition at line 450 of file VisionComponentsDispatch.cpp.

455{
456 auto& component_contours = contexts.component_contours;
457 auto& foundry = Portal::Graphics::get_shader_foundry();
458
459 component_contours.swap_shader({
460 .shader_path = "vision_label_select.comp.spv",
461 .workgroup_size = k_wg2d,
462 .push_constant_size = sizeof(SelectLabelPC),
463 });
464 component_contours.stage_image_at(1, source, GpuBufferBinding::ElementType::IMAGE_SAMPLED);
465 component_contours.set_push_constants(SelectLabelPC {
466 .target_label = target_label, .width = w, .height = h });
467 component_contours.prepare_output_image(w, h);
468 component_contours.set_output_dimensions(w, h);
469
470 const auto fence = component_contours.dispatch_async({});
471 component_contours.clear_output_dimensions();
472 foundry.wait_for_fence(fence);
473 foundry.release_fence(fence);
474
475 return component_contours.get_output_image(0);
476}
vk::Fence fence
uint32_t h
Definition InkPress.cpp:29
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
constexpr std::array< uint32_t, 3 > k_wg2d
Standard 2D workgroup used by all pixel-to-pixel vision shaders.

References MayaFlux::Yantra::VisionGpuContexts::component_contours, fence, MayaFlux::Portal::Graphics::get_shader_foundry(), h, MayaFlux::Yantra::VisionInternal::k_wg2d, and MayaFlux::Yantra::VisionInternal::SelectLabelPC::target_label.

Referenced by MayaFlux::Yantra::VisionExtractor::mask().

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