From 565fad9df0e5d509939f5c3d17d550a6f3e4b7b5 Mon Sep 17 00:00:00 2001 From: Comment Date: Wed, 19 Feb 2014 16:11:19 +0000 Subject: extend border correct --- offsetProject/src/ofApp.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'offsetProject/src/ofApp.h') 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 ); } }; -- cgit v1.2.3