44 bool _color,
bool out1_filter)
55 name =
"left/image_rect";
59 name =
"right/image_rect";
64 name = name +
"_color";
83 publish(buffer, part, pixelformat,
false);
99 sensor_msgs::ImagePtr im = boost::make_shared<sensor_msgs::Image>();
101 const uint64_t freq = 1000000000ul;
104 im->header.seq =
seq++;
105 im->header.stamp.sec = time / freq;
106 im->header.stamp.nsec = time - freq * im->header.stamp.sec;
111 im->width =
static_cast<uint32_t
>(buffer->
getWidth(part));
112 im->height =
static_cast<uint32_t
>(buffer->
getHeight(part));
113 im->is_bigendian =
false;
115 bool stacked =
false;
117 if (im->height > im->width)
125 const uint8_t* ps =
static_cast<const uint8_t*
>(buffer->
getBase(part));
126 size_t pstep = im->width + buffer->
getXPadding(part);
130 pstep = (im->width >> 2) * 6 + buffer->
getXPadding(part);
137 ps += pstep * im->height;
150 im->step = 3 * im->width *
sizeof(uint8_t);
152 im->data.resize(im->step * im->height);
153 uint8_t* pt =
reinterpret_cast<uint8_t*
>(&im->data[0]);
155 if (pixelformat ==
Mono8)
161 for (uint32_t k = 0; k < im->height; k++)
163 for (uint32_t i = 0; i < im->width; i += 4)
176 im->step = im->width *
sizeof(uint8_t);
178 im->data.resize(im->step * im->height);
179 uint8_t* pt =
reinterpret_cast<uint8_t*
>(&im->data[0]);
181 if (pixelformat ==
Mono8)
183 for (uint32_t k = 0; k < im->height; k++)
185 for (uint32_t i = 0; i < im->width; i++)
195 for (uint32_t k = 0; k < im->height; k++)
199 for (uint32_t i = 0; i < im->width; i += 4)
Interface for all publishers relating to images, point clouds or other stereo-camera data...
bool used() override
Returns true if there are subscribers to the topic.
image_transport::Publisher pub_out1_low
Publisher advertise(const std::string &base_topic, uint32_t queue_size, bool latch=false)
size_t getXPadding(std::uint32_t part) const
void publish(const rcg::Buffer *buffer, uint32_t part, uint64_t pixelformat) override
Offers a buffer for publication.
uint32_t getNumSubscribers() const
size_t getWidth(std::uint32_t part) const
image_transport::Publisher pub
void convYCbCr411toQuadRGB(uint8_t rgb[12], const uint8_t *row, int i)
void * getBase(std::uint32_t part) const
void publish(const sensor_msgs::Image &message) const
uint64_t getTimestampNS() const
image_transport::Publisher pub_out1_high
size_t getHeight(std::uint32_t part) const
ImagePublisher(image_transport::ImageTransport &it, const std::string &frame_id_prefix, bool left, bool color, bool out1_filter)
Initialization of publisher.