Complete the code to subscribe to an image topic named '/camera/image_raw'.
image_sub = rospy.Subscriber('[1]', Image, image_callback)
The topic name '/camera/image_raw' is the standard topic for raw camera images in ROS.
Complete the code to import the correct message type for image data.
from sensor_msgs.msg import [1]
The 'Image' message type from 'sensor_msgs.msg' is used for image data in ROS.
Fix the error in the callback function definition to accept the image message.
def image_callback([1]): rospy.loginfo('Received image')
The callback function must accept the message parameter, commonly named 'msg'.
Fill both blanks to initialize the ROS node and start listening to the image topic.
rospy.[1]('image_listener') rospy.[2]()
Use 'init_node' to start the node and 'spin' to keep it running and processing callbacks.
Fill all three blanks to convert the ROS image message to OpenCV format using cv_bridge.
bridge = CvBridge() cv_image = bridge.[1](msg, desired_encoding=[2]) cv2.imshow('Image', cv_image) cv2.[3](1)
Use 'imgmsg_to_cv2' to convert the ROS image message, specify 'bgr8' encoding for color images, and 'waitKey' to display the image window properly.
