annotate src/BayesianArrayStructure.h @ 52:13194a9dca77 tip

Added exporting of image and text data
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 17 Jul 2012 22:13:10 +0100
parents 032edf186a68
children
rev   line source
andrew@0 1 /*
andrew@0 2 * BayesianArrayStructure.h
andrew@0 3 * midiCannamReader
andrew@0 4 *
andrew@0 5 * Created by Andrew on 17/07/2011.
andrew@0 6 * Copyright 2011 QMUL. All rights reserved.
andrew@0 7 *
andrew@0 8 */
andrew@2 9 #ifndef BAYESIAN_ARRAY_STRUCTURE
andrew@2 10 #define BAYESIAN_ARRAY_STRUCTURE
andrew@2 11
andrew@0 12
andrew@0 13 #include "ofMain.h"
andrew@0 14 //#include "DynamicBayesianArray.h"
andrew@0 15 #include "DynamicVector.h"
andrew@0 16
andrew@0 17 class BayesianArrayStructure {
andrew@0 18
andrew@0 19 public:
andrew@0 20 // BayesianArrayStructure();
andrew@0 21 BayesianArrayStructure();
andrew@0 22 BayesianArrayStructure(int length);
andrew@0 23
andrew@0 24 void calculatePosterior();
andrew@0 25 void drawArrays();
andrew@0 26 void drawArraysRelativeToTimeframe(const double& startTimeMillis, const double& endTimeMillis);
andrew@0 27
andrew@0 28 void drawTempoArrays();
andrew@0 29
andrew@0 30 void resetSize(int length);
andrew@0 31 void resetArrays();
andrew@0 32 void simpleExample();
andrew@2 33 void setStartPlaying();
andrew@2 34 void zeroArrays();
andrew@0 35
andrew@0 36 double screenWidth;
andrew@0 37
andrew@0 38 void copyPriorToPosterior();
andrew@0 39 // DynamicBayesianArray bayesArray;
andrew@0 40
andrew@0 41 double lastEventTime;
andrew@2 42 double likelihoodNoise;
andrew@2 43 double speedLikelihoodNoise;
andrew@0 44
andrew@23 45 //DynamicVector tmpPrior;
andrew@2 46 DynamicVector tmpPosteriorForStorage;
andrew@0 47 DynamicVector prior;
andrew@0 48 DynamicVector posterior;
andrew@0 49 DynamicVector likelihood;
andrew@0 50
andrew@0 51 DynamicVector relativeSpeedPrior;
andrew@0 52 DynamicVector relativeSpeedLikelihood;
andrew@0 53 DynamicVector relativeSpeedPosterior;
andrew@0 54 DynamicVector acceleration;
andrew@0 55
andrew@2 56 double tmpBestEstimate;
andrew@2 57 void updateTmpBestEstimate(const double& timeDifference);
andrew@2 58
andrew@2 59 int updateCounter;
andrew@2 60
andrew@2 61 void setPositionDistributionScalar(double f);
andrew@2 62
andrew@0 63 void resetSpeedToOne();
andrew@2 64 void addGaussianNoiseToSpeedPosterior(const double& std_dev);
andrew@2 65 void addTriangularNoiseToSpeedPosterior(const double& std_dev);
andrew@0 66
andrew@0 67 double bestEstimate;
andrew@14 68 void updateBestEstimate(const double& timeDifference);
andrew@2 69 double lastBestEstimateUpdateTime;
andrew@9 70 double speedEstimate;
andrew@0 71
andrew@0 72 double speedDecayWidth, speedDecayAmount;
andrew@0 73 void decaySpeedDistribution(double timeDifference);
andrew@0 74
andrew@0 75 void resetSpeedSize(int length);
andrew@0 76 void setRelativeSpeedScalar(double f);
andrew@3 77 void setSpeedPrior(double f);
andrew@0 78 void calculateNewPriorOffset(const double& timeDifference);
andrew@0 79 void setNewDistributionOffsets(const double& newOffset);
andrew@0 80
andrew@9 81 void setLikelihoodToConstant();
andrew@9 82 void updateTempoLikelihood(const double& speedRatio, const double& matchFactor);
andrew@9 83 void updateTempoDistribution();
andrew@0 84
andrew@0 85 void calculateTempoUpdate();
andrew@0 86
andrew@0 87 void crossUpdateArrays(DynamicVector& position, DynamicVector& speed, double timeDifference);
andrew@4 88 void complexCrossUpdate(const double& timeDifferenceInPositionVectorUnits);
andrew@4 89 void translateByMaximumSpeed(const double& timeDifferenceInPositionVectorUnits);
andrew@4 90 double crossUpdateTimeThreshold;//time after which we do complex update of multiple speeds
andrew@0 91
andrew@3 92 double speedPriorValue;
andrew@14 93 int priorWidth;
andrew@14 94 bool* realTimeMode;
andrew@18 95 bool usingIntegratedTempoEstimate;
andrew@22 96 double relativeSpeedLikelihoodStdDev;
andrew@4 97
andrew@0 98 };
andrew@2 99 #endif