uTrack linear motion tracker pseudocode

  • uTrack.m:
    • set up parameters
    • trackCloseGapKalmanSparse.m:
      • Input: read the input params and stored
      • Preamble:
        • read the coordinate data
        • calculate the nearest neighbor distance for each object
        • remove the empty start and end frames
      • Link frame-to-frame:
        sequence: link forward, time reverse, link backward, time reverse, link forward
        • linkFeaturesKalmanSparse.m:
          • Initilize input
          • Reserve Memory: allocate struct memory
          • Initial the first frame info for kalman initialize: stateVec, stateCor, noiseCor
            • first frame: kalmanInitialLinearMotion.m
            • others: use previous kalman info
          • Link frame by frame:
            • costMatLinearMotionLink2.m:
              • get Input
              • motion propagation
                • get the transfer func, 3 kind of potential TF for linear motion
                • For each objects in the 1st frame
                  • get previous kalman info
                  • compute new prediction
                  • store in new kalman info and will be use for next time
              • calculate the cost matrix as the distance between prediction and actual measurement in 2rd frame
              • then findout the minimum cost for 3 kind of TF
              • use the user pre-defined max search radius to filter out some big distance (maxSearchRadius can also be defined by using local density)
              • set all distance in CostMat > searchRadius to NaN and square the costMat as the upperLeft sub-matrix of the final costMat
              • add lifetime penalty
              • birth and death cost is set to 1.05 * CostMat.max
              • finally construct the overall costMat as:
                • costMat=[costMat death;birth lrblock];
              • set all NaN in the costMat to -5
            • use the LAP algorithm to find best solution
            • then get the link index info:
              • indx1c: linked objects index in frame1
              • indx2c: linked objects index in frame2
              • indx1u: in 1st frame but not in 2rd frame
              • indx1c.count = indx2c.count
              • indx1c.count + indx1u.count = total objects count in 1st frame
            • then update the trackedFeatureInfo, near neighbor distance, prevCost matrixes
              • all this three will be stored as [indx1c indx2c;indx1u x]
            • update the feature life time, add 1 for miss linked objects, add 2 for linked objects
            • calc the Kalman gain, get the best prediction and update the kalman info for next prediction to use
            • rearrange all the tracks in the sequence of the start frame number
            • store the tracks' each objects' [x, y, z=0, amplitude, dx, dy, dz, damp]
        • Reverse the frame sequence and repeat the process of link backward
          .
          .
          .
      • Post processing:
        • getTrackSEL: get each track's start time and end time (frame number)
        • filter out those track life time < user pre-defined
        • re-calc the nndistance

你可能感兴趣的:(uTrack linear motion tracker pseudocode)