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

◆ read_exported_keypoints()

std::vector< Kinesis::Vision::Keypoint > MayaFlux::Yantra::VisionGpuExecutor::read_exported_keypoints ( const Kinesis::Vision::VisionResult &  result)
static

Host keypoints decoded from result.buffers.keypoints, or empty.

Independent of VisionResult::structured. For occasional host access, not per-frame use. Valid for one more run after the result was delivered.

Definition at line 170 of file VisionFeatureDispatch.cpp.

172{
173 const auto& handle = result.buffers.keypoints;
174 const auto count = exported_record_count(handle, 1);
175 if (!count)
176 return {};
177
178 const auto* records = static_cast<const glm::vec4*>(handle->mapped_ptr) + 1;
179 std::vector<Kinesis::Vision::Keypoint> out;
180 out.reserve(*count);
181 for (uint32_t i = 0; i < *count; ++i) {
182 out.push_back({
183 .position = { records[i].x, records[i].y },
184 .response = records[i].z,
185 .scale = 1.0F,
186 .angle = 0.0F,
187 });
188 }
189 return out;
190}
std::vector< float > * out
size_t count
std::optional< uint32_t > exported_record_count(const std::shared_ptr< Portal::Graphics::GpuBufferHandle > &handle, size_t stride_vec4)
Clamped record count from an exported buffer's vec4 header, or nullopt when the buffer isn't readable...

References MayaFlux::Kinesis::Vision::VisionResult::buffers, count, MayaFlux::Yantra::VisionInternal::exported_record_count(), MayaFlux::Kinesis::Vision::BufferOutputs::keypoints, and out.

+ Here is the call graph for this function: