000
16.01.2009, 17:21 Uhr
filth
|
Hallo zusammen,
ich habe ein Problem und komme dem nicht auf die Spur. Es gibt vereinzelt Assertion Failures. Vielleicht sieht jemand von euch den Fehler?
Der erste Aufruf:
C++: |
vector<int> inputVector;
/** hier wird der Vector gefüllt. Die Länge varriert. *//
myGestureMashine.getDTWScore(inputVector);
|
Die entsprechende Methode:
C++: |
// returns the DTW Score int GestureMashine::getDTWScore(vector<int> &inputPattern) { DTW myDTW; int bestScore = 100000000; int patternNr = -1;
// check all elements for (int i = 0; i < matchPatternVector.size(); i++) { cout << "*********************************************** \n"; cout << "Now checking Vector Index " << i << endl;
int nextDTWValue = myDTW.getMatchingScore(matchPatternVector.at(i), inputPattern); if(nextDTWValue < bestScore) { bestScore = nextDTWValue; patternNr = i; } }
cout << "Best fit ----> Pattern Nr: " << patternNr << " with an Score of " << bestScore << endl;
return 0; }
|
Und der letzte Teil: DTW.cpp
C++: |
int DTW::getMatchingScore(vector<int> &matchPattern, vector<int> &inputPattern) {
cout << "Entered Matching Score .. ---------------------" << endl;
int zeilen = matchPattern.size(); int spalten = inputPattern.size();
vector< vector<int> > array2(zeilen, vector<int>(spalten,0)); // now fill the matrix. number of noise values in input vektor will be returned int resize = buildArray(matchPattern, inputPattern, array2);
cout << "Array resize value: " << resize << endl;
// calculate new amount of rows without noise spalten = spalten - resize;
// resize matrix array2.resize(zeilen, vector<int>(spalten,0));
cout << "successfully resized... " << endl;
//printArray(zeilen, spalten, array2); // start in bottom right corner of array return travelArray(matchPattern, inputPattern, array2, zeilen-1, spalten-1, 30, 0); }
|
C++: |
int travelArray(vector<int> &matchPattern, vector<int> &inputPattern, vector< vector<int> > &array2, int zeile, int spalte, int limit, int summeVorher) { int currentValue = array2[zeile][spalte];
... ... ... }
|
Im Fehlerfall kommt es bis zum ersten Befehl in travelArray. Anscheinend fliege ich da über die Vektorgrenze drüber. Aber warum?
Hier noch die matchPatterns:
Code: |
//-------Pattern 1-------- //------------------------ vector<int> matchPattern1; matchPattern1.push_back(0); matchPattern1.push_back(0); matchPattern1.push_back(0); matchPattern1.push_back(0); matchPattern1.push_back(0); matchPattern1.push_back(270); matchPattern1.push_back(270); matchPattern1.push_back(270); matchPattern1.push_back(270); matchPattern1.push_back(270); matchPattern1.push_back(180); matchPattern1.push_back(180); matchPattern1.push_back(180); matchPattern1.push_back(180); matchPattern1.push_back(180);
//-------Pattern 2-------- //------------------------ vector<int> matchPattern2; matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0); matchPattern2.push_back(0);
//-------Pattern 3-------- //------------------------ vector<int> matchPattern3; matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180); matchPattern3.push_back(180);
//-------Pattern 4-------- //------------------------ vector<int> matchPattern4; matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270); matchPattern4.push_back(270);
matchPatternVector.push_back(matchPattern1); matchPatternVector.push_back(matchPattern2); matchPatternVector.push_back(matchPattern3); matchPatternVector.push_back(matchPattern4);
|
Dieser Post wurde am 16.01.2009 um 17:26 Uhr von filth editiert. |