15#ifndef AWVIZ_PLUGIN__IMAGE__COLLECTION_ADAPTER_HPP_
16#define AWVIZ_PLUGIN__IMAGE__COLLECTION_ADAPTER_HPP_
18#include <opencv2/opencv.hpp>
20#include <rerun/collection.hpp>
30template <
typename TElement>
31struct CollectionAdapter<TElement, cv::Mat>
36 return Collection<TElement>::borrow(
37 reinterpret_cast<TElement *
>(img.data), img.total() * img.channels());
44 std::vector<TElement> img_vec(img.total() * img.channels());
45 img_vec.assign(img.data, img.data + img.total() * img.channels());
46 return Collection<TElement>::take_ownership(std::move(img_vec));
59inline rerun::Collection<rerun::TensorDimension>
tensor_shape(
const cv::Mat & img)
62 static_cast<size_t>(img.rows),
static_cast<size_t>(img.cols),
63 static_cast<size_t>(img.channels())};
Definition: detected_objects_display.hpp:23
rerun::Collection< rerun::TensorDimension > tensor_shape(const cv::Mat &img)
Return image tensor shape as rerun::Collection.
Definition: collection_adapter.hpp:59
Definition: collection_adapter.hpp:26
Collection< TElement > operator()(cv::Mat &&img)
Definition: collection_adapter.hpp:42
Collection< TElement > operator()(const cv::Mat &img)
Borrow for non-temporary.
Definition: collection_adapter.hpp:34