Skip to content

Instantly share code, notes, and snippets.

@ialhashim
ialhashim / fill_depth_colorization.py
Last active September 2, 2025 06:34
Python implementation of depth filling from NYU Depth v2 toolbox
# Original Matlab code https://cs.nyu.edu/~silberman/datasets/nyu_depth_v2.html
#
#
# Python port of depth filling code from NYU toolbox
# Speed needs to be improved
#
# Uses 'pypardiso' solver
#
import scipy
import skimage
@bigsnarfdude
bigsnarfdude / gist:510115144111ac81441cfb7009c3fdb0
Last active April 21, 2017 13:11
[traffic] counting opencv python
# https://www.youtube.com/watch?v=Y3ac5rFMNZ0&t=318s
# avconv -i rtsp://admin:admin@192.168.1.68/play1.sdp -c copy -map 0 -f segment -segment_time 300 -segment_format mp4 "capture-%03d-`date +%Y-%m-%d_%H:%M:%S`.mp4"
import cv2
backsub = cv2.BackgroundSubtractorMOG() #background subtraction to isolate moving cars
capture = cv2.VideoCapture("/home/ubuntu/Downloads/traffic_video.avi")
i = 0
minArea=1
while True:
ret, frame = capture.read()
@hellpanderrr
hellpanderrr / Python concave hull ( alpha shape ) .md
Last active April 27, 2022 22:51
Concave hull in python using scipy and networkx
from scipy.spatial import Delaunay, ConvexHull
import networkx as nx
 
points = [ [0,0],[0,50],[50,50],[50,0],[0,400],[0,450],[50,400],[50,450],[700,300],[700,350],[750,300],[750,350],
          [900,600],[950,650],[950,600],[900,650]
]
def concave(points,alpha_x=150,alpha_y=250):
    points = [(i[0],i[1]) if type(i) <> tuple else i for i in points]
    de = Delaunay(points)