本文整理汇总了C++中Patches::getRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Patches::getRect方法的具体用法?C++ Patches::getRect怎么用?C++ Patches::getRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patches
的用法示例。
在下文中一共展示了Patches::getRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: track3
void track3(ImageSource::InputDevice input, int numBaseClassifier, float overlap, float searchFactor, char* resultDir, Rect initBB, char* source = NULL)
{
unsigned char *curFrame=NULL;
int key;
//choose the image source
ImageSource *imageSequenceSource;
switch (input)
{
case ImageSource::AVI:
imageSequenceSource = new ImageSourceAVIFile(source);
break;
case ImageSource::DIRECTORY:
imageSequenceSource = new ImageSourceDir(source);
break;
case ImageSource::USB:
imageSequenceSource = new ImageSourceUSBCam();
break;
default:
return;
}
ImageHandler* imageSequence = new ImageHandler (imageSequenceSource);
imageSequence->getImage();
imageSequence->viewImage ("Tracking...", false);
trackingRect=initBB;
curFrame = imageSequence->getGrayImage ();
ImageRepresentation* curFrameRep = new ImageRepresentation(curFrame, imageSequence->getImageSize());
Rect wholeImage;
wholeImage = imageSequence->getImageSize();
// Pula o inicio do video
for(int t = 0; t < 60; t++, imageSequence->getImage());
IplImage *image;
image = imageSequence->getIplImage();
//cvWaitKey(0);
printf ("init tracker...");
Classifier* tracker;
tracker = new Classifier(image, trackingRect);
printf (" done.\n");
Size trackingRectSize;
trackingRectSize = trackingRect;
printf ("start tracking (stop by pressing any key)...\n\n");
// Inicializa o detector
Detector* detector;
detector = new Detector(tracker->getClassifier());
Rect trackedPatch = trackingRect;
Rect validROI;
validROI.upper = validROI.left = 0;
validROI.height = image->height;
validROI.width = image->width;
key=(char)-1;
while (key==(char)-1)
{
imageSequence->getImage();
image = imageSequence->getIplImage();
curFrame = imageSequence->getGrayImage ();
if (curFrame == NULL) break;
//calculate the patches within the search region
Patches *trackingPatches;
Rect searchRegion;
searchRegion = getTrackingROI(searchFactor, trackedPatch, validROI);
trackingPatches = new PatchesRegularScan(searchRegion, wholeImage, trackingRectSize, overlap);
curFrameRep->setNewImageAndROI(curFrame, searchRegion);
detector->classifySmooth(curFrameRep, trackingPatches);
trackedPatch = trackingPatches->getRect(detector->getPatchIdxOfBestDetection());
if (detector->getNumDetections() <= 0){printf("Lost...\n");break;}
// Treina o classificador
tracker->train(image,trackedPatch);
//.........这里部分代码省略.........