Commit 433d6c19 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #1645 from krshrimali:patch-1

parents 206959cd c3a2b425
...@@ -75,6 +75,10 @@ int main(int argc,char** argv){ ...@@ -75,6 +75,10 @@ int main(int argc,char** argv){
resize(img,img,Size(460,460), 0, 0, INTER_LINEAR_EXACT); resize(img,img,Size(460,460), 0, 0, INTER_LINEAR_EXACT);
facemark->getFaces(img,faces); facemark->getFaces(img,faces);
vector< vector<Point2f> > shapes; vector< vector<Point2f> > shapes;
// Check if faces detected or not
// Helps in proper exception handling when writing images to the directories.
if(faces.size() != 0) {
if(facemark->fit(img,faces,shapes)) if(facemark->fit(img,faces,shapes))
{ {
for( size_t i = 0; i < faces.size(); i++ ) for( size_t i = 0; i < faces.size(); i++ )
...@@ -89,5 +93,8 @@ int main(int argc,char** argv){ ...@@ -89,5 +93,8 @@ int main(int argc,char** argv){
imshow("Detected_shape",img); imshow("Detected_shape",img);
waitKey(0); waitKey(0);
} }
} else {
cout << "Faces not detected." << endl;
}
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment