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

◆ crop()

std::shared_ptr< Core::VKImage > MayaFlux::Yantra::VisionExtractor::crop ( const std::shared_ptr< Core::VKImage > &  source,
const Kinesis::Vision::VisionAnalysis &  analysis,
uint32_t  out_w,
uint32_t  out_h 
)

Crop of source at the focused element, or track/keypoint bounds.

Null with nothing to crop.

Definition at line 344 of file VisionExtractor.cpp.

348{
349 const auto region = region_for_analysis(analysis);
350 if (!region)
351 return nullptr;
352
353 auto& ctx = image_context();
354 use_shader(ctx, "vision_crop.comp.spv", k_wg_image, sizeof(CropPC));
355 ctx.stage_image(source);
356 ctx.set_push_constants(CropPC {
357 .src_x = region->x, .src_y = region->y, .src_w = region->w, .src_h = region->h,
358 .out_w = out_w, .out_h = out_h });
359 return dispatch_image(ctx, out_w, out_h);
360}
uint32_t out_h
uint32_t out_w
std::optional< Kinesis::Vision::BoundingBox > region_for_analysis(const Kinesis::Vision::VisionAnalysis &analysis)
TextureExecutionContext & image_context()
The two contexts every method shares, one shader swapped in per call.

References image_context(), out_h, out_w, and region_for_analysis().

Referenced by run_operation().

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