This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import shutil,os,cv2,sys,glob | |
from tqdm import tqdm | |
from PIL import Image | |
from pathlib import Path | |
from joblib import Parallel, delayed | |
crop_width = 200 | |
crop_height = 100 | |
output_scale = .33 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector, json | |
def get_column_names(db_name, table_name): | |
query = f"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '{db_name}' AND TABLE_NAME = '{table_name}'" | |
cursor.execute(query) | |
return [row["COLUMN_NAME"] for row in cursor] | |
db_name = 'your_db' | |
db_user = 'root' | |
db_pass = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZoomWindow win1, win2; | |
void setup() { | |
size(100, 100); | |
win1 = new ZoomWindow(dataPath("saenredam.jpg"), 0, 0, displayWidth/2, displayHeight); | |
win2 = new ZoomWindow(dataPath("zadelstraat.jpg"), displayWidth/2, 0, displayWidth/2, displayHeight); | |
} | |
void draw() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PShader shader; | |
PImage colormap, normalmap; | |
PShape shape; | |
void setup() { | |
size(1169, 1169, P3D); | |
shader = loadShader("frag-shader.glsl", "vert-shader.glsl"); | |
colormap = loadImage("colormaps/mercury.jpg"); | |
normalmap = loadImage("normalmaps/mercury.jpg"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PShader shader; | |
PImage colormap, heightmap, palette; | |
PShape shape; | |
void setup() { | |
size(1169, 1169, P3D); | |
shader = loadShader("watermars.glsl"); | |
colormap = loadImage("mars-2k-noaa.jpg"); | |
heightmap = loadImage("mars-4k-bump.png"); | |
palette = loadImage("water.png"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install scikit-learn | |
import numpy as np | |
from sklearn import metrics | |
from sklearn.cluster import DBSCAN | |
import matplotlib.pyplot as plt | |
from sklearn.datasets import make_blobs | |
from sklearn.preprocessing import StandardScaler | |
centers = [[1, 1], [-1, -1], [1, -1], [-1,1]] #* (640,480) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
from Tracker import Tracker | |
from TouchEvents import TouchEvents | |
from pythonosc import udp_client as osc | |
from scipy.signal import convolve2d | |
w,h=640,480 | |
mouseX, mouseY = 0,0 | |
exposure=-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
w,h = 640,480 | |
cam = cv2.VideoCapture(0) | |
cam.set(cv2.CAP_PROP_EXPOSURE,-6) | |
cv2.namedWindow("src") | |
cv2.namedWindow("dst", cv2.WINDOW_NORMAL) | |
cv2.moveWindow("dst",w,0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import py5 | |
class Quad: | |
def __init__(self, s): | |
self.p = list(map(int, s.split(" "))) | |
def load_quads(filename): | |
return [Quad(s) for s in py5.load_strings(filename)] | |
def draw_quads(xy_quads, uv_quads, tex): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PImage cam, screen; | |
ArrayList<Quad> cam_quads, screen_quads; | |
void setup() { | |
size(1280, 480, P3D); | |
cam = loadImage("vis_200.png"); | |
cam_quads = load_quads("cam_quads.txt"); | |
screen_quads = load_quads("screen_quads.txt"); | |
} |