accessing elements in vector of vector of points
I tried people counting using HOG descriptor. When the program is compiled, the last part of the program for people counting shows errors.
HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
namedWindow("people detector", 1);
int required,incoming,outgoing;
required=0;
incoming=0;
outgoing=0;
for(;;)
{
vector<Rect> found, found_filtered;
double t = (double)getTickCount();
hog.detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2);
t = (double)getTickCount() - t;
printf("tdetection time = %gms\n", t*1000./cv::getTickFrequency());
size_t i, j;
for( i = 0; i < found.size(); i++ )
{
Rect r = found[i];
for( j = 0; j < found.size(); j++ )
if( j != i && (r & found[j]) == r)
break;
if( j == found.size() )
found_filtered.push_back(r);
}
Point pt,ptretrieve;
vector<vector<Point>>rectcount;
for(i=0;i<found_filtered.size();i++)
{
Rect r = found_filtered[i];
pt.x=r.tl().x+(r.br().x-r.tl().x)/2;
pt.y=r.tl().y+(r.br().y-r.tl().y)/2;
for(ii=0;ii<found_filtered.size();ii++)
{
ptretrieve=rectcount[ii].back;
if(pt.x-ptretrieve.x<=3&&pt.y-ptretrieve.y<=3)
{
required=ii;
break;
}
}
ptretrieve=rectcount[required].back;
if(pt.x==150&&ptretrieve.x==151)
incoming++;
if(pt.x==150&&ptretrieve.x==149)
ougoing++;
rectcount[required].push_back(pt);
}
please reply what is wrong because the last 6 lines show error