Revision 24 readGestures.cpp

readGestures.cpp (revision 24)
45 45
		}
46 46
	}
47 47
	cout << "Overall Accuracy: " << float(correct) / totalNum << endl;
48
	cout << "\n-------\nSaving Gestures" << endl;
49
	recognizer.saveGestureSet("tempSet.gestr");
48 50

  
51
	RecognitionHelper loaded;
52
	cout << "\n-------\nLoading Gestures" << endl;
53
	loaded.loadGestureSet("tempSet.gestr");
54

  
55
	for (int i = 1; i <= 5; ++i)
56
	{
57
		string gestName = gidPre + boost::lexical_cast<std::string>(i);
58
		vector<GestureSample> testSamples = readGestureSet(gestName, testUID);
59
		for (size_t sampleNum = 0; sampleNum < testSamples.size(); sampleNum++)
60
		{
61
			totalNum++;
62
			string classifiedAs = loaded.classify(testSamples[sampleNum]);
63
			cout << "Gesture: " << i << " Sample: " << sampleNum << "\tClassified as: " << classifiedAs;
64
			vector<long double > probs = loaded.probabilities();
65
			for(size_t p = 0; p < probs.size(); p++)
66
				cout << "\t(" << probs[p] << ")";
67
			cout << endl;
68
			if (strcmp(classifiedAs.c_str(), gestName.c_str()) == 0)
69
				correct++;
70
		}
71
	}
72

  
73

  
49 74
}

Also available in: Unified diff