59 sensor_msgs::ImagePtr im = boost::make_shared<sensor_msgs::Image>();
61 const uint64_t freq = 1000000000ul;
64 im->header.seq =
seq++;
65 im->header.stamp.sec = time / freq;
66 im->header.stamp.nsec = time - freq * im->header.stamp.sec;
71 im->width =
static_cast<uint32_t
>(buffer->
getWidth(part));
72 im->height =
static_cast<uint32_t
>(buffer->
getHeight(part));
77 const uint8_t* ps =
static_cast<const uint8_t*
>(buffer->
getBase(part));
83 im->step = im->width *
sizeof(float);
85 im->data.resize(im->step * im->height);
86 float* pt =
reinterpret_cast<float*
>(&im->data[0]);
88 float scale = 1.0f / 255.0f;
90 for (uint32_t k = 0; k < im->height; k++)
92 for (uint32_t i = 0; i < im->width; i++)
94 *pt++ = scale * *ps++;
Interface for all publishers relating to images, point clouds or other stereo-camera data...
void publish(const boost::shared_ptr< M > &message) const
size_t getXPadding(std::uint32_t part) const
size_t getWidth(std::uint32_t part) const
void * getBase(std::uint32_t part) const
const std::string TYPE_32FC1
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void publish(const rcg::Buffer *buffer, uint32_t part, uint64_t pixelformat) override
Offers a buffer for publication.
uint64_t getTimestampNS() const
uint32_t getNumSubscribers() const
ConfidencePublisher(ros::NodeHandle &nh, const std::string &frame_id_prefix)
Initialization of publisher.
size_t getHeight(std::uint32_t part) const
bool used() override
Returns true if there are subscribers to the topic.