Skip to content

Instantly share code, notes, and snippets.

Rick Companje companje

Block or report user

Report or block companje

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@companje
companje / beeldbank-redirect.php
Last active Dec 16, 2019
beeldbank-redirect.php
View beeldbank-redirect.php
usage: ?guid=E3951481AF0A54C18999B79BE2449EC1 of via .htaccess
<?php
$apiKey = "b29fb3e4-5302-11e6-8975-2b551e9b96f4";
$guid = strtolower($_GET["guid"]);
if (strlen($guid)!=32) die("404");
$a = substr($guid,0,8);
$b = substr($guid,8,4);
$c = substr($guid,12,4);
$d = substr($guid,16,4);
@companje
companje / Wordwrap.cpp
Created Dec 9, 2019
Wordwrap, ofxWordwrap
View Wordwrap.cpp
string ofxWordWrap(string input, int maxWidth, ofTrueTypeFont *font) {
vector<string> lines = ofSplitString(input,"\n");
for (int l=0; l<lines.size(); l++) {
vector<string> words = ofSplitString(lines[l]," ");
int strWidth=0;
for (int w=0; w<words.size(); w++) {
int nextWidth = font ? font->stringWidth(words[w]+"i") : words[w].length()+1;
if (strWidth+nextWidth < maxWidth) {
strWidth+=nextWidth;
@companje
companje / getBounds.pde
Created Dec 2, 2019
getBounds from points
View getBounds.pde
Rectangle getBounds(ArrayList<PVector> vv) {
if (vv.size()==0) return new Rectangle();
float xMin = Float.POSITIVE_INFINITY;
float yMin = Float.POSITIVE_INFINITY;
float xMax = Float.NEGATIVE_INFINITY;
float yMax = Float.NEGATIVE_INFINITY;
for (int i=1; i<vv.size(); i++) {
xMin = min(xMin,vv.get(i).x);
yMin = min(yMin,vv.get(i).y);
xMax = max(xMax,vv.get(i).x);
@companje
companje / edges.pde
Last active Nov 26, 2019
Finger Tracking based on Edge Finding
View edges.pde
import processing.video.*;
import gab.opencv.*;
OpenCV opencv;
PImage src, canny, scharr, sobel;
Capture cam;
void setup() {
//src = loadImage("1021.png");
size(640, 480);
@companje
companje / Distributed-points-dome.pde
Last active Nov 23, 2019
Distributed points on Dome / Sphere
View Distributed-points-dome.pde
import org.processing.wiki.triangulate.*;
PShape dome;
float w=1200, h=1200, wd2=w/2, hd2=h/2, wdh=w/h, cx=wd2, cy=hd2, r=hd2, d=h;
float distToCam = 1200; //1040; //fisheye=1900, mirror=1040;
float globeScaler = 1.02;
ArrayList<PVector> points;
ArrayList<Triangle> triangles;
void settings() {
@companje
companje / tip-draw-ellipse-instead-spheres-as-marker.pde
Last active Nov 23, 2019
Tip: distortion when drawing markers on a sphere
View tip-draw-ellipse-instead-spheres-as-marker.pde
/*
When you want to draw markers on a sphere keep in mind that 3D markers (like spheres and boxes) are distorted because you see their top as well as their sides instead of just their top.
*/
perspective(atan(r/distToCam)*2, wdh, distToCam, 10000); //fov=35deg //atan(hd2/distToCam)*2
camera(0, 0, -distToCam, 0, 0, 0, 0, 1, 0);
scale(-1, 1, 1);
background(0);
@companje
companje / TwoCams.pde
Created Nov 23, 2019
Two cams / cameras
View TwoCams.pde
import processing.video.*;
Capture cam1, cam2;
void setup() {
size(1280, 480);
//printArray(Capture.list());
cam1 = new Capture(this, "name=HD Pro Webcam C920,size=640x480,fps=30");
//cam2 = new Capture(this, "name=BRIO 4K Stream Edition,size=640x480,fps=30");
cam2 = new Capture(this, "name=Logitech Webcam C930e,size=640x480,fps=30");
cam1.start();
@companje
companje / countries.txt
Created Nov 6, 2019
countries with data
View countries.txt
AGCS
AGI
Allianz RE
Australia
AZP
Belgium
Brazil
Bulgaria
China
Czech Republic
You can’t perform that action at this time.