Skip to content

Instantly share code, notes, and snippets.

View TheVaffel's full-sized avatar

Håkon Flatval TheVaffel

View GitHub Profile
@TheVaffel
TheVaffel / Makefile
Last active August 23, 2021 10:47
A script that takes in an image and creates a new image consisting of triangles which roughly resembles the colors in the original image. One use case is lock screens.
triangulate: triangulate.cpp
g++ $< -o $@ -L ../HConLib/lib/ -I ../HConLib/include/ -mavx -std=gnu++17 -lFlatAlg -lOpenImageIO -lHGraf -g -O3
@TheVaffel
TheVaffel / bash_prompt_README.md
Last active April 3, 2020 13:23
Bash Prompt (Which, when I come to think of it, translates to "poo fart" in Norwegian)

Bash prompt with Git repository name and branch

Will give prompts of the form

host ~/working/dir $

when outside a Git repo, and of the form

host repository_name/path/from/repo/root (branch) $

@TheVaffel
TheVaffel / Lucas_Kanade_README.md
Last active November 23, 2024 01:35
Simple implementation of the Lucas Kanade optical flow algorithm, including a coarse-to-fine approach and a visualization of the movement detected. See README below for instructions

Lucas Kanade implementation

This is a simple demonstration of the Lucas-Kanade algorithm. It's not very readable, and I'm sorry for it. I never thought it would find its way onto the webs.

Depends on HConLib. To compile, you need to clone and build HConLib (running build.sh in the root of HConLib is usually sufficient). Then, use the line g++ lucas_kanade.cpp -I /path/to/HConLib/include/ -L /path/to/HConLib/lib/ -l HCam -l Winval -l HGraf -l FlatAlg -l X11 -std=c++11 -o lucas_kanade -O3 and you should be good

//Webcamera utility
#ifndef INCLUDED_HCAM
#define INCLUDED_HCAM
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define TJE_IMPLEMENTATION
#include "tiny_jpeg.h"
#include <string.h>
#include <algorithm>
#include <cstdio>
using namespace std;