Emgu CV EigenObjectRecognizer not working
===

I've tried to code a face recognition program and need some help from the community.
The code posted below compiled with no error but the recognizer seems to be not working?
Basically target.jpg contain a person crop out of the pic1.jpg(3 person inside) so the recognizer should be able to detect it more easily.

The code below run with no errors but all 3 person in pic1.jpg is boxed, and the GetEigenDistances for all 3 faces is 0. By right only the person in pic1.jpg(person in target.jpg) should be boxed.

Any idea on where have i gone wrong? Thanks in advance.

I'm using emgu cv 2.4 with c# 2010 express

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Emgu.CV;
    using Emgu.Util;
    using Emgu.CV.Structure;
    using Emgu.CV.UI;
    using Emgu.CV.CvEnum;
    
    
    namespace FaceReco
    {
        public partial class Form1 : Form
        {
            private HaarCascade haar;
            List<Image<Gray, byte>> trainingImages = new List<Image<Gray, byte>>();
            Image<Gray, byte> TrainedFace, UnknownFace = null;
            MCvFont font = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.5d, 0.5d);
    
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                // adjust path to find your XML file 
                haar = new HaarCascade("haarcascade_frontalface_alt_tree.xml");
    
                //Read an target image
                Image TargetImg = Image.FromFile(Environment.CurrentDirectory + "\\target\\target.jpg");
                Image<Bgr, byte> TargetFrame = new Image<Bgr, byte>(new Bitmap(TargetImg));
    
                //FACE DETECTION FOR TARGET FACE
                if (TargetImg != null)   // confirm that image is valid
                {
                    //convert the image to gray scale
                    Image<Gray, byte> grayframe = TargetFrame.Convert<Gray, byte>();
                    var faces = grayframe.DetectHaarCascade(haar, 1.4, 4,
                                            HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
                                            new Size(25, 25))[0];
                    foreach (var face in faces)
                    {
                        //add into training array
                        TrainedFace = TargetFrame.Copy(face.rect).Convert<Gray, byte>().Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                        trainingImages.Add(TrainedFace);
                        break;
                    }
                    TargetImageBox.Image = TrainedFace;
                }
    
    
                //Read an unknown image
                Image UnknownImg = Image.FromFile(Environment.CurrentDirectory + "\\img\\pic1.jpg");
                Image<Bgr, byte> UnknownFrame = new Image<Bgr, byte>(new Bitmap(UnknownImg));
    
                //FACE DETECTION PROCESS
                if (UnknownFrame != null)   // confirm that image is valid
                {
                    //convert the image to gray scale
                    Image<Gray, byte> grayframe = UnknownFrame.Convert<Gray, byte>();
    
                    //Detect faces from the gray-scale image and store into an array of type 'var',i.e 'MCvAvgComp[]'
                    var faces = grayframe.DetectHaarCascade(haar, 1.4, 4,
                                            HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
                                            new Size(25, 25))[0];
    
                    //draw a green rectangle on each detected face in image
                    foreach (var face in faces)
                    {
                        UnknownFace = UnknownFrame.Copy(face.rect).Convert<Gray, byte>().Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                        MCvTermCriteria termCrit = new MCvTermCriteria(16, 0.001);
                        //Eigen face recognizer
                        EigenObjectRecognizer recognizer = new EigenObjectRecognizer(trainingImages.ToArray(), ref termCrit);
                        
                        // if recognise face, draw green box
                        if (recognizer.Recognize(UnknownFace) != null)
                        {
                            UnknownFrame.Draw(face.rect, new Bgr(Color.Green), 3);
                        }
    
                        float f = recognizer.GetEigenDistances(UnknownFace)[0];
                        // display threshold
                        UnknownFrame.Draw(f.ToString("R"), ref font, new Point(face.rect.X - 3, face.rect.Y - 3), new Bgr(Color.Red));
                        
                    }
    
                    //Display the image
                    CamImageBox.Image = UnknownFrame;
                }
            }
        }
    }

