From 29a366df4f1492a5974db87a215f1a310fc853a2 Mon Sep 17 00:00:00 2001 From: Comment Date: Sun, 28 Apr 2013 00:49:39 +0100 Subject: initial --- TRRSS_01_rec/Makefile | 2 + TRRSS_01_rec/TRRSS_01_rec.cbp | 123 +++++++++++++++++++++++++++ TRRSS_01_rec/TRRSS_01_rec.layout | 25 ++++++ TRRSS_01_rec/TRRSS_01_rec.workspace | 9 ++ TRRSS_01_rec/addons.make | 5 ++ TRRSS_01_rec/config.make | 56 ++++++++++++ TRRSS_01_rec/src/main.cpp | 19 +++++ TRRSS_01_rec/src/testApp.cpp | 164 ++++++++++++++++++++++++++++++++++++ TRRSS_01_rec/src/testApp.h | 75 +++++++++++++++++ notes | 14 +++ 10 files changed, 492 insertions(+) create mode 100755 TRRSS_01_rec/Makefile create mode 100755 TRRSS_01_rec/TRRSS_01_rec.cbp create mode 100644 TRRSS_01_rec/TRRSS_01_rec.layout create mode 100755 TRRSS_01_rec/TRRSS_01_rec.workspace create mode 100644 TRRSS_01_rec/addons.make create mode 100755 TRRSS_01_rec/config.make create mode 100755 TRRSS_01_rec/src/main.cpp create mode 100755 TRRSS_01_rec/src/testApp.cpp create mode 100755 TRRSS_01_rec/src/testApp.h create mode 100644 notes diff --git a/TRRSS_01_rec/Makefile b/TRRSS_01_rec/Makefile new file mode 100755 index 0000000..2d83a77 --- /dev/null +++ b/TRRSS_01_rec/Makefile @@ -0,0 +1,2 @@ +include config.make +include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/Makefile.examples diff --git a/TRRSS_01_rec/TRRSS_01_rec.cbp b/TRRSS_01_rec/TRRSS_01_rec.cbp new file mode 100755 index 0000000..9fd8544 --- /dev/null +++ b/TRRSS_01_rec/TRRSS_01_rec.cbp @@ -0,0 +1,123 @@ + + + + + + diff --git a/TRRSS_01_rec/TRRSS_01_rec.layout b/TRRSS_01_rec/TRRSS_01_rec.layout new file mode 100644 index 0000000..9a9709a --- /dev/null +++ b/TRRSS_01_rec/TRRSS_01_rec.layout @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TRRSS_01_rec/TRRSS_01_rec.workspace b/TRRSS_01_rec/TRRSS_01_rec.workspace new file mode 100755 index 0000000..d8488cd --- /dev/null +++ b/TRRSS_01_rec/TRRSS_01_rec.workspace @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/TRRSS_01_rec/addons.make b/TRRSS_01_rec/addons.make new file mode 100644 index 0000000..0b4df47 --- /dev/null +++ b/TRRSS_01_rec/addons.make @@ -0,0 +1,5 @@ +ofxOpenNI +ofxFenster +ofxGui +ofxXmlSettings +ofxMayaCam diff --git a/TRRSS_01_rec/config.make b/TRRSS_01_rec/config.make new file mode 100755 index 0000000..821a73a --- /dev/null +++ b/TRRSS_01_rec/config.make @@ -0,0 +1,56 @@ +# add custom variables to this file + +# OF_ROOT allows to move projects outside apps/* just set this variable to the +# absoulte path to the OF root folder + +OF_ROOT = ../../openFrameworks + + +# USER_CFLAGS allows to pass custom flags to the compiler +# for example search paths like: +# USER_CFLAGS = -I src/objects + +USER_CFLAGS = -I $(OF_ROOT)/addons/ofxOpenNI/include/openni -I $(OF_ROOT)/addons/ofxOpenNI/include/nite -I $(OF_ROOT)/addons/ofxOpenNI/src + + +# USER_LDFLAGS allows to pass custom flags to the linker +# for example libraries like: +# USER_LDFLAGS = libs/libawesomelib.a + +USER_LDFLAGS = -lOpenNI + + +EXCLUDE_FROM_SOURCE="bin,.xcodeproj,obj" + +# change this to add different compiler optimizations to your project + +USER_COMPILER_OPTIMIZATION = -march=native -mtune=native -Os + + +# android specific, in case you want to use different optimizations +USER_LIBS_ARM = +USER_LIBS_ARM7 = +USER_LIBS_NEON = + +# android optimizations + +ANDROID_COMPILER_OPTIMIZATION = -Os + +NDK_PLATFORM = android-8 + +# uncomment this for custom application name (if the folder name is different than the application name) +#APPNAME = folderName + +# uncomment this for custom package name, must be the same as the java package that contains OFActivity +#PKGNAME = cc.openframeworks.$(APPNAME) + + + + + +# linux arm flags + +LINUX_ARM7_COMPILER_OPTIMIZATIONS = -march=armv7-a -mtune=cortex-a8 -finline-functions -funroll-all-loops -O3 -funsafe-math-optimizations -mfpu=neon -ftree-vectorize -mfloat-abi=hard -mfpu=vfp + + + diff --git a/TRRSS_01_rec/src/main.cpp b/TRRSS_01_rec/src/main.cpp new file mode 100755 index 0000000..1f1c3a1 --- /dev/null +++ b/TRRSS_01_rec/src/main.cpp @@ -0,0 +1,19 @@ +#include "ofMain.h" +#include "testApp.h" +#include "ofAppGlutWindow.h" + +//======================================================================== +int main( ){ + + ofAppGlutWindow window; + ofSetupOpenGL(ofxFensterManager::get(),1024,768, OF_WINDOW); //2048,768 + //ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context + //ofSetupOpenGL(&window, 1024,768, OF_WINDOW); + + // this kicks off the running of my app + // can be OF_WINDOW or OF_FULLSCREEN + // pass in width and height too: + //ofRunApp( new testApp()); + ofRunFensterApp( new testApp()); + +} diff --git a/TRRSS_01_rec/src/testApp.cpp b/TRRSS_01_rec/src/testApp.cpp new file mode 100755 index 0000000..1c333bf --- /dev/null +++ b/TRRSS_01_rec/src/testApp.cpp @@ -0,0 +1,164 @@ +#include "testApp.h" +//texture binding with normalised coords +void bindTexture(ofBaseHasTexture &t) { + ofTexture &tex = t.getTextureReference(); + tex.bind(); + + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + + ofTextureData texData = tex.getTextureData(); + if(texData.textureTarget == GL_TEXTURE_RECTANGLE_ARB) { + glScalef(tex.getWidth(), tex.getHeight(), 1.0f); + } else { + glScalef(tex.getWidth() / texData.tex_w, tex.getHeight() / texData.tex_h, 1.0f); + } + + glMatrixMode(GL_MODELVIEW); +} +void unbindTexture(ofBaseHasTexture &t) { + t.getTextureReference().unbind(); + + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} +void bindTex(ofTexture &tex) { + tex.bind(); + + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + + ofTextureData texData = tex.getTextureData(); + if(texData.textureTarget == GL_TEXTURE_RECTANGLE_ARB) { + glScalef(tex.getWidth(), tex.getHeight(), 1.0f); + } else { + glScalef(tex.getWidth() / texData.tex_w, tex.getHeight() / texData.tex_h, 1.0f); + } + + glMatrixMode(GL_MODELVIEW); +} +void unbindTex(ofTexture &tex) { + tex.unbind(); + + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} +//-------------------------------------------------------------- +void testApp::setup(){ + recordContext.setup(); + recordDepth.setup(&recordContext); + recordImage.setup(&recordContext); + recordUser.setup(&recordContext); + recordUser.setUseCloudPoints(true); + recordContext.toggleRegisterViewport(); + + guiWin=new guiWindow(); + ofxFenster* win=ofxFensterManager::get()->createFenster(0, 0, 200, 400, OF_WINDOW); + win->setWindowTitle("config"); + win->addListener(guiWin); + guiWin->setup(); +} + +//-------------------------------------------------------------- +void testApp::update(){ + recordContext.update(); + recordDepth.update(); + recordImage.update(); + recordUser.update(); +} + +//-------------------------------------------------------------- +void testApp::draw(){ + cam.begin(); + //bind texture recordImage + //get point data from recordDepth + //draw textured polys and allow manipulation + ofPushMatrix(); + ofTranslate(320,240,-1000); + //ofRotate(0,0,1,180); + bindTex(recordImage.getTexture()); + int step = 1; + for(int y = step; y < 480; y += step) { + glBegin(GL_QUADS); + for(int x = step; x < 640; x += step) { + ofPoint pos1 = recordUser.getWorldCoordinateAt(x-step, y-step, 0); //userID); + ofPoint pos2 = recordUser.getWorldCoordinateAt(x, y-step, 0); //userID); + ofPoint pos3 = recordUser.getWorldCoordinateAt(x-step, y, 0); //userID); + ofPoint pos4 = recordUser.getWorldCoordinateAt(x, y, 0); //userID); + + if ((guiWin->distMindistMax)&& + (guiWin->distMindistMax)&& + (guiWin->distMindistMax)&& + (guiWin->distMindistMax)) { + + glTexCoord2f(((float)x-step)/640.0f,((float)y-step)/480.0f); + glVertex3f(pos1.x, -pos1.y,pos1.z); + glTexCoord2f(((float)x)/640.0f,((float)y-step)/480.0f); + glVertex3f(pos2.x, -pos2.y,pos2.z); + glTexCoord2f(((float)x)/640.0f,((float)y)/480.0f); + glVertex3f(pos4.x, -pos4.y,pos4.z); + glTexCoord2f(((float)x-step)/640.0f,((float)y)/480.0f); + glVertex3f(pos3.x, -pos3.y,pos3.z); + } + } + glEnd(); + } + ofPopMatrix(); + + unbindTex(recordImage.getTexture()); + + //recordImage.draw(0, 0, ofGetWidth(),ofGetHeight()); + + cam.end(); + + +} + +//-------------------------------------------------------------- +void testApp::keyPressed(int key){ + +} + +//-------------------------------------------------------------- +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){ + +} + +//-------------------------------------------------------------- +void testApp::mouseReleased(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void testApp::windowResized(int w, int h){ + +} + +//-------------------------------------------------------------- +void testApp::gotMessage(ofMessage msg){ + +} + +//-------------------------------------------------------------- +void testApp::dragEvent(ofDragInfo dragInfo){ + +} diff --git a/TRRSS_01_rec/src/testApp.h b/TRRSS_01_rec/src/testApp.h new file mode 100755 index 0000000..1da9c6e --- /dev/null +++ b/TRRSS_01_rec/src/testApp.h @@ -0,0 +1,75 @@ +#pragma once + +//for tomorrow: drawing interface & screengrab + +//thursday: +//2 camera calibration +//recording - whats the best format - in memeory + save at end? +//movie + pixels? + +#include "ofMain.h" +#include "ofxOpenNI.h" + +#include "ofxFensterManager.h" +#include "ofxGui.h" + +#include "ofxMayaCam.h" + +class guiWindow; + +class testApp : public ofxFensterListener{ + + 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); + void dragEvent(ofDragInfo dragInfo); + void gotMessage(ofMessage msg); + + ofxOpenNIContext recordContext; + ofxDepthGenerator recordDepth; + ofxImageGenerator recordImage; + ofxUserGenerator recordUser; + + guiWindow *guiWin; + + ofxMayaCam cam; + +}; + +class guiWindow: public ofxFensterListener{ + public: + ofxPanel gui; + ofxFloatSlider dMin; + ofxParameter distMin; + ofxFloatSlider dMax; + ofxParameter distMax; + ofxToggle dPoints; + ofxParameter drawPoints; + ofxFloatSlider pSize; + ofxParameter pointSize; + + + void setup(){ + gui.setup("","panel.xml",0,0); + distMin=400; + gui.add(dMin.setup("min distance",distMin,0,5000,255)); + distMax=2000; + gui.add(dMax.setup("max distance",distMax,0,5000,255)); + drawPoints=false; + gui.add(dPoints.setup("draw points",drawPoints)); + pointSize=2.0; + gui.add(pSize.setup("point size",pointSize,1.0,20.0,255)); + } + void draw() { gui.draw(); } + + +}; diff --git a/notes b/notes new file mode 100644 index 0000000..5cc1168 --- /dev/null +++ b/notes @@ -0,0 +1,14 @@ +i. straight on torso shot detailing the level of video detail captured by the Kinect duo. The torso should not move however the head and mouth should move as if reciting a text - think newsreader. + +ii. the above shot processed as a point cloud. Black and white only. + +iii. similar to i., straight torso shot detailing the level of video detail captured by the Kinect duo but this time with the subject in slightly more dramatic mode i.e. head movements, mouth, forward/backward movement, arms, hands moving, pointing, clutching etc. + +iiii. above shot as point data. Black and white only. + + +(interface:) + +range scale +point/ colour +point size \ No newline at end of file -- cgit v1.2.3