Skip to content

Instantly share code, notes, and snippets.

@avanetten
avanetten / SN7_tmp
Last active August 5, 2020 18:25
sn7_tmp
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>
from matplotlib.collections import PatchCollection
from matplotlib.patches import Polygon
import matplotlib.pyplot as plt
import numpy as np
###############################################################################
def plot_all_transforms(input_image, pixel_coords, mask_image, dist_image,
figsize=(8,8), plot_name='', add_global_title=False,
colorbar=False, add_titles=False,
poly_face_color='orange', poly_edge_color='red',
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 21 09:46:53 2016
@author: avanetten
"""
'''
Transform SpaceNet geojson buidling labels data into raster masks.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 21 09:46:53 2016
@author: avanetten
"""
'''
See https://github.com/SpaceNetChallenge/utilities/tree/master/python/spaceNet
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from matplotlib.collections import PatchCollection
from matplotlib.patches import Polygon
import matplotlib.pyplot as plt
import numpy as np
###############################################################################
def plot_building_mask(input_image, pixel_coords, mask_image,
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from matplotlib.collections import PatchCollection
from matplotlib.patches import Polygon
import matplotlib.pyplot as plt
import numpy as np
###############################################################################
def plot_truth_coords(input_image, pixel_coords,
@avanetten
avanetten / create_dist_map.py
Last active December 22, 2017 14:36
Create signed distance transform
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''
See https://github.com/SpaceNetChallenge/utilities/tree/master/python/spaceNet
for more code
'''
from osgeo import gdal, ogr, gdalnumeric
import numpy as np
@avanetten
avanetten / create_building_mask.py
Last active December 22, 2017 14:22
Create building mask
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from osgeo import gdal, ogr
###############################################################################
def create_building_mask(rasterSrc, vectorSrc, npDistFileName='',
noDataValue=0, burn_values=1):
'''
@avanetten
avanetten / geojson_to_pixel_arr.py
Last active February 26, 2024 20:00
Create numpy arrays of coordinates
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from osgeo import gdal, osr
import numpy as np
import json
import sys
####################
# download spacenet utilities from: