【问题标题】:Show Grid line of 2d Map in image在图像中显示 2d 地图的网格线
【发布时间】:2020-12-08 10:47:09
【问题描述】:

我在谷歌和论坛上的任何地方搜索过 但我找不到我想要的。 希望有人可以在这里帮助我...

我使用 pcd 文件中的 map_server map_saver 从 octomap 生成了 2d 地图,它生成了 2 个文件,即 pgm 和 yaml 文件

但是生成的 pgm 文件没有上面有网格线。

我的问题是可以在 map_saver 生成的图像上显示网格线吗?或者有没有其他方法可以从二维地图生成带有网格线的图像?

【问题讨论】:

    标签: mapping 2d ros slam octomap


    【解决方案1】:

    你可以试试这个,改变地图尺寸,如果你有不同的方向,相应地旋转地图。

      import pylab as plt
      import numpy as np
      # Load the image
      img =  np.array(plt.imread("g_map.pgm"))
    
      # assume dimension of map 20mx20m
      map_dim_x = 20 
      map_dim_y = 20 
    
      # relationship between pixel and map  
      dx, dy = int(img.shape[0]/map_dim_x),int(img.shape[1]/map_dim_y)
    
      grid_color = 0
    
      img[:,::dy,] = grid_color
      img[::dx,] = grid_color
    
      plt.imshow(img)
      plt.show()
    

    【讨论】:

      猜你喜欢
      • 2018-03-17
      • 1970-01-01
      • 1970-01-01
      • 2014-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-09
      相关资源
      最近更新 更多