Skip to content

Instantly share code, notes, and snippets.

@genekogan
genekogan / ofApp.cpp
Created May 14, 2015 00:19
code examples from SFPC 5.13
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
kinect.setup();
kinect.addDepthGenerator();
kinect.setDepthColoring(COLORING_GREY);
kinect.start();
grayImage.allocate(kinect.getWidth(), kinect.getHeight());
@genekogan
genekogan / CvUtils.h
Last active October 11, 2015 00:23
OCR on browser screengrab in openframeworks, ofxTesseract + ofxScreebGrab
#pragma once
// small excerpt from forthcoming of-cv utility/addon
#include "ofConstants.h"
#include "ofImage.h"
#include "cv.h"
namespace cv {
@genekogan
genekogan / genesis
Last active August 29, 2015 14:25
auto-summarization of the book of genesis
automatically summarized the Book of Genesis using Sumy.
code: https://github.com/genekogan/text-learning
sumy: https://github.com/miso-belica/sumy
text: http://monolith.sourceforge.net/genesis.txt
-----------------------------------
4:25 And Adam knew his wife again; and she bare a son, and called his name Seth: For God, said she, hath appointed me another seed instead of Abel, whom Cain slew.
5:28 And Lamech lived an hundred eighty and two years, and begat a son: 5:29 And he called his name Noah, saying, This same shall comfort us concerning our work and toil of our hands, because of the ground which the LORD hath cursed.
10:15 And Canaan begat Sidon his first born, and Heth, 10:16 And the Jebusite, and the Amorite, and the Girgasite, 10:17 And the Hivite, and the Arkite, and the Sinite, 10:18 And the Arvadite, and the Zemarite, and the Hamathite: and afterward were the families of the Canaanites spread abroad.
14:5 And in the fourteenth year came Chedorlaomer, and the kings that were with him, and smote t
@genekogan
genekogan / president-biographies.md
Last active September 15, 2015 04:38
automatic 1-sentence summary of each u.s. president's wikipedia

1-sentence biography of every U.S. president, auto-summarized from Wikipedia using Sumy.

Barack Obama

In February and March 2009, Vice President Joe Biden and Secretary of State Hillary Rodham Clinton made separate overseas trips to announce a "new era" in U.S. foreign relations with Russia and Europe, using the terms "break" and " reset " to signal major changes from the policies of the preceding administration.

George W. Bush

@genekogan
genekogan / _Instructions.md
Last active March 5, 2021 13:10
instructions for generating a style transfer animation from a video

Instructions for making a Neural-Style movie

The following instructions are for creating your own animations using the style transfer technique described by Gatys, Ecker, and Bethge, and implemented by Justin Johnson. To see an example of such an animation, see this video of Alice in Wonderland re-styled by 17 paintings.

Setting up the environment

The easiest way to set up the environment is to simply load Samim's a pre-built Terminal.com snap or use another cloud service like Amazon EC2. Unfortunately the g2.2xlarge GPU instances cost $0.99 per hour, and depending on parameters selected, it may take 10-15 minutes to produce a 512px-wide image, so it can cost $2-3 to generate 1 sec of video at 12fps.

If you do load the

@genekogan
genekogan / SuperDuper.pde
Created April 18, 2016 15:19
hemesh superduper
import wblut.math.*;
import wblut.processing.*;
import wblut.core.*;
import wblut.hemesh.*;
import wblut.geom.*;
HE_Mesh mesh;
WB_Render render;
float m1, n11, n12, n13, m2, n21, n22, n23, t1, t2, d1, d2, c1, c2, c3;
import processing.video.*;
Movie movie1, movie2;
int blendAlpha;
int typeBlend;
import oscP5.*;
import netP5.*;
OscP5 oscP5;
// you need to put the glsl files into the sketch's data folder
String[] shaders = new String[] {
"vert1.glsl", "vert2.glsl", "wrap.glsl" };
PGraphics pg;
PImage img;
PShader myShader;
int idx, nextIdx;
boolean isImage = true;
@genekogan
genekogan / main.cpp
Last active February 13, 2017 23:35
comparing kd-Tree and cover tree performance
#include "ofMain.h"
#include "ofxCoverTree.h"
#include "ofxKDTree.h"
float squaredDistance(vector<double> & v1, vector<double> & v2) {
float dist=0;
for (int i=0; i<v1.size(); i++) {
float d = v2[i]-v1[i];
dist += (d*d);
}
@genekogan
genekogan / wekinator_basic.pde
Created February 18, 2017 16:23
wekinator + processing + sound
import netP5.*;
import oscP5.*;
import processing.sound.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
SoundFile s1, s2, s3, s4;
boolean sending;
float prediction;