#include "ofApp.h" /* so far so good, NOW threading parse response and identify new pictures save pictures & metadata - rather than reloading each time? local images format do we need any metadata? I guess not other than to know the tag id could save with the tag id as the name of file, simpler how exactly do we parse or mipmap the images do we worry about memory - I guess not identify the images image save- reload system (? even necessary ?) camera + button transitions should the loader own the images? should the whole image bank be locked while loading? alternatively each image could have a lock? - threadedImage or true mip map via drawsubsection? start with a max size say 64 - should be 16k inc mip maps graphics card has 2048MB 9% in use by ubuntu 117964 textures I wonder is this faster with shared memory.. load app get list of images in defined folder load them and create mip maps store indexed by file stub start thread when a new image comes in load and create mip maps how to store pictures threaded loader works away in the background when a new picture comes in a data structure which is part of the threaded object each image contains a mutex to enable the threaded object to be accessed the instagram id is just used to match against incoming - there needs to be the pattern matching algorithm how to draw pictures need to search the db for pictures of a certain colour */ //-------------------------------------------------------------- void ofApp::setup() { ofSetLogLevel(OF_LOG_WARNING); ofSetFrameRate(60); kinect.setRegistration(true); kinect.init(); kinect.open(); colourImage.allocate(kinect.width, kinect.height); depthImage.allocate(kinect.width, kinect.height); farThreshold = 70; angle = 0; kinect.setCameraTiltAngle(angle); kinect.enableDepthNearValueWhite(true); kinect.setDepthClipping(0,4000); store.start(); mode=MODE_COLOURTILES; fullscreen=false; } //-------------------------------------------------------------- void ofApp::update() { ofSetWindowTitle(ofToString(ofGetFrameRate())); kinect.update(); // there is a new frame and we are connected if(kinect.isFrameNew()) { depthImage.setFromPixels(kinect.getDepthPixels(), kinect.width, kinect.height); colourImage.setFromPixels(kinect.getPixels(), kinect.width, kinect.height); depthImage.threshold(farThreshold); //threshold needs to be multiplied by the original depthImage2.setFromPixels(kinect.getDepthPixels(), kinect.width, kinect.height); depthImage*=depthImage2; //depthImage.extend(extend_w,extend_h); //colourImage.extend(extend_w,extend_h); int h=ceil(ofGetHeight()/MAX_TILE_SIZE); int w=(h*4)/3; depthImage.resize(w,h); colourImage.resize(w,h); // mark pixels and texture dirty depthImage.flagImageChanged(); colourImage.flagImageChanged(); /* ofxCvColorImage *prevCol=&colourImage; ofxCvGrayscaleImage *prevDepth=&depthImage; for (int i=0;i': case '.': farThreshold ++; if (farThreshold > 255) farThreshold = 255; break; case '<': case ',': farThreshold --; if (farThreshold < 0) farThreshold = 0; break; case 'w': kinect.enableDepthNearValueWhite(!kinect.isDepthNearValueWhite()); break; case 'o': kinect.setCameraTiltAngle(angle); // go back to prev tilt kinect.open(); break; case 'c': kinect.setCameraTiltAngle(0); // zero the tilt kinect.close(); break; case '1': kinect.setLed(ofxKinect::LED_GREEN); break; case '2': kinect.setLed(ofxKinect::LED_YELLOW); break; case '3': kinect.setLed(ofxKinect::LED_RED); break; case '4': kinect.setLed(ofxKinect::LED_BLINK_GREEN); break; case '5': kinect.setLed(ofxKinect::LED_BLINK_YELLOW_RED); break; case '0': kinect.setLed(ofxKinect::LED_OFF); break; case OF_KEY_UP: angle++; if(angle>30) angle=30; kinect.setCameraTiltAngle(angle); break; case OF_KEY_DOWN: angle--; if(angle<-30) angle=-30; kinect.setCameraTiltAngle(angle); break; case OF_KEY_LEFT: mode--; if (mode<0) mode=NUM_MODES-1; break; case OF_KEY_RIGHT: mode=(mode+1)%NUM_MODES; break; case ' ': fullscreen=!fullscreen; ofSetFullscreen(fullscreen); break; } } //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button) {} //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button) {} //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button) {} //-------------------------------------------------------------- void ofApp::windowResized(int w, int h) {}