face_landmark_detection_dlib_of.cpp
double cal_dist_diff(std::vector<cv::Point2f> curPoints, std::vector<cv::Point2f> lastPoints) {
    double variance = 0.0;
    double sum = 0.0;
    std::vector<double> diffs;
    if (curPoints.size() == lastPoints.size()) {
        for (int i = 0; i < curPoints.size(); i++) {
            double diff = std::sqrt(std::pow(curPoints[i].x - lastPoints[i].x, 2.0) + std::pow(curPoints[i].y - lastPoints[i].y, 2.0));
            sum += diff;
            diffs.push_back(diff);
        }
        double mean = sum / diffs.size();
        for (int i = 0; i < curPoints.size(); i++) {
            variance += std::pow(diffs[i] - mean, 2);
        }
        return variance / diffs.size();
    }
    return variance;
}
// calculate the variance between the current points and last points
calculate the variance between the current points and last points
calculate the variance between the current points and last points
double cal_dist_diff(std::vector<cv::Point2f> curPoints, std::vector<cv::Point2f> lastPoints) {
    double variance = 0.0;
    double sum = 0.0;
    std::vector<double> diffs;
    if (curPoints.size() == lastPoints.size()) {
        for (int i = 0; i < curPoints.size(); i++) {
            double diff = std::sqrt(std::pow(curPoints[i].x - lastPoints[i].x, 2.0) + std::pow(curPoints[i].y - lastPoints[i].y, 2.0));
            sum += diff;
            diffs.push_back(diff);
        }
        double mean = sum / diffs.size();
        for (int i = 0; i < curPoints.size(); i++) {
            variance += std::pow(diffs[i] - mean, 2);
        }
        return variance / diffs.size();
    }
    return variance;
}
double cal_dist_diff ( std :: vector < cv :: Point2f > curPoints , std :: vector < cv :: Point2f > lastPoints ) { double variance = 0.0 ; double sum = 0.0 ; std :: vector < double > diffs ; if ( curPoints . size ( ) == lastPoints . size ( ) ) { for ( int i = 0 ; i < curPoints . size ( ) ; i ++ ) { double diff = std :: sqrt ( std :: pow ( curPoints [ i ] . x - lastPoints [ i ] . x , 2.0 ) + std :: pow ( curPoints [ i ] . y - lastPoints [ i ] . y , 2.0 ) ) ; sum += diff ; diffs . push_back ( diff ) ; } double mean = sum / diffs . size ( ) ; for ( int i = 0 ; i < curPoints . size ( ) ; i ++ ) { variance += std :: pow ( diffs [ i ] - mean , 2 ) ; } return variance / diffs . size ( ) ; } return variance ; }
calculate the variance between the current points and last points
calculate the variance between the current points and last points