Last active
February 16, 2017 03:14
-
-
Save K-Francis-H/3bf8d50a134cbb1ed7f3d6baf427db0e to your computer and use it in GitHub Desktop.
GNU Octave script to load SRTM1 and SRTM3 data and print a grayscale image of the data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/octave -qf | |
| %usage: ./display_heightmap.m FILENAME FILETYPE | |
| args = argv(); | |
| file_name = args{1}; | |
| file_type = args{2}; %should be one of {"srtm1", "srtm3"}% | |
| if(file_type == "srtm1") | |
| size = 3601; | |
| else | |
| size = 1201; | |
| endif | |
| fid = fopen(file_name, "r", "ieee-be"); | |
| data = fread(fid, [size, size], "int16"); %3601 is SRTM1, 1201 is SRTM3% | |
| fclose(fid); | |
| data = data/max(max(data)); | |
| data = data'; | |
| imshow(data); | |
| pause; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment