// constructor
        public AvatarSimilarity(AvatarContainer selfIn, AvatarContainer teacherIn, BodyWeightsType bodyNrIn, double penaltyIn, bool activateKalmanIn, double kalmanQIn, double kalmanRIn)
        {
            // assign
            ///////////////////////////////////////////////////////////////////////////////////
            self           = selfIn;
            teacher        = teacherIn;
            bodyNr         = bodyNrIn;
            penalty        = penaltyIn;
            kalmanQ        = kalmanQIn;
            kalmanR        = kalmanRIn;
            stickNumber    = 0;
            activateKalman = activateKalmanIn;

            // initialize
            ///////////////////////////////////////////////////////////////////////////////////

            // define all stick names (should be actually moved to a parameter file)
            //stickNames = SimilarityConst.StickNames;
            stickNumber = SimilarityConst.StickNumber;

            // Initialize adaptive weighting
            stickWeight = Enumerable.Repeat(1.0, stickNumber).ToList();

            // weight of each stick
            stickWeightBody = SimilarityConst.GetStickWeights(bodyNr);


            // correct each default stick weight
            stickWeightAdapt = Enumerable.Repeat(1.0, stickNumber).ToList();

            // calculate final stick weight
            stickWeightTotal = 0.0;
            for (int i = 0; i < stickNumber; i++)
            {
                stickWeightTotal += stickWeightBody[i] * stickWeightAdapt[i];
            }

            // set default similarity each stick
            similarityStick = Enumerable.Repeat(0.0, stickNumber).ToList();

            // generate kalman filters
            kalmanFilter = new List <KalmanFilter>(new KalmanFilter[stickNumber]);
            for (int i = 0; i < stickNumber; i++)
            {
                kalmanFilter[i] = new KalmanFilter(kalmanQ, kalmanR);
                kalmanFilter[i].Reset(1.0);
            }


            // total score
            totalScore = 0.0;
        }
示例#2
0
        public void UpdatePart(BodyWeightsType bodyNrIn, List <double> weights_score)
        {
            // update a color for a specific body part bodyNrIn. Sets grad color to "1" and blue to "0"
            List <double> weights = SimilarityConst.GetStickWeights(bodyNrIn);

            for (var i = 0; i < weights.Count; i++)
            {
                if (weights[i] == 0)
                {
                    SetColor(stickparts[i], neutralColor);
                }
                if (weights[i] == 1)
                {
                    set_grad_color(stickparts[i], incorrectColor, correctColor, weights_score[i]);
                }
            }
        }