Skip to content

Instantly share code, notes, and snippets.

View 1f0's full-sized avatar
🎯
focusing

Minliang LIN 1f0

🎯
focusing
View GitHub Profile
@1f0
1f0 / readvideo.py
Created August 26, 2019 15:27
cv2 read video
import numpy as np
import cv2
cap = cv2.VideoCapture('rtmp://localhost/live/stream')
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
@1f0
1f0 / obj2vtk.py
Created October 12, 2019 10:31
convert obj to vtk file using python vtk lib
from __future__ import print_function
import sys
if(len(sys.argv) != 3):
print('Usage: ', sys.argv[0], 'input.obj output.vtk')
sys.exit()
import vtk
reader = vtk.vtkOBJReader()
reader.SetFileName(sys.argv[1])
import argparse
p = argparse.ArgumentParser(description='off to obj.')
p.add_argument('input')
p.add_argument('out')
args = p.parse_args()
with open(args.input) as f:
lines = f.readlines()
meta = lines[1].split()
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
n = 25
q = n * n
A = np.eye(q)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def partition(n):
# x: current coin, y: remain value
def helper(x, y):
if y <= 0:
return int(y == 0)
# use x and not use x
z = helper(x, y-x)
if x < y:
z += helper(x+1, y)
return z