Skip to content

Instantly share code, notes, and snippets.

View moi90's full-sized avatar

Simon-Martin Schröder moi90

View GitHub Profile
@moi90
moi90 / write_pgm.c
Created November 24, 2016 09:51
Save an image consisting of unsigned chars to a pgm file
void write_pgm(unsigned short id, unsigned char *buf, int width, int height) {
char filename[1024];
sprintf(filename, "%simage_%d.pgm", destinationPrefix, id);
FILE *fp = fopen(filename, "wb");
if (fp) {
fprintf(fp, "P5\n%d %d\n%d\n", width, height, 0xFF);
fwrite(buf, width * height, 1, fp);
fclose(fp);
'''
Created on 06.12.2017
@author: mschroeder
'''
def create_tree(depth, n_children):
if depth > 0:
return [create_tree(depth - 1, n_children) for _ in range(n_children)]
import matplotlib.pyplot as plt
from scipy.spatial import distance
from fastdist import fastdist
import timeit
import numpy as np
import numba
from fastdist import __version__ as fastdist_version
import scipy
from cpuinfo import get_cpu_info
@moi90
moi90 / flowcam.py
Last active November 25, 2020 18:20
Process flowcam images using MorphoCut
import os.path
from morphocut import Call, Pipeline
from morphocut.contrib.ecotaxa import EcotaxaWriter
from morphocut.contrib.zooprocess import CalculateZooProcessFeatures
from morphocut.file import Glob
from morphocut.image import FindRegions, ImageReader, RGB2Gray
from morphocut.parallel import ParallelPipeline
from morphocut.str import Format
from morphocut.stream import Enumerate, Unpack
\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\usepackage{etoolbox}
% Individual \itshape or \bfseries work without this.
% Combinations of both need the robustified version
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.