'ROS turtlebot3 gazebo camera is black on openCV
When i run the following python script to show the turtlebot3 cam on an opencv window, the cam is black, however on rviz the camera seems to be working.
import rospy
from sensor_msgs.msg import Image
import cv2, cv_bridge
class Follower:
def __init__(self):
self.bridge = cv_bridge.CvBridge()
cv2.namedWindow("window", 1)
self.image_sub = rospy.Subscriber('/camera/rgb/image_raw',
Image, self.image_callback)
def image_callback(self, msg):
image = self.bridge.imgmsg_to_cv2(msg,desired_encoding='bgr8')
cv2.imshow("window", image)
cv2.waitKey(3)
rospy.init_node('follower')
follower = Follower()
rospy.spin()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
