Commit 6fc50d65 authored by Bryson Howell's avatar Bryson Howell

Added functions to create map of linear features and check the environment height

parent 955777e8
......@@ -24,10 +24,33 @@ def main():
linfeat = matdict['BWLF'] #Values are 1 for linear feature present, 0 for none
obstacles = matdict['BWInac'] #Values are 1 for obstacle, 0 for clear
check_elev(elev)
make_featmap(linfeat,savedir)
make_heightmap(elev,savedir)
return
#Returns the difference between the min and max elevation.
#To be used as terrain height in Unity.
def check_elev(elev):
diff = np.max(elev)-np.min(elev)
print(diff)
print("Height of environment is %f\n" % diff)
return
#Saves image of linear features so it can be used as a mesh in Unity
def make_featmap(linfeat,savedir):
name = savedir + "kentland_features"
#Convert to png format image
feat_int8 = (linfeat*255).astype(np.uint8)
img = Image.fromarray(feat_int8)
img.save('./unity_data/kentland_features.png')
return
#Converts the terrain height data in the .mat files into a grayscale heightmap
#that can be loaded into Unity. Heightmaps are 16-bit grayscale images saved in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment