Pepper-.bmp到.explo

时间:2019-07-05 10:11:38

标签: python pepper

“世界你好!”

基本上,我正在用Pepper Robot绘制位置地图。但是,要证明这一点,我总是需要它来分析它所在的空间。问题是我无法去他的地方去做。

我所做的是.bmp中的图像,我想继续阅读可以读取.explo的图像。不幸的是我不能做到这一点,而恰恰相反。我在这里分享我想做的反代码:

def main(session):
"""
This example uses the explore method.
"""
# Get the services ALNavigation and ALMotion.
navigation_service = session.service("ALNavigation")
#motion_service = session.service("ALMotion")

# Wake up robot
# motion_service.wakeUp()

# name of this map
name_map = "2019-03-25T213532.632Z.explo"

# load the map
navigation_service.loadExploration("/home/nao/.local/share/Explorer/" + name_map)
# name of the image
name_image = name_map + ".bmp"
# Retrieve and display the map built by the robot
loaded_map = navigation_service.getMetricalMap()
map_width = loaded_map[1]
map_height = loaded_map[2]
img = numpy.array(loaded_map[4]).reshape(map_width, map_height)
img = (100 - img) * 2.55 # from 0..100 to 255..0
img = numpy.array(img, numpy.uint8)
output_image = Image.frombuffer('L',  (map_width, map_height), img, 'raw', 'L', 0, 1)
output_image.save(name_image, format=None)
#output_image.show()

有人有什么建议或您可以分享的任何帮助我的东西吗?

预先感谢

1 个答案:

答案 0 :(得分:0)

不可能将图像转换成探索图(至少,如果没有某种格式的 serious revererse-engineering,格式可能无法在将来的版本中使用),因为实际.explo映射不仅可以编码自上而下的墙,还可以编码更多的信息。根据版本的不同,可能会有一些3D信息等。