I trying to make a tracker inspired from the TLD, and can see that they calculates a Normalized correlation coefficient, of how much 2 vector of points correlates each other. i use matchTemplate to to calculate the coefficient, though the output doesn't make that much sense to me.. Some form of clarification would appreciated.
My calculation looks like this.
void normCrossCorrelation(Mat prevImg, Mat nextImg, vector<Point2f> pointsPrev, vector<Point2f> pointsNew, vector<uchar> status)
{
Mat rec0,rec1,res;
Size size(100,100);
for(int i = 0; i <= points1.size(); i++)
{
if(status[i] == 1)
{
cout << points1.size() << endl;
cout << "debug: " << i << endl;
getRectSubPix(imgI,size, pointsPrev[i],rec0);
getRectSubPix(imgJ,size, pointsNew[i],rec1);
matchTemplate(rec0, rec1, res, CV_TM_CCORR_NORMED); // res is the output..
cout << ((float *)(res.operator _IplImage().imageData))[0] << endl; // what does it say?.. how say something about it?
}
}
rec0.release();
rec1.release();
res.release();
}