Airsim_on_Unity遇到问题汇总

  1. 连接不上显示模拟器TypeError: unsupported operand type(s) for : ‘AsyncIOLoop’ and ‘float’ 解决 升级 msgpack-rpc-python 打开环境
    pip install --upgrade msgpack-rpc-python 
  1. 使用client.simGetImages图像获取后,格式转换出现问题,获取的是BGRA 4 通道的图像,应改成如下
img1d = np.fromstring(response.image_data_uint8, dtype=np.uint8) 
# reshape array to 4 channel image array H X W X 4
# img_rgb = img1d.reshape(response.height, response.width, 3)
img_rgb = img1d.reshape(response.height, response.width, 4)
# original image is fliped vertically
img_rgb = np.flipud(img_rgb)
# convert color pattern from BGRA to RGBA
img_rgb = cv2.cvtColor(img_rgb, cv2.COLOR_BGRA2RGBA)
# write to png 
airsim.write_png(os.path.normpath(filename + '.png'), img_rgb) 

你可能感兴趣的:(计算机视觉)