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


C++ Trajectory::init方法代码示例

本文整理汇总了C++中Trajectory::init方法的典型用法代码示例。如果您正苦于以下问题:C++ Trajectory::init方法的具体用法?C++ Trajectory::init怎么用?C++ Trajectory::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Trajectory的用法示例。


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

示例1: doWork

void Main::doWork()
{
	Trajectory trajectory;
    IplImage *img = imAcqGetImg(imAcq);
    Mat grey(img->height, img->width, CV_8UC1);
    cvtColor(cvarrToMat(img), grey, CV_BGR2GRAY);

    tld->detectorCascade->imgWidth = grey.cols;
    tld->detectorCascade->imgHeight = grey.rows;
    tld->detectorCascade->imgWidthStep = grey.step;

	if(showTrajectory)
	{
		trajectory.init(trajectoryLength);
	}

    if(selectManually)
    {

        CvRect box;

        if(getBBFromUser(img, box, gui) == PROGRAM_EXIT)
        {
            return;
        }

        if(initialBB == NULL)
        {
            initialBB = new int[4];
        }

        initialBB[0] = box.x;
        initialBB[1] = box.y;
        initialBB[2] = box.width;
        initialBB[3] = box.height;
    }

    FILE *resultsFile = NULL;

    if(printResults != NULL)
    {
        resultsFile = fopen(printResults, "w");
        if(!resultsFile)
        {
            fprintf(stderr, "Error: Unable to create results-file \"%s\"\n", printResults);
            exit(-1);
        }
    }

    bool reuseFrameOnce = false;
    bool skipProcessingOnce = false;

    if(loadModel && modelPath != NULL)
    {
        tld->readFromFile(modelPath);
        reuseFrameOnce = true;
    }
    else if(initialBB != NULL)
    {
        Rect bb = tldArrayToRect(initialBB);

        printf("Starting at %d %d %d %d\n", bb.x, bb.y, bb.width, bb.height);

        tld->selectObject(grey, &bb);
        skipProcessingOnce = true;
        reuseFrameOnce = true;
    }
	
	

    while(imAcqHasMoreFrames(imAcq))
    {
        double tic = cvGetTickCount();

        if(!reuseFrameOnce)
        {
            cvReleaseImage(&img);
			img = imAcqGetImg(imAcq);
            if(img == NULL)
            {
                printf("current image is NULL, assuming end of input.\n");
                break;
            }

            cvtColor(cvarrToMat(img), grey, CV_BGR2GRAY);
        }

        if(!skipProcessingOnce)
        {
            tld->processImage(cvarrToMat(img));
			if (tld->currBB)
			{
				CvPoint center = cvPoint(tld->currBB->x + tld->currBB->width / 2, tld->currBB->y + tld->currBB->height / 2);
				Point statePt = tld->particlefilter->ParticleFileterProcess(center.x, center.y);

				cout << "center" << center.x << "\t" << center.y << endl;
				cout << "state" << statePt.x+20 << "\t" << statePt.y+40 << endl;
				getchar();
			}
        }
//.........这里部分代码省略.........
开发者ID:lzx1413,项目名称:OpenTLD,代码行数:101,代码来源:Main.cpp

示例2: doWork

void Main::doWork()
{
	Trajectory trajectory;
	//usleep( 1000 );
    IplImage *img = imAcqGetImg( imAcq );
    std::vector<cv::Point> flandmarkVector;
	cv::Point pupil;
	
    int loops = 50; // skip the first 50 frames of the video.
    for ( int counter = 0; counter <= loops; counter++ )
    {
    	img = imAcqGetImg( imAcq );
    }
    Mat grey( img->height, img->width, CV_8UC1 );
    cvtColor( cv::Mat( img ), grey, CV_BGR2GRAY );

    tld->detectorCascade->imgWidth = grey.cols;
    tld->detectorCascade->imgHeight = grey.rows;
    tld->detectorCascade->imgWidthStep = grey.step;
	
	if( showTrajectory )
	{
		trajectory.init( trajectoryLength );
	}

    if( selectManually )
    {

        CvRect box;

        if( getBBFromUser( img, box, gui ) == PROGRAM_EXIT )
        {
            return;
        }

        if( initialBB == NULL )
        {
            initialBB = new int[ 4 ];
        }

        initialBB[ 0 ] = box.x;
        initialBB[ 1 ] = box.y;
        initialBB[ 2 ] = box.width;
        initialBB[ 3 ] = box.height;
    }

	// initialBB is not being set when there is no parameter -b given
	doHaar( grey );
	
    
    
    FILE *resultsFile = NULL;

    if( printResults != NULL )
    {
        resultsFile = fopen( printResults, "w" );
    }

    bool reuseFrameOnce = false;
    bool skipProcessingOnce = false;


	
	
    if( loadModel && modelPath != NULL )
    {
        tld->readFromFile(modelPath);
        reuseFrameOnce = true;
    }
    else if( initialBB != NULL )
    {
        Rect bb = tldArrayToRect( initialBB );

        printf( "Starting at %d %d %d %d\n",
				bb.x,
				bb.y,
				bb.width,
				bb.height
		);

        tld->selectObject( grey, &bb );
        skipProcessingOnce = true;
        reuseFrameOnce = true;
    }
    
    // deleting initialBB to avoid memLeaks
    delete initialBB;
	cv::Rect faceBB;
	
	eyeTld->detectorCascade->imgWidth = tld->currBB->width;
    eyeTld->detectorCascade->imgHeight = tld->currBB->height;
    eyeTld->detectorCascade->imgWidthStep = grey.step;
    cv::Rect eye = doDetectEye( img );
    
	eye.x += tld->currBB->x;
	eye.y += tld->currBB->y;
	eyeTld->selectObject( grey, &eye );
	
	//cv::Point pupil = cv::Point( 0, 0 );
	
//.........这里部分代码省略.........
开发者ID:sdyx,项目名称:OpenTLD,代码行数:101,代码来源:Main_eye_almost_working.cpp


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