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


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

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


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

示例1: doWork


//.........这里部分代码省略.........
                strcpy(learningString, "Learning");
            }

            sprintf(string, "#%d,Posterior %.2f; fps: %.2f, #numwindows:%d, %s", imAcq->currentFrame - 1, tld->currConf, fps, tld->detectorCascade->numWindows, learningString);
            CvScalar yellow = CV_RGB(255, 255, 0);
            CvScalar blue = CV_RGB(0, 0, 255);
            CvScalar black = CV_RGB(0, 0, 0);
            CvScalar white = CV_RGB(255, 255, 255);
			CvScalar red = CV_RGB(255, 0, 0);
			CvScalar green = CV_RGB(0, 255, 0);
            if(tld->currBB != NULL)
            {
                CvScalar rectangleColor = (confident) ? blue : yellow;
                cvRectangle(img, tld->currBB->tl(), tld->currBB->br(), rectangleColor, 8, 8, 0);
				cvCircle(img, tld->statePt, 5,red,4); 
				CvPoint center = cvPoint(tld->currBB->x + tld->currBB->width / 2, tld->currBB->y + tld->currBB->height / 2);
				cvCircle(img, center, 5, green, 4);

				if(showTrajectory)       
				{
					CvPoint center = cvPoint(tld->currBB->x+tld->currBB->width/2, tld->currBB->y+tld->currBB->height/2);
					cvLine(img, cvPoint(center.x-2, center.y-2), cvPoint(center.x+2, center.y+2), rectangleColor, 2);
					cvLine(img, cvPoint(center.x-2, center.y+2), cvPoint(center.x+2, center.y-2), rectangleColor, 2);
					trajectory.addPoint(center, rectangleColor);
				}
            }
			else if(showTrajectory)
			{
				trajectory.addPoint(cvPoint(-1, -1), cvScalar(-1, -1, -1));
			}

			if(showTrajectory)
			{
				trajectory.drawTrajectory(img);
			}

            CvFont font;
            cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, .5, .5, 0, 1, 8);
            cvRectangle(img, cvPoint(0, 0), cvPoint(img->width, 50), black, CV_FILLED, 8, 0);
            cvPutText(img, string, cvPoint(25, 25), &font, white);

            if(showForeground)
            {

                for(size_t i = 0; i < tld->detectorCascade->detectionResult->fgList->size(); i++)
                {
                    Rect r = tld->detectorCascade->detectionResult->fgList->at(i);
                    cvRectangle(img, r.tl(), r.br(), white, 1);
                }

            }


            if(showOutput)
            {
                gui->showImage(img);
                char key = gui->getKey();

                if(key == 'q') break;

                if(key == 'b')
                {

                    ForegroundDetector *fg = tld->detectorCascade->foregroundDetector;

                    if(fg->bgImg.empty())
开发者ID:lzx1413,项目名称:OpenTLD,代码行数:67,代码来源:Main.cpp

示例2: doWork


//.........这里部分代码省略.........
					);
				}*/

				if( showTrajectory )
				{
					CvPoint center = cvPoint( 
							tld->currBB->x + tld->currBB->width / 2,
							tld->currBB->y + tld->currBB->height / 2
					);
					cvLine( img,
							cvPoint( center.x - 2, center.y - 2 ),
							cvPoint( center.x + 2, center.y + 2 ),
							rectangleColor,
							2
					);
					cvLine( img,
							cvPoint( center.x - 2, center.y + 2),
							cvPoint( center.x + 2, center.y - 2),
							rectangleColor,
							2
					);
					trajectory.addPoint( center, rectangleColor );
				}
            }
			else if( showTrajectory )
			{
				trajectory.addPoint( cvPoint( -1, -1 ),
						cvScalar( -1, -1, -1 ) 
				);
			}

			if( showTrajectory )
			{
				trajectory.drawTrajectory( img );
			}

            CvFont font;
            cvInitFont( &font, CV_FONT_HERSHEY_SIMPLEX, .5, .5, 0, 1, 8 );
            // display a black bar at the top of the output window
            // for a better background to write on.
            cvRectangle( img,
            		cvPoint( 0, 0 ),
            		cvPoint( img->width, 50 ),
            		black,
            		CV_FILLED,
            		8,
            		0
            );
            cvPutText( img, string, cvPoint( 25, 25 ), &font, white );

            if( showForeground )
            {
                for( size_t i = 0;
                		i < tld->detectorCascade->detectionResult->fgList->size();
                		i++
                )
                {
                    Rect r = tld->detectorCascade->detectionResult->fgList->at( i );
                    cvRectangle( img, r.tl(), r.br(), white, 1 );
                }

            }


            if( showOutput )
            {
开发者ID:sdyx,项目名称:OpenTLD,代码行数:67,代码来源:Main_eye_almost_working.cpp


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