Skip to content

Instantly share code, notes, and snippets.

View jfjensen's full-sized avatar

Jes Fink-Jensen jfjensen

View GitHub Profile
@jfjensen
jfjensen / edit_privacy.py
Created October 1, 2022 12:00
This program is for blacking out the name of my player in the Albion Online screenshots.
import cv2 as cv
import glob
img_src = "screenshots"
img_dst = "raw_data"
img_paths = glob.glob(img_src + "/*.jpg")
index = 0
for img_path in img_paths:
@jfjensen
jfjensen / screenshot.py
Last active October 1, 2022 11:55
This program is used to take screenshots from the Albion Online game.
from time import time
import mss
import cv2 as cv
import numpy as np
from win32gui import FindWindow, GetWindowRect, SetForegroundWindow
window_handle = FindWindow(None, "Albion Online Client")
window_rect = GetWindowRect(window_handle)
SetForegroundWindow(window_handle)
@jfjensen
jfjensen / aruco_video.py
Created August 26, 2022 17:00
This is a program that detects and estimates the pose of ArUco markers from video input.
from imutils.video import VideoStream
import argparse
import imutils
import time
import cv2
import sys
import json
import numpy as np
@jfjensen
jfjensen / aruco_gen_page.py
Last active March 12, 2023 16:35
A program that generates an A4 page with ArUco (and April) tags
import argparse
import cv2
import sys
import numpy as np
ap = argparse.ArgumentParser()
ap.add_argument("-o", "--output", required=True, help="path to output image containing ArUCo tag")
ap.add_argument("-i", "--id", type=int, required=True, help="ID of first ArUCo tag to generate")
ap.add_argument("-t", "--type", type=str, default="DICT_ARUCO_ORIGINAL", help="type of ArUCo tag to generate")
ap.add_argument("-d", "--dpi", type=str, default="72", help="the DPI of the output print")
@jfjensen
jfjensen / remap.py
Created August 23, 2022 13:41
An example program for using the camera matrix and distortion coefficients for undistorting some images
import numpy as np
import cv2 as cv
import glob
import json
from datetime import datetime
with open('camera.json', 'r') as json_file:
camera_data = json.load(json_file)
dist = np.array(camera_data["dist"])
@jfjensen
jfjensen / calibrate.py
Last active August 23, 2022 13:36
A short program for calibrating a webcam based on some images
import numpy as np
import cv2 as cv
import glob
import json
from datetime import datetime
criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)
rows = 5
columns = 7
@jfjensen
jfjensen / takepic.py
Last active August 26, 2022 13:12
A little program for taking pictures with a webcam
import cv2
from datetime import datetime
from imutils.video import VideoStream
import time
vs = VideoStream(src=0).start()
time.sleep(2.0)
while(True):
frame = vs.read()
@jfjensen
jfjensen / product.html
Created May 27, 2022 17:23
The template for showing products
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/script.js" defer></script>
</head>
@jfjensen
jfjensen / cinatra.cpp
Last active May 27, 2022 17:20
The source code for the project
#include "./include/cinatra.hpp"
#include "./include/ginger.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <fstream>
#include <map>
#include <string>
@jfjensen
jfjensen / game.go
Last active May 25, 2022 11:51
THe complete code for the simple game
package main
import (
"fmt"
"image"
"image/draw"
"image/png"
"os"
"time"