Using EigenObjectRecognizer

一世执手 提交于 2019-11-29 10:42:47

I made some practice and found that when it does not found it returns empty string. Changing value 5000 to 1000 it gives more close value but ıf you are usıng web cam your photo for testing and in database must be almost same .

Well, I don't know Emgu Cv, but I think what Robert Harvey says is right. You have to train your neural network. Also, neural networks will always return a result, no matter what. If the result is wrong, it means you haven't trained your network enough.

TruongCong Pham
recognizer.Recognize(testImage) RETURN EigenObjectRecognizer.RecognitionResult

so you can try:

EigenObjectRecognizer.RecognitionResult helo = recognizer.Recognize(result);
Console.Write(helo.lable);

You could overload the Recognize function of Emgu.CV.EigenObjectRecognizer like:

public String Recognize(Image<Gray, Byte> image, out float distance)
      {
          int index;
          float eigenDistance;
          String label;
          FindMostSimilarObject(image, out index, out eigenDistance, out label);
          distance = eigenDistance;
          return (_eigenDistanceThreshold <= 0 || eigenDistance < _eigenDistanceThreshold) ? _labels[index] : String.Empty;
      }

Idea constructed on Overload Snippet from Codeproject

and in this way receive a running last derived distance like

float last_distance =0;
label = recognizer.Recognize(testImage, out last_distance);

This would give you a better idea of the value to put in

MCvTermCriteria termCrit = new MCvTermCriteria(trainingImages.count, 0.001);

EigenObjectRecognizer recognizer = new EigenObjectRecognizer(
                       trainingImages.ToArray(),
                       labels.ToArray(),
                       <<good max val derived from last_distance>>,
                       ref termCrit);

via simply piping it to a label and having a look at the range of values.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!