# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
import setup_path 
import airsim

import time
import os
import numpy as np
import matplotlib.pyplot as plt

def write_file(filename, bstr):
    print(filename)
    with open(filename, 'wb') as afile:
        afile.write(bstr)

# connect to the AirSim simulator 
client = airsim.CarClient()
client.confirmConnection()

# -

raw = client.simGetImages([airsim.ImageRequest("1", airsim.ImageType.Scene)])

# +
im  = np.fromstring(raw[0].image_data_uint8, dtype=np.uint8)
print(type(raw[0].image_data_uint8))


# -

filename = '/tmp/pyTEST'

write_file(os.path.normpath(filename + '.png'), raw[0].image_data_uint8)

im=plt.imread(filename+'.png')


# +
print(im.shape)
plt.imshow(im)

plt.draw
# -



StarcoderdataJupyterScriptsDedupFiltered