当前位置: 首页>>代码示例>>C++>>正文


C++ cvReleaseMemStorage函数代码示例

本文整理汇总了C++中cvReleaseMemStorage函数的典型用法代码示例。如果您正苦于以下问题:C++ cvReleaseMemStorage函数的具体用法?C++ cvReleaseMemStorage怎么用?C++ cvReleaseMemStorage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cvReleaseMemStorage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: asef_destroy

void asef_destroy(AsefEyeLocator *asef){

	cvReleaseMemStorage( &asef->face_detection_buffer );
	cvReleaseHaarClassifierCascade( &asef->face_detection_classifier );

	cvReleaseMat(&asef->lfilter);
	cvReleaseMat(&asef->rfilter);
	cvReleaseMat(&asef->lfilter_dft);
	cvReleaseMat(&asef->rfilter_dft);
	cvReleaseMat(&asef->scaled_face_image_32fc1);
	cvReleaseMat(&asef->scaled_face_image_8uc1);
	cvReleaseMat(&asef->lcorr);
	cvReleaseMat(&asef->rcorr);
	cvReleaseMat(&asef->lroi);
	cvReleaseMat(&asef->rroi);
	cvReleaseMat(&asef->lut);
}
开发者ID:rogerils,项目名称:ASEF,代码行数:17,代码来源:asef.c

示例2: cvSliceLength

void CvGBTrees::clear()
{
    if( weak )
    {
        CvSeqReader reader;
        CvSlice slice = CV_WHOLE_SEQ;
        CvDTree* tree;

        //data->shared = false;
        for (int i=0; i<class_count; ++i)
        {
            int weak_count = cvSliceLength( slice, weak[i] );
            if ((weak[i]) && (weak_count))
            {
                cvStartReadSeq( weak[i], &reader );
                cvSetSeqReaderPos( &reader, slice.start_index );
                for (int j=0; j<weak_count; ++j)
                {
                    CV_READ_SEQ_ELEM( tree, reader );
                    //tree->clear();
                    delete tree;
                    tree = 0;
                }
            }
        }
        for (int i=0; i<class_count; ++i)
            if (weak[i]) cvReleaseMemStorage( &(weak[i]->storage) );
        delete[] weak;
    }
    if (data)
    {
        data->shared = false;
        delete data;
    }
    weak = 0;
    data = 0;
    delta = 0.0f;
    cvReleaseMat( &orig_response );
    cvReleaseMat( &sum_response );
    cvReleaseMat( &sum_response_tmp );
    cvReleaseMat( &subsample_train );
    cvReleaseMat( &subsample_test );
    cvReleaseMat( &sample_idx );
    cvReleaseMat( &missing );
    cvReleaseMat( &class_labels );
}
开发者ID:Rocky030,项目名称:opencv,代码行数:46,代码来源:gbt.cpp

示例3: cvGetMat

CvSeq*cvSegmentFGMask(CvArr* _mask, int poly1Hull0, float perimScale, CvMemStorage* storage, CvPoint offset)
{
	CvMat mstub, *mask = cvGetMat(_mask, &mstub);
	CvMemStorage* tempStorage = storage ? storage : cvCreateMemStorage();
	CvSeq *contours, *c;
	int nContours = 0;
	CvContourScanner scanner;

	// clean up raw mask
	cvMorphologyEx(mask, mask, 0, 0, CV_MOP_OPEN, 1);
	cvMorphologyEx(mask, mask, 0, 0, CV_MOP_CLOSE, 1);
	// find contours around only bigger regions
	scanner = cvStartFindContours(mask, tempStorage,
		sizeof(CvContour), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE, offset);

	while ((c = cvFindNextContour(scanner)) != 0)
	{
		double len = cvContourPerimeter(c);
		double q = (mask->rows + mask->cols) / perimScale; // calculate perimeter len threshold
		if (len < q) //Get rid of blob if it's perimeter is too small
			cvSubstituteContour(scanner, 0);
		else //Smooth it's edges if it's large enough
		{
			CvSeq* newC;
			if (poly1Hull0) //Polygonal approximation of the segmentation 
				newC = cvApproxPoly(c, sizeof(CvContour), tempStorage, CV_POLY_APPROX_DP, 2, 0);
			else //Convex Hull of the segmentation
				newC = cvConvexHull2(c, tempStorage, CV_CLOCKWISE, 1);
			cvSubstituteContour(scanner, newC);
			nContours++;
		}
	}
	contours = cvEndFindContours(&scanner);
	// paint the found regions back into the image
	cvZero(mask);
	for (c = contours; c != 0; c = c->h_next)
		cvDrawContours(mask, c, cvScalarAll(255), cvScalarAll(0), -1, CV_FILLED, 8,
		cvPoint(-offset.x, -offset.y));
	if (tempStorage != storage)
	{
		cvReleaseMemStorage(&tempStorage);
		contours = 0;
	}
	return contours;
}
开发者ID:Doufang,项目名称:PistonRing,代码行数:45,代码来源:CameraPublic.cpp

示例4: cvCreateMemStorage

/*!
    \fn CvGaborFeature::writeXML(const char* filename) const
 */
void CvGaborFeature::writeXML(const char* filename) const
{
  CvMemStorage* storage = cvCreateMemStorage( 0 );
  CvFileStorage* fs = cvOpenFileStorage( filename, storage, CV_STORAGE_WRITE);
 
  cvStartWriteStruct( fs, "CvGaborFeature",
                      CV_NODE_MAP, NULL,
                      cvAttrList(0,0));
  cvWriteInt(fs, "x", getx());
  cvWriteInt(fs, "y", gety());
  cvWriteInt(fs, "Mu",getMu());
  cvWriteInt(fs, "Nu",getNu());
  cvEndWriteStruct(fs); 
  cvEndWriteStruct( fs );
  
  cvReleaseFileStorage(&fs);
  cvReleaseMemStorage(&storage);
}
开发者ID:Slipperboy,项目名称:gaborboosting,代码行数:21,代码来源:cvgaborfeature.cpp

示例5: cvCreateMemStorage

CvSeq* HoughCircle::locateHoughCircles(IplImage* img,double min_distance, double upperThreshold, double accumulatorThreshold, double min_radius, double max_radius ){
	//IplImage* gray = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
	//storage = cvCreateMemStorage(0);

    IplImage* gray=cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
    CvMemStorage* storage = cvCreateMemStorage(0);
    cvCvtColor( img, gray, CV_BGR2GRAY );

   // cvShowImage("Gray",gray);
   // cvEqualizeHist(gray,gray);
   // cvShowImage("Hist Eq Gray",gray);

	CvSeq* circle = cvHoughCircles( gray, storage, CV_HOUGH_GRADIENT, 2, min_distance, upperThreshold, accumulatorThreshold, min_radius, max_radius);
	cvReleaseImage(&gray);
	cvReleaseMemStorage(&storage);

	return circle;
}
开发者ID:sushilman,项目名称:etsfhci,代码行数:18,代码来源:HoughCircle.cpp

示例6: gst_face_blur_finalize

/* Clean up */
static void
gst_face_blur_finalize (GObject * obj)
{
  GstFaceBlur *filter = GST_FACE_BLUR (obj);

  if (filter->cvGray)
    cvReleaseImage (&filter->cvGray);

  if (filter->cvStorage)
    cvReleaseMemStorage (&filter->cvStorage);

  if (filter->cvCascade)
    cvReleaseHaarClassifierCascade (&filter->cvCascade);

  g_free (filter->profile);

  G_OBJECT_CLASS (gst_face_blur_parent_class)->finalize (obj);
}
开发者ID:Distrotech,项目名称:gst-plugins-bad,代码行数:19,代码来源:gstfaceblur.c

示例7: cvReleaseImage

CHandDrawEffect::~CHandDrawEffect()
{
	for(int i = 0; i < PATT_NUM; i++) {
		if(hatching[i])
			cvReleaseImage(&hatching[i]);
	}

	if(hsv)			cvReleaseImage(&hsv);
	if(grayImage)	cvReleaseImage(&grayImage);
	if(binaryImage)	cvReleaseImage(&binaryImage);
	if(imageA)		cvReleaseImage(&imageA);
	if(imageB)		cvReleaseImage(&imageB);
	if(imageC)		cvReleaseImage(&imageC);
	if(imageD)		cvReleaseImage(&imageD);
	if(imageE)		cvReleaseImage(&imageE);
	if(scanningLine) cvReleaseImage(&scanningLine);
	if(memStorage0)	cvReleaseMemStorage(&memStorage0);
}
开发者ID:zphilip,项目名称:VirtualTS,代码行数:18,代码来源:CCVEffect.cpp

示例8: cvCreateMemStorage

void moBlobFinderModule::applyFilter(IplImage *src) {
	this->storage = cvCreateMemStorage(0);
	this->clearBlobs();
	this->storage = cvCreateMemStorage(0);
	cvCopy(src, this->output_buffer);
	
        CvSeq *contours = 0;
	cvFindContours(this->output_buffer, this->storage, &contours, sizeof(CvContour), CV_RETR_CCOMP);

        cvDrawContours(this->output_buffer, contours, cvScalarAll(255), cvScalarAll(255), 100);

	// Consider each contour a blob and extract the blob infos from it.
	int size;
	int ratio;
	int min_size = this->property("min_size").asInteger();
	int max_size = this->property("max_size").asInteger();
	CvSeq *cur_cont = contours;
	while (cur_cont != 0) {
		CvRect rect	= cvBoundingRect(cur_cont, 0);
		size = rect.width * rect.height;

		// Check ratio to make sure blob can physically represent a finger
		// magic number 6 is used for now to represent maximum ratio of
		// Length/thickness of finger
		if (rect.width < rect.height) {
			ratio = rect.height / (double)rect.width;
		} else {
			ratio = rect.width / (double)rect.height;
		}
		if ((ratio <= 6) && (size >= min_size) && (size <= max_size)) {
			moDataGenericContainer *blob = new moDataGenericContainer();
			blob->properties["implements"] = new moProperty("pos,size");
			blob->properties["x"] = new moProperty((rect.x + rect.width / 2) / (double) src->width);
			blob->properties["y"] = new moProperty((rect.y + rect.height / 2) / (double) src->height);
			blob->properties["width"] = new moProperty(rect.width);
			blob->properties["height"] = new moProperty(rect.height);
			this->blobs->push_back(blob);
			cvRectangle(this->output_buffer, cvPoint(rect.x,rect.y), cvPoint(rect.x + rect.width,rect.x + rect.height), cvScalar(250,10,10), 1);
		}
		cur_cont = cur_cont->h_next;
	}
	cvReleaseMemStorage(&this->storage);
    this->output_data->push(this->blobs);
}
开发者ID:arasbm,项目名称:Movid,代码行数:44,代码来源:moBlobFinderModule.cpp

示例9: detectFaceInImage

// Perform face detection on the input image, using the given Haar Cascade. 
// Returns a rectangle for the detected region in the given image.
CvRect detectFaceInImage(IplImage* inputImg, CvHaarClassifierCascade* cascade, CvSize faceSize)
{
	// Only search for 1 face.
	int flags = CV_HAAR_FIND_BIGGEST_OBJECT | CV_HAAR_DO_ROUGH_SEARCH;
	// How detailed should the search be.
	float search_scale_factor = 1.1f;
	IplImage *detectImg = NULL;
	IplImage *greyImg = NULL;
	CvMemStorage* storage = NULL;

	CvSeq* rects = NULL;
	CvSize srcSize;
	CvRect rc;
	int nFaces;

	storage = cvCreateMemStorage(0); // Allocate 64KB memory space
	cvClearMemStorage(storage);

	// If the image is color, use a greyscale copy of the image.
	detectImg = (IplImage*)inputImg;
	if (inputImg->nChannels > 1) {
		srcSize = cvSize(inputImg->width, inputImg->height);
		greyImg = cvCreateImage(srcSize, IPL_DEPTH_8U, 1);
		cvCvtColor(inputImg, greyImg, CV_BGR2GRAY);
		detectImg = greyImg;	// Use the greyscale image.
	}

	// Detect all the faces in the greyscale image.
	rects = cvHaarDetectObjects(detectImg, cascade, storage,
			search_scale_factor, 3, flags, faceSize);
	nFaces = rects->total;

	// Get the first detected face (the biggest).
	if (nFaces > 0)
		rc = *(CvRect*)cvGetSeqElem(rects, 0);
	else
		rc = cvRect(-1, -1, -1, -1);	// Couldn't find the face.

	if (greyImg != NULL)
		cvReleaseImage(&greyImg);
	cvReleaseMemStorage(&storage);

	return rc;	// Return the biggest face found, or (-1,-1,-1,-1).
}
开发者ID:william-cheung,项目名称:FaceRecApp,代码行数:46,代码来源:basic.cpp

示例10: main

int main()
{
	const int imgHeight = 500;
	const int imgWidth = 500;

	IplImage* pImgSrc = cvCreateImage(cvSize(imgWidth, imgHeight), IPL_DEPTH_8U, 1); // ԭʼͼ
	IplImage* pImgContour = NULL; // ÂÖÀªÍ¼

	CvMemStorage* pMemStorage = cvCreateMemStorage(0); // ÁÙʱ´æ´¢Çø
	CvSeq* pContour = 0; // ´æ´¢ÂÖÀªµã

	// »æÖÆԭʼͼƬ
	DrawImage(pImgSrc);

	// ÏÔʾԭʼͼ
	cvNamedWindow("Source", CV_WINDOW_AUTOSIZE);
	cvShowImage("Source", pImgSrc);

	// ΪÂÖÀªÍ¼ÉêÇë¿Õ¼ä, 3ͨµÀͼÏñ
	pImgContour = cvCreateImage(cvGetSize(pImgSrc), IPL_DEPTH_8U, 3);

	// ½«µ¥Í¨µÀ»Ò¶Èͼת»¯Îª3ͨµÀ»Ò¶Èͼ
	//cvCvtColor(pImgSrc, pImgContour, CV_GRAY2BGR);
	cvZero(pImgContour);

	// ²éÕÒÂÖÀª
	cvFindContours(pImgSrc, pMemStorage, &pContour, sizeof(CvContour), CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));

	// ½«ÂÖÀª»­³ö
	cvDrawContours(pImgContour, pContour, CV_RGB(0, 0, 255), CV_RGB(255, 0, 0), 2, 2, 8, cvPoint(0, 0));

	// ÏÔʾÂÖÀªÍ¼
	cvNamedWindow("Contour", CV_WINDOW_AUTOSIZE);
	cvShowImage("Contour", pImgContour);

	cvWaitKey(0);

	cvDestroyWindow("Contour");
	cvDestroyWindow("Source");
	cvReleaseImage(&pImgSrc);
	cvReleaseImage(&pImgContour);
	cvReleaseMemStorage(&pMemStorage);
	return 0;
}
开发者ID:BurnellLiu,项目名称:LiuProject,代码行数:44,代码来源:main.cpp

示例11:

FindObjectMain::~FindObjectMain()
{
// This releases all the arrays
	if(storage) cvReleaseMemStorage(&storage);
	if(object_image) cvReleaseImage(&object_image);
	if(scene_image) cvReleaseImage(&scene_image);
	if(prev_object) delete [] prev_object;
	delete affine;
	delete temp;
	delete overlayer;
	
    if(blob_param.pBT) cvReleaseBlobTracker(&blob_param.pBT);
    if(blob_param.pBD) cvReleaseBlobDetector(&blob_param.pBD);
    if(blob_param.pBTGen) cvReleaseBlobTrackGen(&blob_param.pBTGen);
    if(blob_param.pBTA) cvReleaseBlobTrackAnalysis(&blob_param.pBTA);
    if(blob_param.pFG) cvReleaseFGDetector(&blob_param.pFG);
    if(blob_pTracker) cvReleaseBlobTrackerAuto(&blob_pTracker);
	
}
开发者ID:petterreinholdtsen,项目名称:cinelerra-hv,代码行数:19,代码来源:findobject.C

示例12: catcierge_haar_matcher_destroy

void catcierge_haar_matcher_destroy(catcierge_matcher_t **octx)
{
	catcierge_haar_matcher_t *ctx;

	if (!octx || !(*octx))
		return;

	ctx = (catcierge_haar_matcher_t *)*octx;

	if (ctx->cascade)
	{
		cv2CascadeClassifier_destroy(ctx->cascade);
		ctx->cascade = NULL;
	}

	if (ctx->kernel2x2)
	{
		cvReleaseStructuringElement(&ctx->kernel2x2);
		ctx->kernel2x2 = NULL;
	}

	if (ctx->kernel3x3)
	{
		cvReleaseStructuringElement(&ctx->kernel3x3);
		ctx->kernel3x3 = NULL;
	}

	if (ctx->kernel5x1)
	{
		cvReleaseStructuringElement(&ctx->kernel5x1);
		ctx->kernel5x1 = NULL;
	}

	if (ctx->storage)
	{
		cvReleaseMemStorage(&ctx->storage);
		ctx->storage = NULL;
	}

	free(ctx);
	*octx = NULL;
}
开发者ID:JoakimSoderberg,项目名称:catcierge,代码行数:42,代码来源:catcierge_haar_matcher.c

示例13: malloc

/* 
 * Prints a contour on a dst Image. Used for debugging.
 * prints text at the side of a contour.
 * depthLevel sets the level in the contour tree(to include/exclue holes)
 */
void Contours::printContour(int depthLevel, CvScalar color,IplImage * dst){
	
	CvFont font;
	int line_type=CV_AA;
	
	char * a=(char *) malloc(20);
	char * b=(char *) malloc(20);
	char * c=(char *) malloc(20);
	char * d=(char *) malloc(20);
	char * e=(char *) malloc(20);
	
	
	cvDrawContours( dst, this->c, CV_RGB(255,0,0), CV_RGB(0,255,0), 
		depthLevel, 3, CV_AA, cvPoint(0,0) );
	
	CvMemStorage* mem = cvCreateMemStorage(0);
	CvBox2D box=cvMinAreaRect2(this->c,mem);
	
	
	//~ traversePoints(this->c);

	std::vector<int> centroid=this->getCentroid();
	CvPoint pt2=cvPoint(centroid[0]+5,centroid[1]+5);
	CvPoint pt3=cvPoint(centroid[0]+5,centroid[1]+15);
	CvPoint pt4=cvPoint(centroid[0]+5,centroid[1]+25);
	CvPoint pt5=cvPoint(centroid[0]+5,centroid[1]+35);
	CvPoint pt6=cvPoint(centroid[0]+5,centroid[1]+45);
	sprintf(a,"per: %g",this->getPerimeter());
	sprintf(b,"zone: %d",getPointZone(this->x,this->y));
	sprintf(c,"area: %g",this->getArea());
	sprintf(d,"ecc: %g",this->getPerimeter()*this->getPerimeter()/this->getArea());
	//~ sprintf(d,"boxArea: %g",(double) this->getArea()/(box.size.width*box.size.height));
	
	cvInitFont( &font, CV_FONT_HERSHEY_COMPLEX, 0.5, 0.5, 0.0,0.5, line_type );
	cvPutText( dst, a, pt2, &font, CV_RGB(255,255,0));
	cvPutText( dst, c, pt3, &font, CV_RGB(255,255,0));
	cvPutText( dst, b, pt4, &font, CV_RGB(255,255,0));
	cvPutText( dst, d, pt5, &font, CV_RGB(255,255,0));

	//~ free(a);
	cvReleaseMemStorage(&mem);
}
开发者ID:margguo,项目名称:tpf-robotica,代码行数:47,代码来源:Contours.cpp

示例14: icvStartScanGraph

CV_IMPL void
icvStartScanGraph( CvGraph* graph, CvGraphScanner* scanner,
                   CvGraphVtx* vtx, int mask )
{
    CvMemStorage* child_storage = 0;

    CV_FUNCNAME("icvStartScanGraph");

    __BEGIN__;

    if( !graph || !scanner )
        CV_ERROR_FROM_STATUS( CV_NULLPTR_ERR );

    if( !(graph->storage ))
        CV_ERROR_FROM_STATUS( CV_NULLPTR_ERR );

    memset( scanner, 0, sizeof(*scanner));

    scanner->graph = graph;
    scanner->mask = mask;
    scanner->vtx = vtx;
    scanner->index = vtx == 0 ? 0 : -1;

    CV_CALL( child_storage = cvCreateChildMemStorage( graph->storage ));

    CV_CALL( scanner->stack = cvCreateSeq( 0, sizeof(CvSet),
                       sizeof(CvGraphItem), child_storage ));

    CV_CALL( icvSeqElemsClearMask( (CvSeq*)graph,
                                   CV_FIELD_OFFSET( flags, CvGraphVtx ),
                                   CV_GRAPH_ITEM_VISITED_FLAG|
                                   CV_GRAPH_SEARCH_TREE_NODE_FLAG ));

    CV_CALL( icvSeqElemsClearMask( (CvSeq*)(graph->edges),
                                   CV_FIELD_OFFSET( flags, CvGraphEdge ),
                                   CV_GRAPH_ITEM_VISITED_FLAG ));

    __END__;

    if( cvGetErrStatus() < 0 )
        cvReleaseMemStorage( &child_storage );
}
开发者ID:mikanradojevic,项目名称:sdkpub,代码行数:42,代码来源:cvgraphex.cpp

示例15: main

int main( int argc, char** argv )
{
	CvCapture *capture;
	IplImage  *frame;
	int       key;
	
	//NamNguyen comment and add(2lines below)
	//char      *filename = "haarcascade_frontalface_alt.xml";	
	char filename[] = "haarcascade_frontalface_alt.xml";


	cascade = ( CvHaarClassifierCascade* )cvLoad( filename, 0, 0, 0 );
	storage = cvCreateMemStorage( 0 );
	capture = cvCaptureFromCAM( 0 );

	assert( cascade && storage && capture );

	cvNamedWindow( "video", 1 );

	while( key != 'q' ) {
		frame = cvQueryFrame( capture );

		if( !frame ) {
			fprintf( stderr, "Cannot query frame!\n" );
			break;
		}

		cvFlip( frame, frame, -1 );
		frame->origin = 0;

		detectFaces( frame );

		key = cvWaitKey( 10 );
	}

	cvReleaseCapture( &capture );
	cvDestroyWindow( "video" );
	cvReleaseHaarClassifierCascade( &cascade );
	cvReleaseMemStorage( &storage );

	return 0;
}
开发者ID:quocnam,项目名称:NQN,代码行数:42,代码来源:facedetect.c


注:本文中的cvReleaseMemStorage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。