Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ags_grabber
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Larkin Heintzman
ags_grabber
Commits
6fc50d65
Commit
6fc50d65
authored
Mar 31, 2023
by
Bryson Howell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added functions to create map of linear features and check the environment height
parent
955777e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
kentland_features.png
unity_data/kentland_features.png
+0
-0
unity_heightmap.py
unity_heightmap.py
+23
-0
No files found.
unity_data/kentland_features.png
0 → 100644
View file @
6fc50d65
119 KB
unity_heightmap.py
View file @
6fc50d65
...
@@ -24,10 +24,33 @@ def main():
...
@@ -24,10 +24,33 @@ def main():
linfeat
=
matdict
[
'BWLF'
]
#Values are 1 for linear feature present, 0 for none
linfeat
=
matdict
[
'BWLF'
]
#Values are 1 for linear feature present, 0 for none
obstacles
=
matdict
[
'BWInac'
]
#Values are 1 for obstacle, 0 for clear
obstacles
=
matdict
[
'BWInac'
]
#Values are 1 for obstacle, 0 for clear
check_elev
(
elev
)
make_featmap
(
linfeat
,
savedir
)
make_heightmap
(
elev
,
savedir
)
make_heightmap
(
elev
,
savedir
)
return
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
#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
#that can be loaded into Unity. Heightmaps are 16-bit grayscale images saved in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment