title: Comparing detected face with array of existing faces with opencv in android
body: <p>I'm making face recognition app via opencv. I can detect faces and I have few faces in resources.
  I'm stack on this place:</p>
  
  <pre><code>// These vectors hold the images and corresponding labels.
  vector&lt;Mat&gt; images;
  vector&lt;int&gt; labels;
  
  Mat testSample = images[images.size() - 1];
      int testLabel = labels[labels.size() - 1];
      images.pop_back();
      labels.pop_back();
  
  
      Ptr&lt;FaceRecognizer&gt; model = createEigenFaceRecognizer();
      model-&gt;train(images, labels);
  
      string result_message = format("Predicted class = %d / Actual class = %d.", predictedLabel, testLabel);
      cout &lt;&lt; result_message &lt;&lt; endl;
      // Here is how to get the eigenvalues of this Eigenfaces model:
      Mat eigenvalues = model-&gt;getMat("eigenvalues");
      // And we can do the same to display the Eigenvectors (read Eigenfaces):
      Mat W = model-&gt;getMat("eigenvectors");
      // Get the sample mean from the training data
      Mat mean = model-&gt;getMat("mean");
  </code></pre>
  
  <p>Can please, somebody explain me, where exactly I should put my detected faces and where I compare them with database? I have to put all of them inside this <code>vector&lt;Mat&gt; images;</code> or what?
  How also works field <code>vector&lt;int&gt; labels;</code>? what I should write in there?
  Would be great if somebody can write to me simple example. Detected faces I'm passing as parameter from Java class.</p>
  
  <p>Thank you!</p>