image_reply.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:telegram_robot 作者: uts-magic-lab 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号