RViz drawing extra pixel on left and right of image
On more than one standard image_transport::ImageTransport
topic that we publish to with straightforward code below, when we view the image topic in RViz, depending on the size of the window we see a ghost one-pixel line to the left and right of the image which appears to be an extra pixel wrapping around from the other side of the image. eg:
The freehand circles indicate extra pixels that do not appear if I directly capture the topic with rosrun image_view image_view image:=/my_topic
and press the Save
button. The lines also disappear and reappear as I change the height of the window. On the right-hand line there is a whiter pixel that lines up with the white line on the left-hand side, which leads me to believe this is an off-by-one (or off by 0.5?) rounding bug somewhere.
The code:
class ImageTransportPublisher
{
private:
std::unique_ptr<image_transport::ImageTransport> m_it;
image_transport::Publisher m_imageRawPublisher;
public:
void advertise(ros::NodeHandle &nh, char const * const topic)
{
advertise(nh, std::string(topic));
}
void advertise(ros::NodeHandle &nh, std::string const &topic)
{
m_it = std::unique_ptr<image_transport::ImageTransport>(new image_transport::ImageTransport(nh));
m_imageRawPublisher = m_it->advertise(topic, 1u);
}
uint32_t getNumSubscribers() const
{
return m_imageRawPublisher.getNumSubscribers();
}
void publish(cv::Mat const &image, std_msgs::Header const &header, std::string const &encoding = sensor_msgs::image_encodings::BGR8) const
{
const cv_bridge::CvImage image_message(header, encoding, image);
m_imageRawPublisher.publish(image_message.toImageMsg());
}
};
Asked by KenYN on 2019-11-26 02:56:43 UTC
Comments
This reads like a potential bug report, which should probably be posted on the RViz issue tracker.
And I believe the 'correct' terminology could be "cheese".
Asked by gvdhoorn on 2019-11-26 03:09:32 UTC
I've just looked at the bug tracker, and it's there. What's the best course of action here since it's a known issue?
Asked by KenYN on 2019-11-26 03:16:36 UTC
I would suggest adding your information and potentially ask for instructions on how to fix it. A PR would then be perfect. Robert has been somewhat more active as a maintainer, so perhaps you can get things to move that way.
Asked by gvdhoorn on 2019-11-26 03:19:07 UTC