Centroid of a estimated polygon

2 views (last 30 days)
Avinash Kumar
Avinash Kumar on 4 May 2015
I have created a polygon using estimate geometry. I need to find the center/centroid of the polygon. I am using the below code to create the polygon.
if true
codematchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
[tform, inlierBoxPoints, inlierScenePoints] = estimateGeometricTransform(matchedBoxPoints, matchedScenePoints, 'affine');
boxPolygon = [1, 1;size(boxImage, 2), 1;size(boxImage, 2), size(boxImage, 1);1, size(boxImage, 1);1, 1];
newBoxPolygon = transformPointsForward(tform, boxPolygon);
end
I need the centroid of the newBoxPolygon. Please help me how to do it.

Answers (0)

Categories

Find more on Elementary Polygons in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!