Skip to content

Commit 8bc349a

Browse files
committed
define depthToRGB8 function
1 parent 3bff469 commit 8bc349a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

common_interfaces_cpp/src/hal/camera.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ std::shared_ptr<Image> imageMsg2Image(const sensor_msgs::msg::Image& img) {
4646
return image;
4747
}
4848

49+
cv::Mat depthToRGB8(const cv::Mat& gray_img_buff, const std::string& encoding) {
50+
cv::Mat color_img;
51+
if (!gray_img_buff.empty()) {
52+
cv::cvtColor(gray_img_buff, color_img, cv::COLOR_GRAY2BGR);
53+
}
54+
return color_img;
55+
}
56+
4957
CameraNode::CameraNode(const std::string& topic)
5058
: Node("camera_node") {
5159
sub_ = this->create_subscription<sensor_msgs::msg::Image>(

0 commit comments

Comments
 (0)