Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebGPU Image Convolution</title>
</head>
<body>
<h1>WebGPU Image Convolution</h1>
<button id="run">Run Convolution</button>
@PWhiddy
PWhiddy / webcam_face_follow.py
Created November 17, 2023 19:55
match face position from a video to your webcam in realtime
import cv2
import hnswlib
import numpy as np
def set_resolution(cap, width, height):
cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
def extract_face_pose(frame, face_detector):
faces = face_detector.detectMultiScale(frame, scaleFactor=1.1, minNeighbors=5)
@PWhiddy
PWhiddy / Test_bbox_to_mask.ipynb
Created October 5, 2021 02:01
Improved implementation of bbox_to_mask
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PWhiddy
PWhiddy / install_linux_tools.sh
Last active May 10, 2021 07:22
A handful of common dev tools
apt update && apt install \
tmux \
htop \
git \
ffmpeg \
zip \
python3-pip
@PWhiddy
PWhiddy / stamps.cpp
Created May 31, 2019 22:54
options for speeding up the stamp generation
// original function, generates single trajectory
RawImage KBMOSearch::stackedStamps(trajectory t, int radius, std::vector<RawImage*> imgs)
{
if (radius<0) throw std::runtime_error("stamp radius must be at least 0");
int dim = radius*2+1;
RawImage stamp(dim, dim);
std::vector<float> times = stack.getTimes();
for (int i=0; i<imgs.size(); ++i)
{
for (int x=0; x<dim; ++x)
@PWhiddy
PWhiddy / untar
Created June 19, 2018 04:36
Extract a .tar.gz
#!/bin/sh
# Add this to /bin/ folder and never look up how to extract a tar again
# Usage: untar some-software-1.0-linux-x86_64.tar.gz
tar -zxvf $1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.