X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=cxcore%2Finclude%2Fcxcore.hpp;fp=cxcore%2Finclude%2Fcxcore.hpp;h=03ce12868446f53b7cf9bad94d572bc8102beaea;hb=80cd7b93506cc1926882d5fd08a2c74ee9359e29;hp=e9d9021331ca31f7e141e2deab2fb70c4f1b161e;hpb=467a270adf12425827305759c0c4ea8f5b2b3854;p=opencv diff --git a/cxcore/include/cxcore.hpp b/cxcore/include/cxcore.hpp index e9d9021..03ce128 100644 --- a/cxcore/include/cxcore.hpp +++ b/cxcore/include/cxcore.hpp @@ -85,7 +85,10 @@ public: void create( CvSize size, int depth, int channels ) { - attach( cvCreateImage( size, depth, channels )); + if( !image || !refcount || + image->width != size.width || image->height != size.height || + image->depth != depth || image->nChannels != channels ) + attach( cvCreateImage( size, depth, channels )); } void release() { detach(); } @@ -258,7 +261,10 @@ public: void create( int rows, int cols, int type ) { - set( cvCreateMat( rows, cols, type ), false ); + if( !matrix || !matrix->refcount || + matrix->rows != rows || matrix->cols != cols || + CV_MAT_TYPE(matrix->type) != type ) + set( cvCreateMat( rows, cols, type ), false ); } void addref() const