In this post, we will see how to resolve How to find coordinate of contour centroid in C#
Question:I am doing image processing so that I am finding contours in the image. What I need is the centroid pixel number of the found contour in the image. To find the pixel number I am using the code given below. After finding the pixel number I want to show it in the text boxes as x and y coordinates. But the code is not working. Please help me. What is wrong?
Best Answer:To find the centroid of a shape you need to split it into many triangles first.
Then for each triangle with vertices A, B, C you do the summation weighted by the area of the triangle just as so
If you have better answer, please add a comment about this, thank you!