IpPairVec matches;
blah blah other definitions
for (unsigned int i = 0; i < matches.size(); ++i)
{
drawPoint(img1,matches[i].first);
drawPoint(img2,matches[i].second);
const int & w = img1->width;
//.........etc etc etc
}
std::cout<< "Matches: " << matches.size();
//This returns a number after every iteration which is continuous.
//I am able to redirect this to a file or display on console till now.
// I need help in storing the numbers returned after say 10 or 15 iterations in another vector or array (as the value of matches.size() keeps changing after every iteration of the program.And if the sum of the numbers stored exceed a certain value then do something or else do something else hehehe
// finding the sum of matches 30-08-2011
int sum ;
//Sum the std::vector
if (sum > 5 )
{
nameFile = fopen("rf.txt", "a");
fprintf(nameFile, "%s_%i\n",personalNum.c_str(),sum);
fclose(nameFile);
}
else
{
string unknownFaces ;
char dstr[256];
nameFile = fopen("UnknownPerson.txt", "a");
fprintf(nameFile, "%s_\n","UnknownPerson");
fclose(nameFile);
ifstream intrudNo ( "intruindex.txt", std::ios::in);
Please help me with storing the value of the matches vector and summing it .I have tried std::accumulate which did not work or redirecting to a text file then reading back from that which is not an elegant way to do that .
A couple of lines of appropriate code will be much much appreciated and save me a lot of time and effort as i am a beginner in C++ and have jumped into the deep end of the pool by trying to learn/implement open CV.