Search code examples
image-processingopencvcomputer-visionshapescentroid

OpenCV Centroid of Irregular Shape


how do you get the centroid of an irregular shape using OpenCV?


Solution

  • I'd recommend looking at the cv::Moments (C++) or cvMoments (C) function.

    This StackOverflow thread gives some example code for a problem very similar to yours.

    This post goes into some of the theory related to finding object center-points.