void FaceFinder::Find(Mat* img) { WindowsIterator * windowsIterator=new WindowsIterator(img); vector<WindowInformation> faceWindows; Window *window; vector<float> scores; while ((window=windowsIterator->GetNextWindow())!=NULL){ scores=classifier->Classify(window->GetWindowImage()); if (GetWindowLabel(scores)==1) { faceWindows.push_back(*(window->GetWindowInformation())); } } CleanFaceWindows(&faceWindows); Drawer *drawer=new Drawer(); drawer->DrawFaceWindows(img,&faceWindows); }
vector<string> FaceFinder::Find(Mat* img,string fileName) { WindowsIterator * windowsIterator; if (maxInitialSize==-1) { windowsIterator=new WindowsIterator(img); } else { windowsIterator=new WindowsIterator(img,maxInitialSize); } windowsIterator->SetWindowSize(classifier->GetInputGeometry()); vector<WindowInformation> faceWindows; Window *window; vector<float> scores; while ((window=windowsIterator->GetNextWindow())!=NULL){ scores=classifier->Classify(window->GetWindowImage()); if (GetWindowLabel(scores)==1) { window->GetWindowInformation()->SetScore(scores[1]); faceWindows.push_back(*(window->GetWindowInformation())); } } CleanFaceWindows(&faceWindows); Drawer *drawer=new Drawer(); drawer->DrawFaceWindows(img,&faceWindows); vector<string> resultTexts; for (unsigned int i=0;i<faceWindows.size();i++) { std::ostringstream myStringStream; myStringStream<<fileName<<" "; myStringStream<<faceWindows[i].GetScore()<<" "; myStringStream<<faceWindows[i].GetOriginalStartingPixel().col<<" "; myStringStream<<faceWindows[i].GetOriginalStartingPixel().row<<" "; myStringStream<<faceWindows[i].GetOriginalStartingPixel().col+faceWindows[i].GetOriginalSize().width<<" "; myStringStream<<faceWindows[i].GetOriginalStartingPixel().row+faceWindows[i].GetOriginalSize().height; string myString(myStringStream.str()); resultTexts.push_back(myString); } return resultTexts; }