Mercurial > hg > multitrack-audio-matcher
diff bayesianArraySrc/BayesianArrayStructure.cpp @ 3:5e188c0035b6
checking the offsets of the arrays
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Wed, 01 Feb 2012 16:05:26 +0000 |
parents | c4f9e49226eb |
children | 45b5cf9be377 |
line wrap: on
line diff
--- a/bayesianArraySrc/BayesianArrayStructure.cpp Tue Jan 31 21:34:19 2012 +0000 +++ b/bayesianArraySrc/BayesianArrayStructure.cpp Wed Feb 01 16:05:26 2012 +0000 @@ -30,7 +30,7 @@ tmpBestEstimate = 0; crossUpdateTimeThreshold = 60; - priorWidth = 50; + priorWidth = 20; } @@ -136,6 +136,7 @@ lastEventTime = 0; bestEstimate = 0; lastBestEstimateUpdateTime = 0; + if (*realTimeMode) lastBestEstimateUpdateTime = ofGetElapsedTimeMillis(); //cannot just be zero - offline bug @@ -157,9 +158,12 @@ setNewDistributionOffsets(0); int zeroIndex = posterior.getRealTermsAsIndex(0); + printf("ZERO INDEX %i\n", zeroIndex); - posterior.addGaussianShape(zeroIndex, 500, 1); - // posterior.addToIndex(0, 1); + posterior.addGaussianShapeFromRealTime(0, 500, 1);//one way to add at x msec + posterior.addGaussianShape(posterior.getRealTermsAsIndex(10), 50, 1);//alternative way + + //posterior.addToIndex(0, 1); likelihood.addConstant(1); updateCounter = 0; @@ -168,6 +172,8 @@ printf("bayes reset arrays - best estimate %f\n", lastBestEstimateUpdateTime); setSpeedPrior(speedPriorValue); + relativeSpeedPosterior.copyFromDynamicVector(relativeSpeedPrior); + } @@ -199,6 +205,8 @@ void BayesianArrayStructure::updateBestEstimate(const double& timeDifference){ // double timeDiff = ofGetElapsedTimeMillis() - lastEventTime;// + double tmp = bestEstimate; + printf("post offest %i\n", posterior.offset); double timeDiff = timeDifference; @@ -217,6 +225,8 @@ speedEstimate = relativeSpeedPosterior.getIndexInRealTerms(speedEstimateIndex); bestEstimate = posterior.getIndexInRealTerms(posterior.MAPestimate) + timeDiff*speedEstimate; + printf("best estimate update from %f to %f; time diff %f MAP %i = %f ms speed %f\n", tmp, bestEstimate, timeDiff, + posterior.MAPestimate, posterior.getIndexInRealTerms(posterior.MAPestimate), speedEstimate); } void BayesianArrayStructure::calculatePosterior(){