diff options
Diffstat (limited to 'offsetProject')
| -rw-r--r-- | offsetProject/src/ofApp.cpp | 21 | ||||
| -rw-r--r-- | offsetProject/src/ofApp.h | 16 |
2 files changed, 30 insertions, 7 deletions
diff --git a/offsetProject/src/ofApp.cpp b/offsetProject/src/ofApp.cpp index 3399aca..28b44e8 100644 --- a/offsetProject/src/ofApp.cpp +++ b/offsetProject/src/ofApp.cpp @@ -48,8 +48,8 @@ void ofApp::setup() { //b extend captured frame to this ratio //c mip map this down into prepared containers - int tiles_w=ceil(kinect.width/(MAX_TILE_SIZE*2))*2; - int tiles_h=ceil(kinect.height/(MAX_TILE_SIZE*2))*2; + int tiles_w=ceil((float)kinect.width/(MAX_TILE_SIZE*2))*2; + int tiles_h=ceil((float)kinect.height/(MAX_TILE_SIZE*2))*2; extend_w=(tiles_w)*MAX_TILE_SIZE; extend_h=(tiles_h)*MAX_TILE_SIZE; @@ -65,7 +65,7 @@ void ofApp::setup() { for (int i=MIN_TILE_SIZE,l=0;i<=MAX_TILE_SIZE;i*=2,l++) { colourTiles[l].allocate(extend_w/i,extend_h/i); depthTiles[l].allocate(extend_w/i,extend_h/i); - cerr<<"level "<<levels<<" mipmap: "<<colourTiles[l].getWidth()<<"x"<<colourTiles[l].getHeight()<<endl; + cerr<<"level "<<l<<" mipmap: "<<colourTiles[l].getWidth()<<"x"<<colourTiles[l].getHeight()<<endl; } } @@ -111,6 +111,19 @@ void ofApp::update() { void ofApp::draw() { ofSetColor(255, 255, 255); + + depthImage.draw(10, 10, 640, 480); + colourImage.draw(10, 500, 640, 480); + + int xoffs=660; + for (int i=0;i<depthTiles.size();i++){ + depthTiles[i].draw(xoffs,10,depthTiles[i].getWidth(),depthTiles[i].getHeight()); + colourTiles[i].draw(xoffs,500,colourTiles[i].getWidth(),colourTiles[i].getHeight()); + xoffs+=(colourTiles[i].getWidth()+10); + } + + + /* // draw from the live kinect kinect.drawDepth(10, 10, 400, 300); @@ -134,6 +147,8 @@ void ofApp::draw() { } ofDrawBitmapString(reportStream.str(), 20, 652); + + */ } diff --git a/offsetProject/src/ofApp.h b/offsetProject/src/ofApp.h index ce00cc8..81f5895 100644 --- a/offsetProject/src/ofApp.h +++ b/offsetProject/src/ofApp.h @@ -4,20 +4,28 @@ #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 MIN_TILE_SIZE 8 //has to be a divisor of 320 and 240 as the tiles are centred +#define MAX_TILE_SIZE 64 //has to be a power of 2 * MIN_TILE_SIZE class offsetCvColorImage : public ofxCvColorImage { public: void extend( int w, int h ) { - //cv::copyMakeBorder(cvImage,cvImage,(h-getHeight())/2,(h-getHeight())/2,(w-getWidth())/2,(w-getWidth())/2,cv::BORDER_REPLICATE); + 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 ) { - //cv::copyMakeBorder(cvImage,cvImage,(h-getHeight())/2,(h-getHeight())/2,(w-getWidth())/2,(w-getWidth())/2,cv::BORDER_REPLICATE); + 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 ); } }; |
