Skip to content

Instantly share code, notes, and snippets.

View smidm's full-sized avatar

Matěj Šmíd smidm

View GitHub Profile
@smidm
smidm / statsmodels_influence_plot_tooltip.ipynb
Created October 26, 2021 06:23
Tooltips for Outliers in Regression Influence Plots
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smidm
smidm / flann_distance_test.py
Created February 28, 2019 14:43
test returned flann distance
from pyflann import *
import numpy as np
dataset = np.array(
[[1., 1, 1, 2, 3],
[10, 10, 10, 3, 2],
[100, 100, 2, 30, 1]
])
testset = np.array(
[[1., 1, 1, 1, 1],
@smidm
smidm / stable_matching_between_2_sets_of_points.py
Last active October 25, 2018 05:45
find stable matching of minimal distance between two sets of points
import numpy as np
import scipy.optimize
a = np.array([[0, 0], [1, 1], [2, 2]])
b = np.array([[0, 1], [2, 2.2], [1, 1.2], [0, 0]])
indices = np.indices((len(a), len(b)))
# array([[[0, 0, 0, 0],
# [1, 1, 1, 1],
# [2, 2, 2, 2]],
@smidm
smidm / mot.py
Created October 15, 2018 12:59
multiple object tracking challenge data file and evaluation
import pandas as pd
import errno
import numpy as np
import sys
import warnings
def save_mot(filename, df):
df.to_csv(filename, header=False, index=False)
@smidm
smidm / ellipse_bounding_box.ipynb
Last active March 26, 2023 04:27
Compute bounding box for an ellipse.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smidm
smidm / matplotlib_wait_or_exit.py
Created October 27, 2017 09:32
shows figure in matplotlib and waits for keypress or mouse click to continue, on figure close exits the loop
import matplotlib.pylab as plt
import numpy as np
fig = plt.figure()
closed = False
def handle_close(evt):
global closed
closed = True
@smidm
smidm / statnice-phd.txt
Created March 20, 2017 13:08 — forked from pasky/statnice-phd.txt
Outline k tematum PhD statnic na CVUT
Množiny. Teorie matic. Soustavy lineárních rovnic.
Gaussova eliminace
Diskriminant
Invertibilni matice, singularni matice
Linearni zobrazeni, eigenvalues
Základy matematické analýzy. Metody aproximace funkcí. Metoda nejmenších čtverců. Aplikace pro hledání modelů z naměřených reálných dat.
Lagrangeho multiplikatory
Newtonova metoda
Linearni regrese
@smidm
smidm / read-camera.py
Last active September 4, 2016 12:11 — forked from bsdnoobz/read-camera.py
Displaying webcam feed using OpenCV and Python+PySide.
#!/usr/bin/env python
from PySide.QtCore import *
from PySide.QtGui import *
import cv2
import sys
class MainApp(QWidget):
def __init__(self):
@smidm
smidm / pkgconfig.py
Created June 23, 2016 08:38
pkg-config python wrapper for building extensions with distutils
import subprocess
def pkgconfig(*packages, **kw):
"""
Query pkg-config for library compile and linking options. Return configuration in distutils
Extension format.
Usage:
pkgconfig('opencv')
# modified numpy concatenate, vstack, hstack accepting scalars in the input tuple
def concatenate(tup, axis=0):
tup_arrays = [x for x in tup if isinstance(x, np.ndarray)]
shape = list(tup_arrays[0].shape)
shape[axis] = 1
tup_ = []
for x in tup:
if isinstance(x, (int, long, float)):