Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all, I have my face recognition project. I face this problem with EmguCv 4.4.0 in C#: when I send the recognizer type "EMGU.CV.EigenFaceRecognizer" it works normally when loading the array of images, likewise when I use "EMGU.CV.FisherFaceRecognizer" but it does not perform the prediction and always gives me 0 in the distance; when I try to do the same with the recognizer "EMGU.CV.LBPHFaceRecognizer" it throws exception. Anybody who knows how to solve it ?


<pre lang="C#">

<pre>
                    switch (Recognizer_Type)
                    {
                        case ("EMGU.CV.LBPHFaceRecognizer"):
                            recognizer = new LBPHFaceRecognizer(1, 8, 8, 8, 100);//50
                            break;
                        //case ("EMGU.CV.FisherFaceRecognizer"):
                        //    recognizer = new FisherFaceRecognizer(0, 3500);//4000
                        //    break;
                        case ("EMGU.CV.EigenFaceRecognizer"):
                        default:
                            recognizer = new EigenFaceRecognizer(80, double.PositiveInfinity);
                            break;
                    }
                    //Image<Gray, byte>[] images = trainingImages.ToArray();
                      recognizer.Train(new VectorOfMat(trainingImages.ToArray()), new VectorOfInt(Names_List_ID.ToArray()));

                    return true;
                }
                else return false;
            }
            catch (Exception ex)
            {
                
                Error = ex.ToString();
                return false;
            }


What I have tried:

I tried to pass the array of my images as Image<Gray, byte> but it doesn't work and I keep getting exception:
<pre>Emgu.CV.Util.CvException: OpenCV: 0 <= _rowRange.start && _rowRange.start <= _rowRange.end && _rowRange.end <= m.rows
   en Emgu.CV.CvInvoke.CvErrorHandler(Int32 status, IntPtr funcName, IntPtr errMsg, IntPtr fileName, Int32 line, IntPtr userData)
   en Emgu.CV.Face.FaceInvoke.cveFaceRecognizerTrain(IntPtr recognizer, IntPtr images, IntPtr labels)
   en Emgu.CV.Face.FaceRecognizer.Train(IInputArray images, IInputArray labels)
Posted
Updated 2-Oct-22 17:09pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900