def get_image_compressed(self):
rospy.loginfo("Getting image...")
image_msg = rospy.wait_for_message(
"/wide_stereo/left/image_raw/compressed",
CompressedImage)
rospy.loginfo("Got image!")
# Image to numpy array
np_arr = np.fromstring(image_msg.data, np.uint8)
# Decode to cv2 image and store
cv2_img = cv2.imdecode(np_arr, cv2.CV_LOAD_IMAGE_COLOR)
img_file_path = "/tmp/telegram_last_image.png"
cv2.imwrite(img_file_path, cv2_img)
rospy.loginfo("Saved to: " + img_file_path)
return img_file_path
# Define a few command handlers
评论列表
文章目录