diff options
| author | Comment <tim@gray.(none)> | 2014-02-19 16:11:19 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2014-02-19 16:11:19 +0000 |
| commit | 565fad9df0e5d509939f5c3d17d550a6f3e4b7b5 (patch) | |
| tree | ea93369b19c9c26ea275c398798b6deae854c1fd /offsetProject/src/ofApp.h | |
| parent | d63937d54f41aa94236be6d7da3eede9b07196c7 (diff) | |
extend border correct
Diffstat (limited to 'offsetProject/src/ofApp.h')
| -rw-r--r-- | offsetProject/src/ofApp.h | 16 |
1 files changed, 12 insertions, 4 deletions
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 ); } }; |
