Permalink
Browse files

added calibrate projector (records, but doesn't perform corralte yet)…

…. requires updated ofxCvGUI, updated ofxOpenNI
  • Loading branch information...
1 parent 165744c commit 1635089e164dc4e05516282e796fa19738f06762 @elliotwoods committed Oct 15, 2011
@@ -1,67 +0,0 @@
-//
-// KinectViewNode.cpp
-// ofxKinect-test
-//
-// Created by Elliot Woods on 13/10/2011.
-// Copyright 2011 Kimchi and Chips.
-//
-// Distrubuted under the MIT license
-// http://www.opensource.org/licenses/mit-license.php
-
-#include "KinectViewNode.h"
-
-KinectViewNode::KinectViewNode(ofxKinect& k) :
-kinect(k) {
- glGenBuffersARB(1, &vbo[0]);
- glGenBuffersARB(1, &vbo[1]);
-
- nPoints = kinect.width * kinect.height;
- xyz.allocate(kinect.width, kinect.height, OF_PIXELS_RGB);
- rgb.allocate(kinect.width, kinect.height, OF_PIXELS_RGB);
-}
-
-//-----
-
-void KinectViewNode::update() {
- ofVec3f* currentXYZ = (ofVec3f*) xyz.getPixels();
- ofColor* currentRGB = (ofColor*) rgb.getPixels();
-
- for (int j=0; j<kinect.height; ++j)
- for (int i=0; i<kinect.width; ++i) {
- *currentXYZ = kinect.getWorldCoordinateFor(i, j);
- *currentRGB = kinect.getCalibratedColorAt(i, j);
-
- ++currentXYZ;
- ++currentRGB;
- }
-}
-
-//-----
-
-void KinectViewNode::customDraw() {
-
- update();
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo[0]);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, nPoints * 3 * sizeof(float), xyz.getPixels(), GL_STATIC_DRAW_ARB);
- glVertexPointer(3, GL_FLOAT, 0, 0);
-
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo[1]);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, nPoints * 4 * sizeof(unsigned char), rgb.getPixels(), GL_STATIC_DRAW_ARB);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
-
-
- ofPushMatrix();
- ofScale(-400.0f, -400.0f, -400.0f);
- glDrawArrays(GL_POINTS, 0, nPoints);
- ofPopMatrix();
-
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
-
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
-}
@@ -1,34 +0,0 @@
-//
-// KinectViewNode.h
-// ofxKinect-test
-//
-// Created by Elliot Woods on 13/10/2011.
-// Copyright 2011 Kimchi and Chips.
-//
-// Distrubuted under the MIT license
-// http://www.opensource.org/licenses/mit-license.php
-
-#pragma once
-
-#include "ofMain.h"
-#include "ofxKinect.h"
-
-/** 3D node view of Kinect data.
- We presume that kinect.update() is already being called.
- */
-class KinectViewNode : public ofNode {
-public:
- KinectViewNode(ofxKinect& k);
-
-protected:
- void update();
- void customDraw();
-
- ofxKinect& kinect;
-
- ofFloatPixels xyz;
- ofPixels rgb;
-
- GLuint vbo[2];
- GLuint nPoints;
-};
@@ -0,0 +1,22 @@
+#A. OpenNI-test
+
+Test to view data from the kinect, and generate a point cloud using ofxOpenNI2 and ofxCVgui.
+
+## ofxOpenNI2
+
+Arturo is hosting his own ofxOpenNI version on github at
+https://github.com/arturoc/ofxOpenNI2.git
+
+We'll be using that version here
+
+## Setting up OpenNI with kinect
+
+There's plenty of identical sets of instructions for this on the internet.
+
+Check http://kinecthesis.bakedmac.com/2011/01/11/installing-openni-kinect-drivers-and-nite-on-mac-os-x-10-6/ for 1 set
+
+Note that OpenNI binaries for all platforms are available at
+
+http://www.openni.org/Downloads/OpenNIModules.aspx
+
+i.e. NOT the URL given in those instructions.

Large diffs are not rendered by default.

Oops, something went wrong.
File renamed without changes.
@@ -4,36 +4,28 @@ testApp::testApp() :
kinectView(kinect),
scrPreviewDepth("Depth", kinect.getDepthTextureReference()),
-scrPreviewRGB("RGB", kinect.getTextureReference()),
-scr3D("3D", kinectView),
-wdgTilt("Kinect tilt", tilt, -30, 30)
+scrPreviewRGB("RGB", kinect.getRGBTextureReference()),
+scr3D("3D", kinectView)
{
scrMain.push(scrPreviewDepth);
scrMain.push(scrPreviewRGB);
scrMain.push(scrControl);
scrMain.push(scr3D);
-
- scrControl.push(wdgTilt);
}
//--------------------------------------------------------------
void testApp::setup(){
screens.init(scrMain);
ofBackground(117/2,130/2,160/2);
- kinect.init();
- kinect.open();
-
- tilt = kinect.getTargetCameraTiltAngle();
+ kinect.setupFromXML("openni/config/ofxopenni_config.xml",false);
+ kinect.enableCalibratedRGBDepth();
}
//--------------------------------------------------------------
void testApp::update(){
kinect.update();
-
- if (wdgTilt.isValueNew())
- kinect.setCameraTiltAngle(tilt);
}
//--------------------------------------------------------------
@@ -3,9 +3,9 @@
#include "ofMain.h"
#include "ofxCVgui.h"
-#include "ofxKinect.h"
+#include "ofxOpenNI.h"
-#include "KinectViewNode.h"
+#include "OpenNI2ViewNode.h"
class testApp : public ofBaseApp{
@@ -32,13 +32,11 @@ class testApp : public ofBaseApp{
// Device
//////////////////
//
- ofxKinect kinect;
-
- float tilt;
+ ofxOpenNI kinect;
//
//////////////////
- KinectViewNode kinectView;
+ OpenNI2ViewNode kinectView;
//////////////////
@@ -52,8 +50,6 @@ class testApp : public ofBaseApp{
scrDraw2D scrPreviewRGB;
scrWidgets scrControl;
scrDraw3D scr3D;
-
- wdgSlider wdgTilt;
//
//////////////////
};
Oops, something went wrong.

0 comments on commit 1635089

Please sign in to comment.