python 读取pgm格式地图

Posted 怪皮蛇皮怪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 读取pgm格式地图相关的知识,希望对你有一定的参考价值。

读取pgm格式地图

from PIL import Image

def read_img(name):
    im = Image.open(name)    # 读取文件
    return np.array(im)
    
if __name__ == '__main__':
    data = read_img("./map.pgm")
    print(data)

以上是关于python 读取pgm格式地图的主要内容,如果未能解决你的问题,请参考以下文章