This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
#include <string> | |
using namespace cv; | |
int main(int argc, char **argv) { | |
int camno = 0; | |
if(argc > 2) { | |
camno = std::atoi(argv[1]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* GStreamer | |
* Copyright (C) 2006 Stefan Kost <[email protected]> | |
* Copyright (C) 2017 Jami Pekkanen <[email protected]> | |
* | |
* This library is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU Library General Public | |
* License as published by the Free Software Foundation; either | |
* version 2 of the License, or (at your option) any later version. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gistup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.stats | |
import pyximport; pyximport.install() | |
from pixcount import pixcount | |
import scipy.ndimage | |
data = np.load('diffs.npy') | |
ts = data[:,0] | |
frames = 1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.interpolate | |
import scipy.signal | |
def match_sampled_brutal(ts1, haystack, ts2, needle, minlen=100): | |
dt = np.median(np.diff(ts1)) | |
ts1_base = ts1[0] | |
ts1 = ts1 - ts1_base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def project_to_ground(pos, camera, height=0.0): | |
matWorldInverse = np.array(camera['matrixWorldInverse']).reshape(4, 4).T | |
matWorld = np.linalg.inv(matWorldInverse) | |
proj = np.array(camera['projectionMatrix']).reshape(4, 4).T | |
origin = matWorld[:,3][:-1] | |
deproj = np.dot(matWorld, np.linalg.inv(proj)) | |
direction = np.dot(deproj, (pos[0], pos[1], 0.5, 1.0)) | |
direction = direction[:-1]/direction[-1] | |
direction -= origin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[-19.150852756939567, -0.86960922500437798], [-10.0, -0.67314024428906383], [-4.0, -0.53092823365752206], [-2.5, -0.34978573520149692], [-1.7, -0.097415037510977784], [-1.2, 0.031117285095661945], [0.0, 0.26398121786496032], [3.0, 0.71245888265216406], [5.2096257357368652, 0.93516331581155065]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy | |
import math | |
import itertools | |
import random | |
import matplotlib.pyplot as plt | |
class Som(object): | |
"""Self-organizing map | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{zipWith, fold, map, zipAll, findIndex, objsToLists} = require "prelude-ls" | |
fobj = -> (...args) -> | |
me = {} | |
callable = f.apply(me, args) ? me | |
me.__proto__ = callable.__proto__ | |
callable.__proto__ = me | |
return callable | |
export isScalar = (v) -> typeof v == 'number' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Motivation for this madness: I often find that simply a function is | |
# a nice interface objects. However, often later on a need arises that | |
# we need also something else in a return value / argument, which currently | |
# calls for refactoring of every call site. In Python this can be hacked | |
# around using __call__. This would be a way to hack around it in LiveScript. | |
# | |
# And anyway I think having separate "classes" and "objects" is a bit stupid | |
# historical artefact. KISS! | |
fobj = (f) -> (...args) -> |