RViz plugin to rotate sensor_msgs::Image
for visualisation purposes in-situ, especially so if camera is mounted at an angle. For avoidance of doubt, note that this plugin does not publish the rotated image.
Alternative topologies include launching an image_rotate node to rotate and publish the rotated image, and then subscribing said rotated image topic on RViz with the regular image display plugin.
This plugin works by taking the sensor_msgs::Image
before it is rendered, converting it to cv::Mat
if rotation is needed for OpenCV to perform the rotation, and converting the rotated image back to sensor_msgs::Image
for rendering.
This plugin was created for ROS Noetic, on Ubuntu-20.04. For the ROS2 version of this plugin, check out rviz2_rotatable_image_plugin.
- Clone this repository to your ROS workspace
- Build this package
catkin build rviz_rotatable_image_plugin
Select this plugin in RViz.
Original | 45° Rotation | 45° Rotation No Crop |
---|---|---|
Check if this plugin is installed properly (remember to source the workspace this plugin is in first):
rospack plugins --attrib=plugin rviz
You should see something like:
rviz_rotatable_image_plugin /home/user/catkin_ws/src/rviz_rotatable_image_plugin/plugin_description.xml
rviz /opt/ros/noetic/share/rviz/plugin_description.xml
This plugin would not have been possible if not for the contributions from the following (and contributions therein):
- lucasw's answer regarding wrapping Qt headers, with code
- Rotating image without crop in C++ OpenCV
- The people that contributed to OpenCV and
rviz::DisplayImage
- Mah weekend