14 std::string
imageEncoding(
bool isFloat,
int channels,
int bytesPerElement)
39 switch (bytesPerElement)
50 switch (bytesPerElement)
61 switch (bytesPerElement)
72 switch (bytesPerElement)
85 ROS_ERROR(
"Invalid image encoding in binary NxLib node.");
91 auto image = boost::make_shared<sensor_msgs::Image>();
94 int width, height, channels, bytesPerElement;
96 node.getBinaryDataInfo(&width, &height, &channels, &bytesPerElement, &isFloat, ×tamp);
99 image->header.frame_id = frame;
100 image->width = width;
101 image->height = height;
102 image->step = width * channels * bytesPerElement;
103 image->encoding =
imageEncoding(isFloat, channels, bytesPerElement);
105 node.getBinaryData(image->data, 0);
111 std::string
const& frame)
116 return { leftImage, rightImage };
119 std::vector<std::pair<sensor_msgs::ImagePtr, sensor_msgs::ImagePtr>>
imagesFromNxLibNode(
const NxLibItem& node,
120 std::string
const& frame)
122 std::vector<std::pair<sensor_msgs::ImagePtr, sensor_msgs::ImagePtr>> result;
126 for (
int i = 0; i < node.count(); i++)
142 node.getBinaryDataInfo(0, 0, 0, 0, 0, ×tamp);
151 node.getBinaryData(pointMap, ×tamp);
154 cv::extractChannel(pointMap, depthImage, 2);
159 out_msg.
header.frame_id = frame;
161 out_msg.
image = depthImage;
const std::string TYPE_16UC4
sensor_msgs::ImagePtr imageFromNxLibNode(NxLibItem const &node, std::string const &frame)
const std::string TYPE_64FC3
const std::string TYPE_8UC4
ros::Time timestampFromNxLibNode(const NxLibItem &node)
double const NXLIB_TIMESTAMP_OFFSET
const std::string TYPE_32FC4
sensor_msgs::ImagePtr depthImageFromNxLibNode(NxLibItem const &node, std::string const &frame)
std::vector< std::pair< sensor_msgs::ImagePtr, sensor_msgs::ImagePtr > > imagesFromNxLibNode(const NxLibItem &node, std::string const &frame)
std::string imageEncoding(bool isFloat, int channels, int bytesPerElement)
std::pair< sensor_msgs::ImagePtr, sensor_msgs::ImagePtr > imagePairFromNxLibNode(const NxLibItem &node, std::string const &frame)
const std::string TYPE_32FC1
const std::string TYPE_8UC2
const std::string TYPE_64FC4
const std::string TYPE_16UC3
const std::string TYPE_16UC2
const std::string TYPE_32SC2
const std::string TYPE_64FC1
const std::string TYPE_64FC2
const std::string TYPE_32SC3
const std::string TYPE_8UC3
const std::string TYPE_32SC4
const std::string TYPE_32FC3
const std::string TYPE_32FC2
const std::string TYPE_32SC1
sensor_msgs::ImagePtr toImageMsg() const