Ask Your Question

vsyoussef's profile - activity

2017-12-12 09:46:00 -0500 received badge  Popular Question (source)
2014-10-09 08:50:50 -0500 asked a question help please

I want to make a button that detect and capture image frame from web cam show it into imagebox and save it to training set file. I am using C# & EmguCV

2014-09-18 10:50:53 -0500 asked a question help with EmguCV face recognition

I have found several examples using OpenCV and Emgu CV to detect faces from still photos. I have successfully implemented face detection using C# with Emgu CV but I am trying to find examples of how to detect a face and then recognize that face in another picture. Any help would be much appreciated.

2014-09-17 10:42:30 -0500 commented question face recognition

I make a search about lbp face reco, but i didnt find any thing like that in c# I found it in c++ i found someone who is using files instead of database, my problem for now is: who to use the code above which detect and make recognition, with my code which can only detect? i want to make a button called recognize so that when i click it the research for the matching start, comparing the input image with the images in Access database?

2014-09-16 17:50:22 -0500 asked a question face recognition

this is the part of code that we should use here the extracted faces are stocked in a folder

private void button2_Click(object sender, System.EventArgs e)
    {
        try
        {
            //Trained face counter
            ContTrain = ContTrain + 1;

            //Get a gray frame from capture device
            gray = grabber.QueryGrayFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);

            //Face Detector
            MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(
            face,
            1.2,
            10,
            Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
            new Size(20, 20));

            //Action for each element detected
            foreach (MCvAvgComp f in facesDetected[0])
            {
                TrainedFace = currentFrame.Copy(f.rect).Convert<Gray, byte>();
                break;
            }

            //resize face detected image for force to compare the same size with the 
            //test image with cubic interpolation type method
            TrainedFace = result.Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
            trainingImages.Add(TrainedFace);
            labels.Add(textBox1.Text);

            //Show face added in gray scale
            imageBox1.Image = TrainedFace;

            //Write the number of triained faces in a file text for further load
            File.WriteAllText(Application.StartupPath + "/TrainedFaces/TrainedLabels.txt", trainingImages.ToArray().Length.ToString() + "%");

            //Write the labels of triained faces in a file text for further load
            for (int i = 1; i < trainingImages.ToArray().Length + 1; i++)
            {
                trainingImages.ToArray()[i - 1].Save(Application.StartupPath + "/TrainedFaces/face" + i + ".bmp");
                File.AppendAllText(Application.StartupPath + "/TrainedFaces/TrainedLabels.txt", labels.ToArray()[i - 1] + "%");
            }

            MessageBox.Show(textBox1.Text + "´s face detected and added :)", "Training OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        catch
        {
            MessageBox.Show("Enable the face detection first", "Training Fail", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
    }


    void FrameGrabber(object sender, EventArgs e)
    {
        label3.Text = "0";
        //label4.Text = "";
        NamePersons.Add("");


        //Get the current frame form capture device
        currentFrame = grabber.QueryFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);

                //Convert it to Grayscale
                gray = currentFrame.Convert<Gray, Byte>();

                //Face Detector
                MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(
              face,
              1.2,
              10,
              Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
              new Size(20, 20));

                //Action for each element detected
                foreach (MCvAvgComp f in facesDetected[0])
                {
                    t = t + 1;
                    result = currentFrame.Copy(f.rect).Convert<Gray, byte>().Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                    //draw the face detected in the 0th (gray) channel with blue color
                    currentFrame.Draw(f.rect, new Bgr(Color.Red), 2);


                    if (trainingImages.ToArray().Length != 0)
                    {
                        //TermCriteria for face recognition with numbers of trained images like maxIteration
                    MCvTermCriteria termCrit = new MCvTermCriteria(ContTrain, 0.001);

                    //Eigen face recognizer
                    EigenObjectRecognizer recognizer = new EigenObjectRecognizer(
                       trainingImages.ToArray(),
                       labels.ToArray(),
                       3000,
                       ref termCrit);

                    name = recognizer.Recognize(result);

                        //Draw the label for each face detected and recognized
                    currentFrame.Draw(name, ref font, new Point(f.rect.X - 2, f.rect.Y - 2), new Bgr(Color.LightGreen));

                    }

                        NamePersons[t-1] = name;
                        NamePersons.Add("");


                    //Set the number of faces detected on the scene
                    label3.Text = facesDetected[0].Length.ToString();

                    /*
                    //Set the region of interest on the faces

                    gray.ROI = f.rect;
                    MCvAvgComp[][] eyesDetected = gray.DetectHaarCascade(
                       eye,
                       1.1,
                       10,
                       Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
                       new Size(20, 20));
                    gray.ROI = Rectangle.Empty;

                    foreach (MCvAvgComp ey in eyesDetected[0])
                    {
                        Rectangle eyeRect = ey.rect;
                        eyeRect.Offset(f.rect.X, f.rect.Y);
                        currentFrame.Draw(eyeRect, new Bgr(Color.Blue), 2);
                    }
                     */

                }
                    t = 0;

                    //Names concatenation of persons recognized ...
(more)
2014-09-16 17:46:02 -0500 commented question about EigenObjectRecognizer and access database

it is not access who is going to do the matching access is just the place where i put the extracted faces with their information

did you check my code

2014-09-14 13:16:01 -0500 asked a question about EigenObjectRecognizer and access database

hi THERE I WANT TO KNOW HOW TO USE THIS EMGUCV'S CLASS EigenObjectRecognizer IN .NET C# TO FIND THE MATCHING RESULT ON MS ACCESS DATABASE this is the code if you can take a look on it and give me your help http://www.4shared.com/rar/HZFhMVuUba/camCapture.html

2014-09-12 11:08:27 -0500 asked a question Can't add reference to project

Hi I am working on a C# project on Visual Studio 2012 around EmguCV to build a face detection/recognition app. I m working on windows 8.1 64bit.

my problem is that i am unable to add a reference to any of opencv's dlls, every time i try to add it via VS i'm told that the dll "could not be added".

i tried two different versions of opencv with no avail, i also tried to 'fix' the dll via TlbImp.exe which didn't work.

any solutions???