4 # Load an image from disk and publish it repeatedly
10 from sensor_msgs.msg import Image
12 if __name__ == '__main__':
13 rospy.init_node('image_publish')
16 image = cv2.imread(name)
17 #cv2.imshow("im", image)
20 hz = rospy.get_param("~rate", 1)
23 pub = rospy.Publisher('/test/image', Image, queue_size=1)
26 msg.header.stamp = rospy.Time.now()
28 msg.height = image.shape[0]
29 msg.width = image.shape[1]
30 msg.step = image.shape[1] * 3
31 msg.data = image.tostring()
34 while not rospy.is_shutdown():