Skip to content

Instantly share code, notes, and snippets.

@pramukta
pramukta / zorder.json
Last active September 20, 2019 21:24
zorder stage for pdal
{
"pipeline": [
{
"type": "readers.ept",
"filename": "https://pixel8austin.storage.googleapis.com/lidar/ept.json",
"bounds": "([621208.2565613358, 621408.2565613358], [3347979.1272665653, 3348179.1272665653])"
},
{
"type":"filters.normal",
"knn":8
from numba import cuda
@cuda.jit(device=True)
def _gpu_average(arr):
out = 0.0
for i in range(arr.shape[0]):
for j in range(arr.shape[1]):
out = out + arr[i,j]
return out / arr.size
import numpy as np
import numba
@numba.stencil(neighborhood=((-1, 1), (-1, 1)))
def _average(arr):
return np.mean(arr[-1:2, -1:2])
@numba.jit(nopython=True, parallel=True)
def averaging_filter(arr):
@pramukta
pramukta / reconstruction.py
Created February 15, 2018 18:19
Laplacian pyramid reconstruction
def reconstruct(pyr):
img = pyr[-1]
for resid in reversed(pyr[:-1]):
up = np.stack([cv2.pyrUp(layer) for layer in img])
nr, nc = resid.shape[1:]
img = up[:,:nr,:nc] + resid
return img
@pramukta
pramukta / pyramid.py
Created February 15, 2018 18:08
Helper routines to compute a Laplacian pyramid image representation using OpenCV
import numpy as np
import cv2
def next_pyramid_layer(img):
down = np.stack([cv2.pyrDown(layer) for layer in img])
up = np.stack([cv2.pyrUp(layer) for layer in down])
nr, nc = img.shape[1:]
resid = img - up[:,:nr,:nc]
return img - up[:,:nr,:nc], down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.