Ask Your Question

Revision history [back]

Using the moments to calculate a blob's centroid is quite fast. I run a 30 fps system using this method

inline cv::Point calculateBlobCentroid(const std::vector<cv::Point> blob)
{
    cv::Moments mu = cv::moments(blob);
    cv::Point centroid = cv::Point (mu.m10/mu.m00 , mu.m01/mu.m00);

    return centroid;
}

Using the moments to calculate a blob's centroid is quite fast. I run a 30 fps system using this method

inline cv::Point calculateBlobCentroid(const std::vector<cv::Point> blob)
{
    cv::Moments mu = cv::moments(blob);
    cv::Point centroid = cv::Point (mu.m10/mu.m00 , mu.m01/mu.m00);

    return centroid;
}

In which the input blob comes from the findContours method.