From c81d13d3c2d4a89d9cac3ca54cca69650ec3a52d Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 11 Mar 2014 13:15:31 +0000 Subject: sizing image library --- test-kinect/src/ofApp.h | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 test-kinect/src/ofApp.h (limited to 'test-kinect/src/ofApp.h') diff --git a/test-kinect/src/ofApp.h b/test-kinect/src/ofApp.h new file mode 100644 index 0000000..45cecdb --- /dev/null +++ b/test-kinect/src/ofApp.h @@ -0,0 +1,73 @@ +#pragma once + +#include "ofMain.h" +#include "ofxOpenCv.h" +#include "ofxKinect.h" + +#define MIN_TILE_SIZE 4 //has to be a divisor of 320 and 240 as the tiles are centred +#define MAX_TILE_SIZE 32 //has to be a power of 2 * MIN_TILE_SIZE + +#define MODE_COLOURTILES 0 +#define MODE_DEPTH 1 +#define MODE_COMPONENTS 2 + +#define NUM_MODES 3 + +#define STORE_SIZE 256 + +class offsetCvColorImage : public ofxCvColorImage { + public: + void extend( int w, int h ) { + IplImage* temp = cvCreateImage( cvSize(w,h), IPL_DEPTH_8U, 3 ); + cvCopyMakeBorder(cvImage,temp, cvPoint(0,0),IPL_BORDER_REPLICATE ); + allocate( w, h ); + cvCopy( temp, cvImage ); + cvReleaseImage( &temp ); + } +}; + +class offsetCvGrayscaleImage : public ofxCvGrayscaleImage { + public: + void extend( int w, int h ) { + IplImage* temp = cvCreateImage( cvSize(w,h), IPL_DEPTH_8U, 1 ); + cvCopyMakeBorder(cvImage,temp, cvPoint(0,0),IPL_BORDER_REPLICATE ); + allocate( w, h ); + cvCopy( temp, cvImage ); + cvReleaseImage( &temp ); + } +}; + +class ofApp : public ofBaseApp { +public: + + void setup(); + void update(); + void draw(); + void exit(); + + void keyPressed(int key); + 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 checktile(int level,int x,int y,int size); + + ofxKinect kinect; + + offsetCvColorImage colourImage; + offsetCvGrayscaleImage depthImage,depthImage2; + + vector colourTiles; + vector depthTiles; + vector > numTiles; + + int farThreshold; + int angle; + int levels; + int extend_w,extend_h; + + int mode; + + bool fullscreen; +}; -- cgit v1.2.3