本文整理汇总了C++中cvFree函数的典型用法代码示例。如果您正苦于以下问题:C++ cvFree函数的具体用法?C++ cvFree怎么用?C++ cvFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cvFree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cvReleaseData
// deallocate underlying CvMat or IplImage data
CV_IMPL void
cvReleaseData( CvArr* arr )
{
CV_FUNCNAME( "cvReleaseData" );
__BEGIN__;
if( _CV_IS_ARR( arr ))
{
CvMat* mat = (CvMat*)arr;
uchar* data = mat->data.ptr;
mat->data.ptr = 0;
cvFree( (void**)&data );
}
else if( _CV_IS_IMAGE( arr ))
{
IplImage* img = (IplImage*)arr;
if( !CvIPL.deallocate )
{
char* ptr = img->imageData;
img->imageData = img->imageDataOrigin = 0;
cvFree( (void**)&ptr );
}
else
{
CvIPL.deallocate( img, IPL_IMAGE_DATA );
}
}
else
{
CV_ERROR( CV_StsBadArg, "" );
}
__END__;
}
开发者ID:mikanradojevic,项目名称:sdkpub,代码行数:37,代码来源:cvarray.cpp
示例2: icvTestSeqReleaseAll
static void icvTestSeqReleaseAll(CvTestSeqElem** ppElemList)
{
CvTestSeqElem* p = ppElemList[0];
while(p)
{
CvTestSeqElem* pd = p;
if(p->pAVI)
{
//cvReleaseCapture(&p->pAVI);
}
if(p->pImg)cvReleaseImage(&p->pImg);
if(p->pImgMask)cvReleaseImage(&p->pImgMask);
if(p->pPos)cvFree(&p->pPos);
if(p->pTrans)cvFree(&p->pTrans);
if(p->pSize)cvFree(&p->pSize);
p=p->next;
cvFree(&pd);
} /* Next element. */
ppElemList[0] = NULL;
} /* icvTestSeqReleaseAll */
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:24,代码来源:testseq.cpp
示例3: cvReleaseStereoBMState
void cvReleaseStereoBMState( CvStereoBMState** state )
{
if( !state )
CV_Error( CV_StsNullPtr, "" );
if( !*state )
return;
cvReleaseMat( &(*state)->preFilteredImg0 );
cvReleaseMat( &(*state)->preFilteredImg1 );
cvReleaseMat( &(*state)->slidingSumBuf );
cvReleaseMat( &(*state)->disp );
cvReleaseMat( &(*state)->cost );
cvFree( state );
}
开发者ID:AliMiraftab,项目名称:opencv,代码行数:15,代码来源:compat_stereo.cpp
示例4: LOG
/*!
* Method returns one frame (IplImage).
*/
bool V4L::retFrame() {
if (ioctl(video_dev, VIDIOCSYNC, &((*(v_map + bufferIndex)).frame)) == -1) {
LOG(LERROR) << "function: retFrame\n";
return false;
}
if ((frame.width != (*(v_map + bufferIndex)).width) || (frame.height
!= (*(v_map + bufferIndex)).height)) {
cvFree(&(frame.imageData));
cvInitImageHeader(&frame, cvSize(win.width, win.height), IPL_DEPTH_8U,
3, IPL_ORIGIN_TL, 4);
frame.imageData = (char *) cvAlloc(frame.imageSize);
}
memcpy((char *) (frame.imageData), (char *) (map
+ m_buf.offsets[bufferIndex]), frame.imageSize);
//memcpy((char *)(original_frame.imageData),(char *)(map + m_buf.offsets[bufferIndex]),original_frame.imageSize);
/*
switch(pic.palette)
{
case RGB24:
memcpy((char *)(frame.imageData),(char *)(map + m_buf.offsets[bufferIndex]),frame.imageSize);
break;
case YUV422P:
yuv420p_to_rgb24(win.width,
win.height,
(unsigned char*)(map + m_buf.offsets[bufferIndex]),
(unsigned char*)frame.imageData);
break;
case YUV420:
yuv420_to_rgb24(win.width,
win.height,
(unsigned char*)(map + m_buf.offsets[bufferIndex]),
(unsigned char*)frame.imageData);
break;
case YUV411P:
yuv411p_to_rgb24(win.width,
win.height,
(unsigned char*)(map + m_buf.offsets[bufferIndex]),
(unsigned char*)frame.imageData);
break;
default:
printf("format is not supported V4L\n");
return false;
}*/
return true;
}
开发者ID:krejmano,项目名称:DisCODe,代码行数:51,代码来源:V4L.cpp
示例5: icvReleaseCascadeHaarClassifier
void icvReleaseCascadeHaarClassifier( CvIntHaarClassifier** classifier )
{
int i;
for( i = 0; i < ((CvCascadeHaarClassifier*) *classifier)->count; i++ )
{
if( ((CvCascadeHaarClassifier*) *classifier)->classifier[i] != NULL )
{
((CvCascadeHaarClassifier*) *classifier)->classifier[i]->release(
&(((CvCascadeHaarClassifier*) *classifier)->classifier[i]) );
}
}
cvFree( classifier );
*classifier = NULL;
}
开发者ID:HSOFEUP,项目名称:opencv_samples,代码行数:16,代码来源:cvhaarclassifier.cpp
示例6: main
int main()
{
IplImage *image = cvCreateImageHeader(cvSize(640,480), 8, 3);
while (cvWaitKey(10) < 0)
{
char *data;
unsigned int timestamp;
freenect_sync_get_video((void**)(&data), ×tamp, 0, FREENECT_VIDEO_RGB);
cvSetData(image, data, 640*3);
cvCvtColor(image, image, CV_RGB2BGR);
cvShowImage("RGB", image);
}
freenect_sync_stop();
cvFree(&image);
return EXIT_SUCCESS;
}
开发者ID:ldandoy,项目名称:freenect-exemple,代码行数:16,代码来源:main.cpp
示例7: cvReleaseStereoGCState
void cvReleaseStereoGCState(CvStereoGCState** _state) {
CvStereoGCState* state;
if (!_state && !*_state) {
return;
}
state = *_state;
cvReleaseMat(&state->left);
cvReleaseMat(&state->right);
cvReleaseMat(&state->ptrLeft);
cvReleaseMat(&state->ptrRight);
cvReleaseMat(&state->vtxBuf);
cvReleaseMat(&state->edgeBuf);
cvFree(_state);
}
开发者ID:353,项目名称:viewercv,代码行数:16,代码来源:stereogc.cpp
示例8: main
int
main (int argc, char **argv)
{
int i, img_num;
const char defaultfile[2][32] = {"../image/moon.png", "../image/sunset.png"};
int total_width=0, max_height=0;
IplImage **src_img;
IplImage *combined_img;
CvRect roi = cvRect(0, 0, 0, 0);
// (1)load all images specified on the command line
img_num = argc > 1 ? argc-1 : 2;
src_img = (IplImage**)cvAlloc(sizeof(IplImage*)*img_num);
for(i=0; i<img_num; i++) {
src_img[i] = cvLoadImage (argc-1?argv[i+1]:defaultfile[i], CV_LOAD_IMAGE_COLOR);
if(src_img[i] == 0)
return -1;
total_width += src_img[i]->width;
max_height = max_height < src_img[i]->height ? src_img[i]->height : max_height;
}
// (2)append images one after another
combined_img = cvCreateImage(cvSize(total_width, max_height), IPL_DEPTH_8U, 3);
cvZero(combined_img);
for(i=0; i<img_num; i++) {
roi.width = src_img[i]->width;
roi.height = src_img[i]->height;
cvSetImageROI(combined_img, roi);
cvCopy(src_img[i], combined_img, NULL);
roi.x += roi.width;
}
cvResetImageROI(combined_img);
// (3)show the combined image, and quit when any key pressed
cvNamedWindow ("Image", CV_WINDOW_AUTOSIZE);
cvShowImage ("Image", combined_img);
cvWaitKey (0);
cvDestroyWindow("Image");
cvReleaseImage(&combined_img);
for(i=0; i<img_num; i++) {
cvReleaseImage(&src_img[i]);
}
cvFree(&src_img);
return 0;
}
开发者ID:Anaselfarash,项目名称:opencvjp-sample,代码行数:47,代码来源:combine_images.c
示例9: icvDestroyMemStorage
/* Release all blocks of the storage (or return them to parent, if any): */
static void
icvDestroyMemStorage( CvMemStorage* storage )
{
int k = 0;
CvMemBlock *block;
CvMemBlock *dst_top = 0;
if( !storage )
CV_Error( CV_StsNullPtr, "" );
if( storage->parent )
dst_top = storage->parent->top;
for( block = storage->bottom; block != 0; k++ )
{
CvMemBlock *temp = block;
block = block->next;
if( storage->parent )
{
if( dst_top )
{
temp->prev = dst_top;
temp->next = dst_top->next;
if( temp->next )
temp->next->prev = temp;
dst_top = dst_top->next = temp;
}
else
{
dst_top = storage->parent->bottom = storage->parent->top = temp;
temp->prev = temp->next = 0;
storage->free_space = storage->block_size - sizeof( *temp );
}
}
else
{
cvFree( &temp );
}
}
storage->top = storage->bottom = 0;
storage->free_space = 0;
}
开发者ID:baoson2211,项目名称:opencv,代码行数:46,代码来源:datastructs.cpp
示例10: assert
bool CvCalibFilter::Push( const CvPoint2D32f** pts )
{
bool result = true;
int i, newMaxPoints = etalonPointCount*(MAX(framesAccepted,framesTotal) + 1);
isCalibrated = false;
if( !pts )
{
for( i = 0; i < cameraCount; i++ )
if( latestCounts[i] <= 0 )
return false;
pts = (const CvPoint2D32f**)latestPoints;
}
for( i = 0; i < cameraCount; i++ )
{
if( !pts[i] )
{
assert(0);
break;
}
if( maxPoints < newMaxPoints )
{
CvPoint2D32f* prev = points[i];
cvFree( points + i );
points[i] = (CvPoint2D32f*)cvAlloc( newMaxPoints * sizeof(prev[0]));
memcpy( points[i], prev, maxPoints * sizeof(prev[0]));
}
memcpy( points[i] + framesAccepted*etalonPointCount, pts[i],
etalonPointCount*sizeof(points[0][0]));
}
if( maxPoints < newMaxPoints )
maxPoints = newMaxPoints;
result = i == cameraCount;
if( ++framesAccepted >= framesTotal )
Stop( true );
return result;
}
开发者ID:406089450,项目名称:opencv,代码行数:44,代码来源:calibfilter.cpp
示例11: main
int
main (int argc, char **argv)
{
char filename[] = "save_cv.xml"; // file name
int i;
int a;
float b;
CvMat** mat;
CvFileStorage *cvfs;
// (1)create sample data
a = 10;
b = 0.1;
mat = (CvMat**)cvAlloc(3*sizeof(CvMat*));
for(i=0;i<3;i++){
mat[i] = cvCreateMat(3,3,CV_32FC1);
cvSet(mat[i], cvScalarAll(i), NULL);
}
// (2)open file storage
cvfs = cvOpenFileStorage(filename,NULL,CV_STORAGE_WRITE);
// (3)write data to file
cvWriteInt(cvfs, "a", a);
cvWriteReal(cvfs, "b", b);
cvStartWriteStruct(cvfs, "mat_array", CV_NODE_SEQ, NULL, cvAttrList(NULL, NULL)); // create node
for(i=0; i<3; i++){
cvWrite(cvfs, NULL, mat[i], cvAttrList(NULL, NULL));
}
cvEndWriteStruct(cvfs);
// (4)close file storage
cvReleaseFileStorage(&cvfs);
// release mat
for(i=0; i<3; i++){
cvReleaseMat(mat+i);
}
cvFree(mat);
return 0;
}
开发者ID:Anaselfarash,项目名称:opencvjp-sample,代码行数:43,代码来源:save_data.c
示例12: icvAppendVec
// Append the body of the input vec to the ouput vec
void icvAppendVec( CvVecFile &in, CvVecFile &out, int *showsamples, int winwidth, int winheight )
{
CvMat* sample;
if( *showsamples )
{
cvNamedWindow( "Sample", CV_WINDOW_AUTOSIZE );
}
if( !feof( in.input ) )
{
in.last = 0;
in.vector = (short*) cvAlloc( sizeof( *in.vector ) * in.vecsize );
if ( *showsamples )
{
if ( in.vecsize != winheight * winwidth )
{
fprintf( stderr, "ERROR: -show: the size of images inside of vec files does not match with %d x %d, but %d\n", winheight, winwidth, in.vecsize );
exit(1);
}
sample = cvCreateMat( winheight, winwidth, CV_8UC1 );
}
else
{
sample = cvCreateMat( in.vecsize, 1, CV_8UC1 );
}
for( int i = 0; i < in.count; i++ )
{
icvGetHaarTraininDataFromVecCallback( sample, &in );
icvWriteVecSample ( out.input, sample );
if( *showsamples )
{
cvShowImage( "Sample", sample );
if( cvWaitKey( 0 ) == 27 )
{
*showsamples = 0;
}
}
}
cvReleaseMat( &sample );
cvFree( (void**) &in.vector );
}
}
开发者ID:Aerobota,项目名称:2015VisionCode,代码行数:43,代码来源:mergevec.cpp
示例13: icvVec2Img
// Extract images from a vec file
void icvVec2Img( const char* vecname, const char* outformat, int width, int height )
{
CvVecFile vec;
CvMat* sample;
char outfilename[PATH_MAX];
short tmp;
vec.input = fopen( vecname, "rb" );
if ( vec.input == NULL )
{
fprintf( stderr, "ERROR: Input file %s does not exist or not readable.\n", vecname);
exit(1);
}
fread( &vec.count, sizeof( vec.count ), 1, vec.input );
fread( &vec.vecsize, sizeof( vec.vecsize ), 1, vec.input );
fread( &tmp, sizeof( tmp ), 1, vec.input );
fread( &tmp, sizeof( tmp ), 1, vec.input );
if( !feof( vec.input ) )
{
vec.last = 0;
vec.vector = (short*) cvAlloc( sizeof( *vec.vector ) * vec.vecsize );
if( vec.vecsize != width * height )
{
fprintf( stderr, "ERROR: The size of images inside of vec files does not match with %d x %d, but %d. \n", height, width, vec.vecsize );
exit(1);
}
sample = cvCreateMat( height, width, CV_8UC1 );
//cvNamedWindow( "Sample", CV_WINDOW_AUTOSIZE );
for( int i = 0; i < vec.count; i++ )
{
icvGetHaarTraininDataFromVecCallback( sample, &vec );
sprintf( outfilename, outformat, i + 1 );
printf( "%s\n", outfilename );
cvSaveImage( outfilename, sample );
//cvShowImage( "Sample", sample ); cvWaitKey( 0 );
}
cvReleaseMat( &sample );
cvFree( (void**) &vec.vector );
}
fclose( vec.input );
}
开发者ID:Aerobota,项目名称:2015VisionCode,代码行数:43,代码来源:vec2img.cpp
示例14: cvFree
IplImage* C920Camera::RetrieveFrame(V4L2CameraCapture* capture) {
// Resize Frame if Format size has changed.
if (((unsigned long) capture->Frame.width != capture->V4L2Format.fmt.pix.width)
|| ((unsigned long) capture->Frame.height != capture->V4L2Format.fmt.pix.height)) {
cvFree(&capture->Frame.imageData);
cvInitImageHeader(&capture->Frame, cvSize(capture->V4L2Format.fmt.pix.width, capture->V4L2Format.fmt.pix.height),
IPL_DEPTH_8U, 3, IPL_ORIGIN_TL, 4);
capture->Frame.imageData = (char *) cvAlloc(capture->Frame.imageSize);
}
// Decode image from MJPEG to RGB24
if (capture->Buffers[capture->BufferIndex].start) {
if (!this->MJPEG2RGB24(capture->V4L2Format.fmt.pix.width, capture->V4L2Format.fmt.pix.height,
(unsigned char*) (capture->Buffers[capture->BufferIndex].start), capture->Buffers[capture->BufferIndex].length,
(unsigned char*) capture->Frame.imageData)) {
fprintf(stdout, "C920Camera::RetrieveFrame ERROR: Unable to decode frame.\n");
return 0;
}
}
return (&capture->Frame);
}
开发者ID:Aerobota,项目名称:2015VisionCode,代码行数:20,代码来源:C920Camera.cpp
示例15: clean
void vpKltOpencv::cleanAll()
{
clean();
if (features) cvFree(&features);
if (prev_features) cvFree(&prev_features);
if (status) cvFree(&status);
if (lostDuringTrack) cvFree(&lostDuringTrack);
if (featuresid) cvFree(&featuresid);
if (prev_featuresid) cvFree(&prev_featuresid);
features = NULL;
prev_features = NULL;
status = NULL;
lostDuringTrack = 0;
featuresid = NULL;
prev_featuresid = NULL;
}
开发者ID:ricsp,项目名称:visp,代码行数:16,代码来源:vpKltOpencv.cpp
示例16: cvReleaseMatHeader
// deallocate CvMat header
CV_IMPL void
cvReleaseMatHeader( CvMat** array )
{
CV_FUNCNAME( "cvReleaseMatHeader" );
__BEGIN__;
if( !array )
CV_ERROR_FROM_CODE( CV_HeaderIsNull );
if( *array )
{
CvMat* arr = *array;
if( !_CV_IS_ARR( arr ))
CV_ERROR_FROM_CODE( !arr ? CV_StsNullPtr : CV_StsBadFlag );
*array = 0;
cvFree( (void**)&arr );
}
__END__;
}
开发者ID:mikanradojevic,项目名称:sdkpub,代码行数:23,代码来源:cvarray.cpp
示例17: cvReleaseGLCM
void
cvReleaseGLCM( CvGLCM** GLCM, int flag )
{
CV_FUNCNAME( "cvReleaseGLCM" );
__BEGIN__;
int matrixLoop;
if( !GLCM )
CV_ERROR( CV_StsNullPtr, "" );
if( !(*GLCM) )
EXIT; // repeated deallocation: just skip it.
if( (flag == CV_GLCM_GLCM || flag == CV_GLCM_ALL) && (*GLCM)->matrices )
{
for( matrixLoop = 0; matrixLoop < (*GLCM)->numMatrices; matrixLoop++ )
{
if( (*GLCM)->matrices[ matrixLoop ] )
{
cvFree( (*GLCM)->matrices[matrixLoop] );
cvFree( (*GLCM)->matrices + matrixLoop );
}
}
cvFree( &((*GLCM)->matrices) );
}
if( (flag == CV_GLCM_DESC || flag == CV_GLCM_ALL) && (*GLCM)->descriptors )
{
for( matrixLoop = 0; matrixLoop < (*GLCM)->numMatrices; matrixLoop++ )
{
cvFree( (*GLCM)->descriptors + matrixLoop );
}
cvFree( &((*GLCM)->descriptors) );
}
if( flag == CV_GLCM_ALL )
{
cvFree( GLCM );
}
__END__;
}
开发者ID:douzsh,项目名称:douzsh,代码行数:45,代码来源:cvtexture.cpp
示例18: initTracking
/*!
Set the maximum number of features to track in the image.
\warning The tracker must be re-initialised using the method initTracking().
\param input : The new number of maximum features.
*/
void vpKltOpencv::setMaxFeatures(const int input) {
initialized = 0; maxFeatures=input;
if (features) cvFree(&features);
if (prev_features) cvFree(&prev_features);
if (status) cvFree(&status);
if (lostDuringTrack) cvFree(&lostDuringTrack);
if (featuresid) cvFree(&featuresid);
if (prev_featuresid) cvFree(&prev_featuresid);
features = (CvPoint2D32f*)cvAlloc((unsigned int)maxFeatures*sizeof(CvPoint2D32f));
prev_features = (CvPoint2D32f*)cvAlloc((unsigned int)maxFeatures*sizeof(CvPoint2D32f));
status = (char*)cvAlloc((unsigned int)maxFeatures*sizeof(char));
lostDuringTrack = (bool*)cvAlloc((unsigned int)maxFeatures*sizeof(bool));
featuresid = (long*)cvAlloc((unsigned int)maxFeatures*sizeof(long));
prev_featuresid = (long*)cvAlloc((unsigned int)maxFeatures*sizeof(long));
}
开发者ID:ricsp,项目名称:visp,代码行数:25,代码来源:vpKltOpencv.cpp
示例19: printf
void * MARS_VideoReader::videoReadLoop(){
string fname = this->getNextFilename();
printf("Reading in %s...\n", fname.c_str());
//## Setup the opencv Reader
CvVideoReader *Reader = NULL;
//IplImage *imgrgb= cvCreateImage(cvSize(windowWidth,windowHeight), IPL_DEPTH_8U, 3),
* img = cvCreateImage(cvSize(windowWidth,windowHeight), IPL_DEPTH_8U, 3);
cvFree(&img->imageDataOrigin);
img->origin = 0;
// Main loop
while( this->recording){
//dequeue a frame
BufferItem* bi = this->dequeue(); //openwill wait for the semaphore to be > 0, and then mutex lock/unlock the buffer for access.
if (!this->recording){ //check right after the dequeue as well, in case sem_post was called to unwait this thread from MARS_VideoReader::stop
break;
}
//convert to IplImage
img->imageData = bi->framedata;
img->imageDataOrigin = bi->framedata;
cvFlip(img, NULL, 0);
cvCvtColor(img, imgrgb, CV_BGR2RGB);
//Read the frame to disk
cvReadFrame(Reader,imgrgb);
//cleanup the memory associated with the frame
delete bi;
}
cvReleaseVideoReader(&Reader);
//## Exit cleanly
sched_yield();
usleep(1000);
printf("Closing %s.\n", fname.c_str());
return(0);
}
开发者ID:adityadhoot,项目名称:augmented-reality-system,代码行数:36,代码来源:MARS_VideoReader.cpp
示例20: cvUnregisterType
CV_IMPL void
cvUnregisterType( const char* type_name )
{
CvTypeInfo* info;
info = cvFindType( type_name );
if( info )
{
if( info->prev )
info->prev->next = info->next;
else
CvType::first = info->next;
if( info->next )
info->next->prev = info->prev;
else
CvType::last = info->prev;
if( !CvType::first || !CvType::last )
CvType::first = CvType::last = 0;
cvFree( &info );
}
}
开发者ID:Achraf33,项目名称:opencv,代码行数:24,代码来源:persistence_c.cpp
注:本文中的cvFree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论