Skip to content

Instantly share code, notes, and snippets.

@GalNissim
GalNissim / servo_and_pot.ino
Last active September 7, 2017 03:34
How can I make a motion tracking camera
#include <Servo.h>
//motor
int servoPin = 9;
Servo servo;
int angle = 0;
int potPin = 0;
int potVal;
import org.openkinect.freenect.*;
import org.openkinect.processing.*;
Kinect2 kinect2;
PImage video, video1;
PImage rgb, secondImage;
float minThresh = 550;
class Bubble {
float startPointX, startPointY;
String fileName;
PImage bImg;
Bubble(float x, float y, String f) {
startPointX = x;
startPointY = y;
/**
* Please note that the code for interfacing with Capture devices
* will change in future releases of this library. This is just a
* filler till something more permanent becomes available.
/**
* This will display live video from a GoPro camera connected via WiFi.
* Code & detective work by Gal Nissim & Andres Colubri.
*
* More about GStreamer pipelines:
* https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/
<pre><code>
----------begin_max5_patcher----------
6469.3oc68z0aiibjOOyuBBi7vcAd80e+QdZSNbHXAtb2ArIOEDXPKQaycnD
Unn7NSBx+8qa1sjHskHK4QpUKJO.isEonTUUWeWUW8+7ye5lGJ+Z1xaR9cI+
0jO8o+4m+zmZtj8Bex+5OcyrzuNoHcYya6l4Y+Z4C+xM25t07UyJWUWjU2bS
r+ptKU+sEYtO4atI4u4u0hz5IOmO+o6qxlT6tKAqX2gtMAqTpleiP1eQH2g1
7X4Sa9xMey+.q02c97W+Uur9aEMeq2bi8B+qO+Y6Ot8cgb0YesADuYxyoyeJ
a23Lcu37sI2jOud8u5kBvI7FLmfanD7dI.Dr9DRBlksbY5VjcCM3kxhjeC9n
ttyzt0chrAeYzdwZBZmXM4jh0UYoSOp3LE4wYA19aJuebFeBw48vrOKqtp7.
w4GLxGCf2ZzcbKdyavaFte7lbBw65xmdpH6.wvAEgoJoagEIZPM15etaDjdy
/**
* Getting Started with Capture.
*
* Reading and displaying an image from an attached Capture device.
*/
import processing.video.*;
Capture cam;
//-------------------------------------------------------
// our function for getting color components , it requires that you have global variables
// R,G,B (not elegant but the simples way to go, see the example PxP methods in object for
// a more elegant solution
int R, G, B, A; // you must have these global varables to use the PxPGetPixel()
void PxPGetPixel(int x, int y, int[] pixelArray, int pixelsWidth) {
int thisPixel=pixelArray[x+y*pixelsWidth]; // getting the colors as an int from the pixels[]
A = (thisPixel >> 24) & 0xFF; // we need to shift and mask to get each component alone
R = (thisPixel >> 16) & 0xFF; // this is faster than calling red(), green() , blue()
G = (thisPixel >> 8) & 0xFF;
/** //<>// //<>// //<>// //<>// //<>//
* Please note that the code for interfacing with Capture devices
* will change in future releases of this library. This is just a
* filler till something more permanent becomes available.
/**
* This will display live video from a GoPro Hero4 camera connected via WiFi.
* Code & detective work by Gal Nissim & Andres Colubri.
*
* More about GStreamer pipelines:
* https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/
import socket
import sys
from time import sleep
def get_command_msg(id):
return "_GPHD_:%u:%u:%d:%1lf\n" % (0, 0, 2, 0)
UDP_IP = "10.5.5.9"
UDP_PORT = 8554
KEEP_ALIVE_PERIOD = 2500
@GalNissim
GalNissim / Bubble Face
Last active April 11, 2016 17:40
Face bubbles - Pixel by Pixel
import gab.opencv.*; //<>//
import processing.video.*;
import java.awt.*;
Capture cam;
OpenCV opencv;
int R, G, B, A;
Bubble[] bubbles = new Bubble[0];