Wednesday, March 28, 2007

Object Construction and destruction in a single function :

IplImage* m_pSrcImage = NULL;

int ObjectLifeTime( bool bConstruct)

{

if( m_pSrcImage)

{

cvReleaseImage(&m_pSrcImage);

m_pSrcImage = NULL;

}

if( bConstruct)

{

m_pSrcImage = cvCreateImage(cvSize(300,300),IPL_DEPTH_8U, 3);

}

return 0;

}

we can use the ObjectLifeTime() fn to construct as well as destruct the object...

ObjectLifeTime( true) to construct the object...

ObjectLifeTime(false) to destruct the object....

0 Comments:

Post a Comment

<< Home