1 | initial version |
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;
}
2 | No.2 Revision |
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.