47 pub = nh.
advertise<sensor_msgs::Image>(
"error_disparity", 1);
63 sensor_msgs::ImagePtr im = boost::make_shared<sensor_msgs::Image>();
65 const uint64_t freq = 1000000000ul;
68 im->header.seq =
seq++;
69 im->header.stamp.sec = time / freq;
70 im->header.stamp.nsec = time - freq * im->header.stamp.sec;
75 im->width =
static_cast<uint32_t
>(buffer->
getWidth(part));
76 im->height =
static_cast<uint32_t
>(buffer->
getHeight(part));
81 const uint8_t* ps =
static_cast<const uint8_t*
>(buffer->
getBase(part));
87 im->step = im->width *
sizeof(float);
89 im->data.resize(im->step * im->height);
90 float* pt =
reinterpret_cast<float*
>(&im->data[0]);
92 for (uint32_t k = 0; k < im->height; k++)
94 for (uint32_t i = 0; i < im->width; i++)
96 *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
bool used() override
Returns true if there are subscribers to the topic.
void publish(const rcg::Buffer *buffer, uint32_t part, uint64_t pixelformat) override
Offers a buffer for publication.
size_t getXPadding(std::uint32_t part) const
size_t getWidth(std::uint32_t part) const
ErrorDisparityPublisher(ros::NodeHandle &nh, const std::string &frame_id_prefix, double scale)
Initialization of publisher for disparity errors.
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)
uint64_t getTimestampNS() const
uint32_t getNumSubscribers() const
size_t getHeight(std::uint32_t part) const