changeset 16:610d6d90b627

Merging Becky's of files
author Tim MB <tim.murraybrowne@eecs.qmul.ac.uk>
date Thu, 17 Feb 2011 16:59:15 +0000
parents 8c7ed13ddd4d (current diff) 972eb5fdb79b (diff)
children 78bf0b15093d 58fc7c2154cf
files
diffstat 4 files changed, 239 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/README	Thu Feb 17 16:57:53 2011 +0000
+++ b/README	Thu Feb 17 16:59:15 2011 +0000
@@ -1,1 +1,65 @@
-Test file for initial repository.
\ No newline at end of file
+
+--------------------------------------------------------------------
+Install instructions for OpenNI
+--------------------------------------------------------------------
+
+Install notes:
+	1) Install unstable OpenNI (http://www.openni.org/downloadfiles/openni-binaries/20-latest-unstable)
+	   On Linux/Mac please do: ./sudo install.sh
+	2) Install Sensor (this version...)
+	   On Linux/Mac please do: ./sudo install.sh
+	3) Install unstable NITE (http://www.openni.org/downloadfiles/openni-compliant-middleware-binaries/33-latest-unstable)
+	   On Linux/Mac please do: ./sudo install.sh
+	   Use this license when asked during the installation: 0KOIk2JeIBYClPWVnMoRKn5cdY4=
+	4) Test #1: Run the NiViewer sample to make sure depth & image streams are working.
+	5) Test #2: Run the OpenNI/NiUserTracker sample play with the skeleton. Don't forget to start with the calibration pose! (Explained in the PDFs)
+	6) Test #3: Try the NITE/Sample-PointViewer sample for the hand tracking demo.
+
+	For Mac/Linux, you will need to install the latest LibUSB.
+	Linux:
+		1) Run: sudo apt-get install libusb-1.0-0-dev
+		2) Run: sudo apt-get install freeglut3-dev
+	MaxOSX:
+		1) Intall MacPorts from: http://distfiles.macports.org/MacPorts/MacPorts-1.9.2-10.6-SnowLeopard.dmg
+		2) Run: sudo port install libtool
+		3) Run: sudo port install libusb-devel +universal
+		   Note: Do not forget the +universal, it's very important!!
+		   If you're previously already installed libusb-devel then use "sudo port uninstall libusb-devel" and reinstall it again with the +universal flag.
+		
+		
+		Nutshell Mac OpenNi/Kinect install for DUMMIES: 
+		This job is going to take ONE DAY. It will be SLOW. Your computer is 
+		going to run a long time. 
+		You need to be running OS X 10.6, Xcode installed, there may be some 
+		recent-hardware constraint. 
+		You will install Git, Mac Ports libtool, libusb-devel, OpenNi, 
+		SensorKinect, and Nite in that order. 
+
+		- Install Git from http://git-scm.com/, use it to download 
+		SensorKinect from github: 
+		- run "git clone git://github.com/avin2/SensorKinect.git" 
+		- Get and *read* the README in SensorKinect. Keep that README open, it 
+		explains what is happening here. 
+		- Do a clean install of Mac Ports. Uninstall an existing Macports 
+		first. 
+		- run "sudo port install libtool +universal" 
+		- run "sudo port install libusb-devel +universal" 
+		- download OpenNi unstable:  http://www.openni.org/downloadfiles/openni-binaries/20-latest-unstable 
+		- run as sudo the OpenNi unstable binaries install.sh script 
+		- run as sudo the SensorKinect install.sh script 
+		- download Nite unstable: 
+		http://www.openni.org/downloadfiles/openni-compliant-middleware-binar... 
+		- edit the three Nite DATA XML files to 640x480 
+		- run as sudo the Nite install.sh script. License key is 
+		"0KOIk2JeIBYClPWVnMoRKn5cdY4=" 
+
+		Bravo! You should be done installing! As a reward, you now get to 
+		test: 
+		- go to the Nite tree, and in Samples/bin you have a bunch of binaries 
+		that just got built. 
+		- plug in the Kinect power supply, then the USB plug of the Kinect 
+		bar. Run the Box sample.
+		
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/of/main.cpp	Thu Feb 17 16:59:15 2011 +0000
@@ -0,0 +1,16 @@
+#include "ofMain.h"
+#include "testApp.h"
+#include "ofAppGlutWindow.h"
+
+//========================================================================
+int main( ){
+
+    ofAppGlutWindow window;
+	ofSetupOpenGL(&window, 1024,768, OF_WINDOW);			// <-------- setup the GL context
+
+	// this kicks off the running of my app
+	// can be OF_WINDOW or OF_FULLSCREEN
+	// pass in width and height too:
+	ofRunApp( new testApp());
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/of/testApp.cpp	Thu Feb 17 16:59:15 2011 +0000
@@ -0,0 +1,126 @@
+#include "testApp.h"
+
+//--------------------------------------------------------------
+void testApp::setup(){
+	drawIt=false;
+	// load the default ofxOpenNI config settings
+	// see bin/data/openni/config/ofxopenni_config.xml
+	context.setupUsingXMLFile();
+	
+	// uncomment this to see what open ni is doing inside
+	//context.enableLogging(OF_LOG_VERBOSE);
+	
+	// setup resources
+	depth.setup(&context);
+	image.setup(&context);
+	user.setup(&context, &depth);
+//	Davy.loadImage("images/davy.jpg");
+   ofEnableSmoothing();
+   ofSetBackgroundAuto(false);
+   	ofBackground(238,238,224);
+   	ofEnableAlphaBlending();
+   	ofSetLineWidth(12);
+}
+
+//--------------------------------------------------------------
+void testApp::update(){
+	
+	
+	// update the open ni context and user tracker
+	context.update();
+	user.update();
+}
+
+//--------------------------------------------------------------
+void testApp::draw(){
+	
+	// draw depth and rgb images
+	//depth.draw();
+if (drawIt != true)	{
+image.draw();
+user.draw();	
+}
+	// draw all the users automatically?
+
+	
+	
+	stringstream info;
+	info << "number of tracked users: " << user.getNumTrackedUsers() << endl;
+	
+	// draw the neck positions of each user
+	for(int i = 0; i < user.getNumTrackedUsers(); ++i) {
+		ofxTrackedUser* tracked = user.getTrackedUser(i);
+		if(tracked != NULL) {
+			info << i << " neck pos: "
+				 << tracked->left_lower_arm.end.x << " " 
+				 << tracked->left_lower_arm.end.y << " "
+				 << tracked->neck.begin.z << endl; 
+if (tracked->neck.begin.x != 0)
+
+ofSetColor(139,0,0,100);
+	ofNoFill();
+	float w = ofGetWidth();
+	float h = ofGetHeight();
+ofBezier(tracked->neck.begin.x,tracked->neck.begin.y,tracked->neck.end.x,tracked->neck.end.y,tracked->left_lower_arm.begin.x,tracked->left_lower_arm.begin.y,tracked->left_lower_arm.end.x,/*tracked->left_lower_arm.end.y*/ w);
+ofBezier(tracked->neck.begin.x,tracked->neck.begin.y,tracked->neck.end.x,tracked->neck.end.y,tracked->right_lower_arm.begin.x,tracked->right_lower_arm.begin.y,tracked->right_lower_arm.end.x,/*tracked->right_lower_arm.end.y*/ w);
+ofBezier(tracked->neck.begin.x,tracked->neck.begin.y,tracked->neck.end.x,tracked->neck.end.y,tracked->left_lower_leg.begin.x,tracked->left_lower_leg.begin.y,tracked->left_lower_leg.end.x,/*tracked->left_lower_leg.end.y*/ h);
+ofBezier(tracked->neck.begin.x,tracked->neck.begin.y,tracked->neck.end.x,tracked->neck.end.y,tracked->right_lower_leg.begin.x,tracked->right_lower_leg.begin.y,tracked->right_lower_leg.end.x,/*tracked->right_lower_leg.end.y*/ h);
+ofFill();
+ofSetColor(255,255,100);
+	ofCircle(tracked->neck.begin.x,tracked->neck.begin.y,30);
+ofSetColor(0);
+ofCircle(tracked->neck.begin.x,tracked->neck.begin.y,35);
+ofSetColor(255,255,100);
+	ofCircle(tracked->neck.begin.x,tracked->neck.begin.y,30);
+	ofSetColor(0);
+ofCircle(tracked->neck.begin.x+10.0f,tracked->neck.begin.y,6);
+ofCircle(tracked->neck.begin.x-10.0f,tracked->neck.begin.y,6);
+		}
+	}
+	ofFill();
+	ofSetColor(238,238,224,20);
+	ofRect(0,0,ofGetWidth(),ofGetHeight());
+	ofDrawBitmapString(info.str(), 10, 500);
+}
+
+//--------------------------------------------------------------
+void testApp::keyPressed(int key){
+	ofSetColor(238,238,224);
+	ofRect(0,0,ofGetWidth(),ofGetHeight());
+drawIt =!drawIt;
+  ofToggleFullscreen();
+}
+
+//--------------------------------------------------------------
+void testApp::keyReleased(int key){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseMoved(int x, int y ){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseDragged(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mousePressed(int x, int y, int button){
+	ofSetColor(238,238,224);
+	ofFill();
+	ofRect(0,0,ofGetWidth(),ofGetHeight());
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseReleased(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::windowResized(int w, int h){
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/of/testApp.h	Thu Feb 17 16:59:15 2011 +0000
@@ -0,0 +1,32 @@
+#ifndef _TEST_APP
+#define _TEST_APP
+
+// uncomment this for OF 007 compatibility
+//#define OFX_OPENNI_BETA
+
+#include "ofMain.h"
+#include "ofxOpenNI.h"
+
+class testApp : public ofBaseApp{
+
+	public:
+		void setup();
+		void update();
+		void draw();
+
+		void keyPressed  (int key);
+		void keyReleased(int key);
+		void mouseMoved(int x, int y );
+		void mouseDragged(int x, int y, int button);
+		void mousePressed(int x, int y, int button);
+		void mouseReleased(int x, int y, int button);
+		void windowResized(int w, int h);
+		ofxOpenNIContext context;
+		ofxDepthGenerator depth;
+		ofxUserGenerator user;
+		ofxImageGenerator image;
+		//ofImage Davy;
+		bool drawIt;
+};
+
+#endif