Ask Your Question

Revision history [back]

The code is this:

// Compare two images by getting the L2 error (square-root of sum of squared error). double getSimilarity(const Mat A, const Mat B) { if (A.rows > 0 && A.rows == B.rows && A.cols > 0 && A.cols == B.cols) { // Calculate the L2 relative error between the 2 images. double errorL2 = norm(A, B, CV_L2); // Convert to a reasonable scale, since L2 error is summed across all pixels of the image. double similarity = errorL2 / (double)(A.rows * A.cols); return similarity; } else { //cout << "WARNING: Images have a different size in 'getSimilarity()'." << endl; return 100000000.0; // Return a bad value } }

If L2 relative error is a Euclidean Distance, what is this "Predict" and "Confidence" in opencv FaceRecognizer class?

Regards, Marcelo

The code is this:

// Compare two images by getting the
  the L2 error (square-root of sum of
  of squared error). double
  error).
double getSimilarity(const Mat A, const Mat
  B) Mat B)
{
     if (A.rows > 0 && A.rows == B.rows && A.cols > 0 && A.cols == B.cols) {
         // Calculate the L2 relative error between the 2 images.
         double errorL2 = norm(A, B, CV_L2);
         // Convert to a reasonable scale, since L2 error is summed across
  across all pixels of the image.
         double similarity = errorL2 / (double)(A.rows * A.cols);
         return similarity;
     }
     else {
         //cout << "WARNING: Images have a different size in
  in 'getSimilarity()'." << endl;
         return 100000000.0;  // Return a bad value
      } }

} }

If L2 relative error is a Euclidean Distance, what is this "Predict" and "Confidence" in opencv FaceRecognizer class?

Regards, Marcelo