Go to the documentation of this file.00001
00002
00003
00004
00005
00006 import rospy
00007 from sensor_msgs.msg import Image
00008 import cv2, cv_bridge
00009 class Follower:
00010 def __init__(self):
00011 self.bridge = cv_bridge.CvBridge()
00012 cv2.namedWindow("window", 1)
00013 self.image_sub = rospy.Subscriber('camera/rgb/image_raw',
00014 Image, self.image_callback)
00015
00016 def image_callback(self, msg):
00017 image = self.bridge.imgmsg_to_cv2(msg,desired_encoding='bgr8')
00018 cv2.imshow("window", image)
00019 cv2.waitKey(3)
00020 rospy.init_node('follower')
00021 follower = Follower()
00022 rospy.spin()