MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::VisionAnalyzer Class Reference

Resolves its configured VisionQuery, runs every resolved VisionSequence against a persistent VisionGpuExecutor, then runs the GPU reductions (track_reduce.comp) over the (context-filtered) subject tracks/keypoints for centroid/velocity/bounds. More...

#include <VisionAnalyzer.hpp>

+ Inheritance diagram for MayaFlux::Yantra::VisionAnalyzer:
+ Collaboration diagram for MayaFlux::Yantra::VisionAnalyzer:

Classes

struct  StepRun
 State of the run advance() is stepping through. More...
 

Public Types

using Base = FunctionalOperation< std::shared_ptr< Kakshya::SignalSourceContainer >, std::vector< Kakshya::DataVariant > >
 
- Public Types inherited from MayaFlux::Yantra::FunctionalOperation< std::shared_ptr< Kakshya::SignalSourceContainer >, std::vector< Kakshya::DataVariant > >
using Fn = std::function< output_type(const input_type &)>
 
using input_type = Datum< InputType >
 
using output_type = Datum< OutputType >
 
- Public Types inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
using input_type = Datum< InputType >
 
using output_type = Datum< OutputType >
 

Public Member Functions

std::optional< Kinesis::Vision::VisionAnalysis > advance (const std::shared_ptr< Core::VKImage > &image)
 Advance an analysis of image by one sequence per call, without waiting on deferred GPU work.
 
Kinesis::Vision::VisionAnalysis analyze_vision (const std::shared_ptr< Core::VKImage > &image)
 analyze_vision(), for a caller that already has a resolved GPU image (e.g.
 
Kinesis::Vision::VisionAnalysis analyze_vision (const std::shared_ptr< Kakshya::SignalSourceContainer > &source, size_t index=0)
 Real entry point: resolve the configured query against source, run it, run the GPU analysis.
 
const Kinesis::Vision::VisionAnalysisContext & get_context () const
 
VisionGpuExecutor * get_executor () const
 The executor that ran the FindElements sequence, or the first executor when the query has none.
 
const std::shared_ptr< Core::VKImage > & get_frame () const
 The copy of the frame the current or last advance() run analyzes.
 
const Kinesis::Vision::VisionQuery & get_query () const
 
const std::vector< Kinesis::Vision::VisionResult > & get_results () const
 The VisionResult of every sequence of the last completed analysis, in the order they ran.
 
std::shared_ptr< const std::vector< Kinesis::Vision::VisionResult > > get_shared_results () const
 The same results, owned: they stay valid after later analyses, which replace them with new ones.
 
VisionAnalyzer & operator= (const VisionAnalyzer &)=delete
 
void reset ()
 Abandon outstanding work and clear retained executor state.
 
void set_context (const Kinesis::Vision::VisionAnalysisContext &context)
 
void set_query (const Kinesis::Vision::VisionQuery &query)
 
 VisionAnalyzer (const VisionAnalyzer &)=delete
 
 VisionAnalyzer (Kinesis::Vision::VisionQuery query={}, Kinesis::Vision::VisionAnalysisContext context={})
 Construct with the intents to satisfy and the caller-supplied filtering context, matching EnergyAnalyzer's constructor-configures-the-run convention.
 
- Public Member Functions inherited from MayaFlux::Yantra::FunctionalOperation< std::shared_ptr< Kakshya::SignalSourceContainer >, std::vector< Kakshya::DataVariant > >
 FunctionalOperation (Fn fn)
 
 FunctionalOperation (std::shared_ptr< GpuExecutionContext< InputType, OutputType > > gpu_backend)
 Construct GPU-only: dispatches entirely via gpu_backend, no callable, no CPU fallback.
 
std::map< std::string, std::any > get_all_parameters () const override
 Retrieves all parameters and their values.
 
OperationType get_operation_type () const override
 Returns the category of this operation for grammar and registry discovery.
 
std::any get_parameter (const std::string &name) const override
 Retrieves a parameter's current value.
 
void set_parameter (const std::string &name, std::any value) override
 Sets a named parameter that configures the operation's behavior.
 
- Public Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
void add_dependency (std::shared_ptr< ComputeOperation > dep)
 
output_type apply_operation (const input_type &input)
 Public synchronous execution interface.
 
output_type apply_operation_with_dependencies (const input_type &input)
 Applies the operation with dependencies resolved.
 
OutputType apply_to_data (const InputType &data)
 Convenience overload that extracts just the data from result.
 
 ComputeOperation ()
 Constructor with data type validation warnings.
 
output_type execute (const input_type &input)
 OpUnit interface - operations can act as units in dependency graphs.
 
virtual const std::shared_ptr< Kakshya::SignalSourceContainer > & get_container_for_regions () const
 
const auto & get_dependencies () const
 
const ExecutionContext & get_last_execution_context () const
 
virtual std::string get_name () const
 Get operation name for debugging/introspection.
 
bool has_gpu_backend () const
 
output_type operator() (const InputType &data)
 Convenience overload for direct data processing (backward compatibility)
 
virtual void set_container_for_regions (const std::shared_ptr< Kakshya::SignalSourceContainer > &container)
 
void set_gpu_backend (std::shared_ptr< GpuExecutionContext< InputType, OutputType > > backend)
 Attach a GPU execution backend.
 
void set_last_execution_context (const ExecutionContext &ctx)
 
void set_post_execution_hook (const OperationHookCallback &hook)
 
void set_pre_execution_hook (const OperationHookCallback &hook)
 
void set_reconstruction_callback (const ReconstructionCallback &callback)
 
virtual bool validate_input (const input_type &) const
 Validates if the input data meets the operation's requirements.
 
virtual ~ComputeOperation ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Private Member Functions

Kinesis::Vision::VisionAnalysis analyze_resolved (const std::shared_ptr< Core::VKImage > &image)
 Shared body of both analyze_vision() overloads, once a GPU image is in hand: resolve the configured query, run every resolved VisionSequence, apply context filtering, run the GPU reductions.
 
Kinesis::Vision::VisionAnalysis assemble (const std::vector< Kinesis::Vision::ResolvedSequence > &resolved, const std::vector< Kinesis::Vision::VisionResult > &results, uint32_t w, uint32_t h)
 Route every completed sequence result into one VisionAnalysis, apply context filtering and run the GPU reductions.
 
std::array< uint32_t, 256 > compute_histogram (const std::shared_ptr< Core::VKImage > &image, uint32_t w, uint32_t h)
 Dispatch otsu_histogram.comp over image, zeroing the buffer first.
 
float compute_mean_brightness (const std::array< uint32_t, 256 > &histogram)
 Dispatch histogram_reduce.comp over an already-computed histogram.
 
void compute_shapes (Kinesis::Vision::FindElementsAnalysis &fe, uint32_t w, uint32_t h)
 Shape descriptors (element_shape.comp) and nearest-neighbour distances (nearest_neighbor.comp) over fe.boxes, filled in place.
 
std::shared_ptr< Core::VKImage > hold_frame (const std::shared_ptr< Core::VKImage > &image)
 Copy image into this analyzer's own frame image.
 
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.sobel) and brightness histogram (otsu_histogram.comp over gray).
 
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 zero and is simply not surfaced) and fill centroid/bounds/mean_response on the result.
 
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 the result.
 
std::shared_ptr< Core::VKImage > resolve_image (const std::shared_ptr< Kakshya::SignalSourceContainer > &source, size_t index)
 Resolve source/index to a GPU image, the same way VisionProcessor does: TextureContainer's own to_image(index) (zero-copy cache), or get_raw_data() uploaded into a persistent m_upload_image for VideoStreamContainer/ WindowContainer.
 
bool run_lane (size_t lane, const std::vector< Kinesis::Vision::ResolvedSequence > &resolved, std::vector< Kinesis::Vision::VisionResult > &results, const std::shared_ptr< Core::VKImage > &image)
 Run or poll sequence lane of resolved on its executor.
 
output_type run_operation (const input_type &input)
 ComputeOperation adapter: uses input.data as the source container, pulls index out of Datum metadata (defaulting to 0), calls analyze_vision().
 
Kinesis::Vision::FieldSample sample_full_frame (const std::shared_ptr< Core::VKImage > &image, uint32_t w, uint32_t h)
 Dispatch region_sample.comp over the whole image (no region concept for MeasureAppearance).
 

Private Attributes

std::shared_ptr< ShaderExecutionContext<> > m_brightness_reducer
 
Kinesis::Vision::VisionAnalysisContext m_context
 
std::vector< std::unique_ptr< VisionGpuExecutor > > m_executors
 
std::shared_ptr< Core::VKImage > m_frame
 
Portal::Graphics::ImageCacheEntry m_frame_cache
 
std::shared_ptr< TextureExecutionContext > m_gradient_sample_ctx
 
std::shared_ptr< TextureExecutionContext > m_histogram_ctx
 
size_t m_label_lane { 0 }
 
std::shared_ptr< ShaderExecutionContext<> > m_neighbor_ctx
 
Kinesis::Vision::VisionQuery m_query
 
std::shared_ptr< const std::vector< Kinesis::Vision::VisionResult > > m_results
 
StepRun m_run
 
std::shared_ptr< ShaderExecutionContext<> > m_shape_ctx
 
std::shared_ptr< ShaderExecutionContext<> > m_track_reducer
 
uint32_t m_upload_h { 0 }
 
std::shared_ptr< Core::VKImage > m_upload_image
 
uint32_t m_upload_w { 0 }
 

Friends

class Vision::VisionMatrix
 

Additional Inherited Members

- Protected Member Functions inherited from MayaFlux::Yantra::FunctionalOperation< std::shared_ptr< Kakshya::SignalSourceContainer >, std::vector< Kakshya::DataVariant > >
output_type operation_function (const input_type &input) override
 Executes the computational transformation on the input data.
 
- Protected Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
output_type apply_hooks (const input_type &input, const ExecutionContext &context)
 
virtual std::future< output_type > apply_operation_async (const input_type &input)
 Optional async implementation - default delegates to operation_function.
 
virtual output_type apply_operation_chained (const input_type &input, const ExecutionContext &ctx)
 Optional chain-aware implementation - default delegates to operation_function.
 
virtual output_type apply_operation_internal (const input_type &input, const ExecutionContext &context)
 Internal execution method - ComputeMatrix can access this.
 
virtual output_type apply_operation_parallel (const input_type &input, const ExecutionContext &ctx)
 Optional parallel-aware implementation - default delegates to operation_function.
 
output_type convert_result (std::vector< std::vector< double > > &result_data, DataStructureInfo &metadata)
 Convert processed double data back to OutputType using metadata and optional callback.
 
- Protected Attributes inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
std::shared_ptr< Kakshya::SignalSourceContainer > m_container
 
std::shared_ptr< GpuExecutionContext< InputType, OutputType > > m_gpu_backend
 
ExecutionContext m_last_execution_context
 

Detailed Description

Resolves its configured VisionQuery, runs every resolved VisionSequence against a persistent VisionGpuExecutor, then runs the GPU reductions (track_reduce.comp) over the (context-filtered) subject tracks/keypoints for centroid/velocity/bounds.

Owns its VisionGpuExecutor for the same reason VisionProcessor does: cross-frame state (retained optical flow atlases and detections) lives on the executor's contexts and must survive between calls.

Definition at line 45 of file VisionAnalyzer.hpp.


The documentation for this class was generated from the following files: