Skip to content

Instantly share code, notes, and snippets.

from pprint import pprint
from collections import Counter
import csv
from itertools import chain
with open('Sj.csv', 'r', encoding='cp1251') as f:
reader = csv.reader(f)
your_list = list(reader)
def flatten(listOfLists):
from pprint import pprint
from copy import deepcopy
a = [
["a", "b", "Xval"],
["a", "b", "Yval, Zval"],
["a", "c", "Xval"],
["a", "d", "Xval"],
["a", "d", "Yval"],
["a", "d", "Xval"],
@qlkvg
qlkvg / openni2_exstension.py
Last active June 1, 2017 06:11
little extension for python openni2 library
@classmethod
def open_any_available(cls):
for cam in cls.enumerate_uris():
try:
return cls(cam)
except OpenNIError:
pass
raise Exception("no available cams")
@qlkvg
qlkvg / test.py
Created July 7, 2016 07:32
viewing depth map from openni2 compatible device with opencv2
#!/usr/bin/python
import cv2
import numpy as np
from primesense import openni2
from primesense import _openni2 as c_api
openni2.initialize("<PATH TO OPENNI2 REDIST FOLDER>")
dev = openni2.Device.open_any()
depth_stream = dev.create_depth_stream()
depth_stream.start()
depth_stream.set_video_mode(c_api.OniVideoMode(pixelFormat = c_api.OniPixelFormat.ONI_PIXEL_FORMAT_DEPTH_100_UM, resolutionX = 640, resolutionY = 480, fps = 30))