void TLD::selectObject(const Mat &img, Rect *bb)
{
    //Delete old object
    detectorCascade->release();



    detectorCascade->objWidth = bb->width;
    detectorCascade->objHeight = bb->height;

    //Init detector cascade
    detectorCascade->init();

    currImg = img;
    if(currBB)
    {
        delete currBB;
        currBB = NULL;
    }
    currBB = tldCopyRect(bb);
    currConf = 1;
    valid = true;

   initialLearning();

}
Пример #2
0
void TLD::selectObject(const Mat &img, Rect *bb)
{
    //Delete old object
    detectorCascade->release();

    detectorCascade->objWidth = bb->width;
    detectorCascade->objHeight = bb->height;

    //Init detector cascade
    detectorCascade->init();

#ifdef USE_HTLD
	if(hTLDMaster->getNumOfObjects() > 0)
		hTLDMaster->destroyTLDObject(tldObjId);
	FAST_DET_INIT_PARAMS* fdi = detectorCascade->createFastDetInitStr();
	FAST_TR_INIT_PARAMS* fti  = medianFlowTracker->createFastTrInitStr();
	tldObjId                  = hTLDMaster->createTLDObject(fti, fdi);
	free((void*)fdi);
#endif

    currImg = img;
    if(currBB)
    {
        delete currBB;
        currBB = NULL;
    }
    currBB = tldCopyRect(bb);
    currConf = 1;
    valid = true;

    initialLearning();

}
Пример #3
0
    void TLD::selectObject(const Mat& img, Rect* bb) {
        if (!tracker)
        { return; }

        if (!rng) {
            std::random_device rd;
            std::shared_ptr<std::mt19937> g(new std::mt19937(rd()));
            g->seed((unsigned long)seed);
            rng = g;
        }

        rng->seed((unsigned long)seed);

        Mat grayFrame;
        cvtColor(img, grayFrame, CV_BGR2GRAY);

        // initialize the image dimensions once
        if (!hasImageDimensions) {
            detectorCascade->imgWidth = grayFrame.cols;
            detectorCascade->imgHeight = grayFrame.rows;
            detectorCascade->imgWidthStep = static_cast<int>(grayFrame.step);
        }

        runTracker = true;
        //Delete old object
        detectorCascade->release();

        detectorCascade->objWidth = bb->width;
        detectorCascade->objHeight = bb->height;

        if (bb->height < detectorCascade->minSize)
        { detectorCascade->minSize = bb->height; }

        if (bb->width < detectorCascade->minSize)
        { detectorCascade->minSize = bb->width; }

        //Init detector cascade
        detectorCascade->init(rng);
        tracker->reinit(img, *bb);

        currImg = grayFrame;
        deleteCurrentBB();
        currBB = tldCopyRect(bb);
        currConf = 1;
        valid = true;

        initialLearning();
    }
Пример #4
0
void TLD::selectObject(Mat img, Rect * bb) {
	//Delete old object
	detectorCascade->release();

	detectorCascade->objWidth = bb->width;
	detectorCascade->objHeight = bb->height;

	//Init detector cascade
	detectorCascade->init();

	currImg = img;
	currBB = bb;
	currConf = 1;
	valid = true;

	initialLearning();

}