Skip to content

Commit b9e280f

Browse files
committed
chore: trying to find out the proper way to use Adapters
1 parent 9e4cead commit b9e280f

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

rerun_bridge/src/rerun_bridge/collection_adapters.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,3 @@ struct rerun::CollectionAdapter<TElement, cv::Mat> {
2525
inline rerun::WidthHeight width_height(const cv::Mat& img) {
2626
return rerun::WidthHeight(static_cast<size_t>(img.cols), static_cast<size_t>(img.rows));
2727
};
28-
29-
template <typename T>
30-
rerun::Collection<T> img_data_as_collection(const cv::Mat& img) {
31-
const T* img_data = reinterpret_cast<const T*>(img.data);
32-
33-
size_t img_size = img.total() * img.channels();
34-
35-
std::vector<T> img_vec(img_data, img_data + img_size);
36-
37-
return rerun::Collection<T>::take_ownership(std::move(img_vec));
38-
}

rerun_bridge/src/rerun_bridge/rerun_ros_interface.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void log_image(
116116
cv::Mat img = cv_bridge::toCvCopy(msg)->image;
117117
rec.log(
118118
entity_path,
119-
rerun::DepthImage(img_data_as_collection<uint16_t>(img), width_height(img)).with_meter(1000)
119+
rerun::DepthImage(rerun::Collection<uint16_t>(img), width_height(img)).with_meter(1000)
120120
);
121121
} else if (msg->encoding == "32FC1") {
122122
cv::Mat img = cv_bridge::toCvCopy(msg)->image;
@@ -128,13 +128,13 @@ void log_image(
128128
}
129129
rec.log(
130130
entity_path,
131-
rerun::DepthImage(img_data_as_collection<float>(img), width_height(img)).with_meter(1.0)
131+
rerun::DepthImage(rerun::Collection<float>(img), width_height(img)).with_meter(1.0)
132132
);
133133
} else {
134134
cv::Mat img = cv_bridge::toCvCopy(msg, "rgb8")->image;
135135
rec.log(
136136
entity_path,
137-
rerun::Image::from_rgb24(img_data_as_collection<uint8_t>(img), width_height(img))
137+
rerun::Image::from_rgb24(rerun::Collection<uint8_t>(img), width_height(img))
138138
);
139139
}
140140
}

0 commit comments

Comments
 (0)