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

◆ advance()

std::optional< Kinesis::Vision::VisionAnalysis > MayaFlux::Yantra::VisionAnalyzer::advance ( const std::shared_ptr< Core::VKImage > &  image)

Advance an analysis of image by one sequence per call, without waiting on deferred GPU work.

The first call copies image and starts a run on the copy. Later calls continue that run and ignore image until it completes. The flow steps of TrackObjects and EstimateMotion are submitted deferred and polled on later calls; other steps still wait inline.

Returns
The analysis once every sequence has completed, otherwise nullopt.

Definition at line 442 of file VisionAnalyzer.cpp.

444{
445 if (!m_run.active) {
446 if (!image)
447 return std::nullopt;
448
450 if (!m_frame)
451 return std::nullopt;
452
454 for (auto& entry : m_run.resolved) {
455 for (auto& step : entry.sequence.steps) {
458 step.deferred = true;
459 }
460 }
461
462 m_run.results.clear();
463 m_run.results.reserve(m_run.resolved.size());
464 m_run.w = m_frame->get_width();
465 m_run.h = m_frame->get_height();
466 m_run.active = true;
467 m_label_lane = 0;
468 }
469
470 const size_t lane = m_run.results.size();
471 if (lane < m_run.resolved.size() && !run_lane(lane, m_run.resolved, m_run.results, m_frame))
472 return std::nullopt;
473
474 if (m_run.results.size() < m_run.resolved.size())
475 return std::nullopt;
476
477 m_run.active = false;
478 auto analysis = assemble(m_run.resolved, m_run.results, m_run.w, m_run.h);
479 m_results = std::make_shared<const std::vector<Kinesis::Vision::VisionResult>>(std::move(m_run.results));
480 return analysis;
481}
IO::ImageData image
Definition Decoder.cpp:47
Kinesis::Vision::VisionQuery m_query
std::shared_ptr< Core::VKImage > m_frame
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.
std::shared_ptr< Core::VKImage > hold_frame(const std::shared_ptr< Core::VKImage > &image)
Copy image into this analyzer's own frame image.
std::shared_ptr< const std::vector< Kinesis::Vision::VisionResult > > m_results
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 GP...
std::vector< ResolvedSequence > resolve(const VisionQuery &query)
Resolve a VisionQuery into the ResolvedSequences needed to satisfy every active intent.
std::shared_ptr< Vruta::Routine > sequence(std::vector< std::pair< double, std::function< void()> > > sequence, Vruta::ProcessingToken token)
Creates a temporal sequence that executes callbacks at specified time offsets.
Definition Tasks.cpp:46
std::vector< Kinesis::Vision::ResolvedSequence > resolved
std::vector< Kinesis::Vision::VisionResult > results

References MayaFlux::Yantra::VisionAnalyzer::StepRun::active, assemble(), MayaFlux::Yantra::VisionAnalyzer::StepRun::h, hold_frame(), image, m_frame, m_label_lane, m_query, m_results, m_run, MayaFlux::Kinesis::Vision::OpticalFlowDense, MayaFlux::Kinesis::Vision::resolve(), MayaFlux::Yantra::VisionAnalyzer::StepRun::resolved, MayaFlux::Yantra::VisionAnalyzer::StepRun::results, run_lane(), MayaFlux::Kinesis::Vision::TrackKeypoints, and MayaFlux::Yantra::VisionAnalyzer::StepRun::w.

+ Here is the call graph for this function: