# HG changeset patch # User Andrew N Robertson # Date 1322239893 0 # Node ID ff1702b723f32a3cb88bc410fbd2daec4e918be8 # Parent 67ed2c7320bae9ba94d5ba7bc5c851db23c54ef9 limited loaded files to 10000 frames so that testing is easier. Great on classical, rubbish on rock and pop diff -r 67ed2c7320ba -r ff1702b723f3 src/TimeWarp.cpp --- a/src/TimeWarp.cpp Wed Nov 23 22:41:56 2011 +0000 +++ b/src/TimeWarp.cpp Fri Nov 25 16:51:33 2011 +0000 @@ -36,7 +36,7 @@ //diagonalPenalty = 1;//favours diagonal over other paths //diagonalPenalty = 2;//penalises diagonal so all path gradients equal weighting - useDotProduct = false;//true - dot, false , Euclidean dist + useDotProduct = false;////true - dot, falseo: Euclidean dist } // destructor @@ -612,7 +612,6 @@ if (pickMinimumFlag){ endIndex = getMinimumIndexOfColumnFromMatrix((int)(*alignmentMatrix).size()-1, alignmentMatrix); //i.e. get index of minimum in the last column - } v.push_back(endIndex);//and the y size printf("CALUCLATE MINIMUM PUSHED BACK %i\n", endIndex); diff -r 67ed2c7320ba -r ff1702b723f3 src/testApp.cpp --- a/src/testApp.cpp Wed Nov 23 22:41:56 2011 +0000 +++ b/src/testApp.cpp Fri Nov 25 16:51:33 2011 +0000 @@ -43,6 +43,8 @@ void testApp::setup(){ + doCausalAlignment = true; + ofBackground(255,255,255); // 2 output channels, @@ -154,18 +156,19 @@ dontDoJunkAlignment(); - calculateForwardsAlignment(); - - doPathBugCheck(); - - tw.copyForwardsPathToBackwardsPath(); + if (doCausalAlignment) + calculateCausalAlignment(); + else{ + //tw.calculateAlignmentMatrix(tw.firstChromaEnergyMatrix, tw.secondChromaEnergyMatrix, &tw.alignmentMeasureMatrix); + tw.calculateAlignmentMatrix(tw.chromaMatrix, tw.secondMatrix, &tw.alignmentMeasureMatrix); + tw.calculateMinimumAlignmentPath(&tw.alignmentMeasureMatrix, &tw.backwardsAlignmentPath, false); + } backwardsAlignmentIndex = tw.backwardsAlignmentPath[0].size()-1; printf("index size is %i\n", backwardsAlignmentIndex); -// tw.calculateAlignmentMatrix(tw.firstChromaEnergyMatrix, tw.secondChromaEnergyMatrix, &tw.alignmentMeasureMatrix); -// tw.calculateMinimumAlignmentPath(&tw.alignmentMeasureMatrix, &tw.backwardsAlignmentPath, false); + setConversionRatio(); @@ -181,6 +184,12 @@ } +void testApp::calculateCausalAlignment(){ + calculateForwardsAlignment(); + doPathBugCheck(); + tw.copyForwardsPathToBackwardsPath(); +} + void testApp::setConversionRatio(){ conversionFactor = (int) round(tw.firstEnergyVector.size() / tw.chromaMatrix.size()); @@ -232,7 +241,7 @@ tw.forwardsAlignmentPath.clear(); //causal part - int hopsize = 400; + int hopsize = 200; int frameSize = 800; int startFrameY = 0; int startFrameX = 0; diff -r 67ed2c7320ba -r ff1702b723f3 src/testApp.h --- a/src/testApp.h Wed Nov 23 22:41:56 2011 +0000 +++ b/src/testApp.h Fri Nov 25 16:51:33 2011 +0000 @@ -209,6 +209,8 @@ float conversionFactor; void dontDoJunkAlignment(); + void calculateCausalAlignment(); + bool doCausalAlignment; }; #endif diff -r 67ed2c7320ba -r ff1702b723f3 src/timeWarp.cpp --- a/src/timeWarp.cpp Wed Nov 23 22:41:56 2011 +0000 +++ b/src/timeWarp.cpp Fri Nov 25 16:51:33 2011 +0000 @@ -36,7 +36,7 @@ //diagonalPenalty = 1;//favours diagonal over other paths //diagonalPenalty = 2;//penalises diagonal so all path gradients equal weighting - useDotProduct = false;//true - dot, false , Euclidean dist + useDotProduct = false;////true - dot, falseo: Euclidean dist } // destructor @@ -612,7 +612,6 @@ if (pickMinimumFlag){ endIndex = getMinimumIndexOfColumnFromMatrix((int)(*alignmentMatrix).size()-1, alignmentMatrix); //i.e. get index of minimum in the last column - } v.push_back(endIndex);//and the y size printf("CALUCLATE MINIMUM PUSHED BACK %i\n", endIndex);