2013-05-09 59 views
0

我正在開發一個帶有emguCV的C#應用​​程序,我是emguCV的新手。我在互聯網上看過這個例子。如何使用EigenObjectRecognizer訓練圖像

Image<Gray, Byte>[] trainingImages = new Image<Gray,Byte>[5]; 
     trainingImages[0] = new Image<Gray, byte>("brad.jpg"); 
     trainingImages[1] = new Image<Gray, byte>("david.jpg"); 
     trainingImages[2] = new Image<Gray, byte>("foof.jpg"); 
     trainingImages[3] = new Image<Gray, byte>("irfan.jpg"); 
     trainingImages[4] = new Image<Gray, byte>("joel.jpg"); 
String[] labels = new String[] { "Brad", "David", "Foof", "Irfan" , "Joel"} 
    MCvTermCriteria termCrit = new MCvTermCriteria(16, 0.001); 

    EigenObjectRecognizer recognizer = new EigenObjectRecognizer(
     trainingImages, 
     labels, 
     5000, 
     ref termCrit); 
     Image<Gray,Byte> testImage = new Image<Gray,Byte>("brad_test.jpg"); 

    String label = recognizer.Recognize(testImage); 
    Console.Write(label); 

我需要知道的是如何訓練所有圖像?

+0

http://stackoverflow.com/questions/2837523/using-eigenobjectrecognizer – 2013-10-01 13:29:58

回答

0
recognizer.Recognize(testImage) RETURN EigenObjectRecognizer.RecognitionResult 

所以你可以嘗試:

EigenObjectRecognizer.RecognitionResult helo = recognizer.Recognize(result); 

Console.Write(helo.lable); 
+0

helo.lable或helo.label的可能重複? – 2015-04-29 03:20:53

相關問題