# Accuracy of polygon approximation

12 Ansichten (letzte 30 Tage)
Mohammad Abu Haifa am 19 Nov. 2021
Beantwortet: Kelly Kearney am 19 Nov. 2021
I have 2 matrices; one for the a data set (x,y), and the second one for the approximated shape of the points using polygon approximation techniques.
The size of the first one is 277*2 (green points) and the size of the second one is 5*2 (red line with five vertices).
I need to find the accuracy of the approximation such as R^2 value or any other parameter.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

John D'Errico am 19 Nov. 2021
R*2 is not remotely meaningful here, unless you find a way to intelligently extend it to this situation.
I would probably find the closest point on the curve for each data point. What is the distance to that curve, for each point. Now you might compute the sum of squares of those distances. Call that A. Finally, compute the sum of squares of the distances for each point to the mean of all of your data. Call that B.
Finally, compute the parameter
P = 1 - A/B
Note that P might be considered to be somewhat analogous to an R^2 parameter. It will be 1 when the polygon passes exactly through the points. It will be 0 for the simple polygon that lies exactly at the mean of your data, thus just a single point.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Mohammad Abu Haifa am 19 Nov. 2021
Great, thank you so much

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (2)

Matt J am 19 Nov. 2021
Bearbeitet: Matt J am 19 Nov. 2021
Perhaps the Dice Coefficient would be an appropriate metric. This would be a very easy calculation if the shapes are stored as polyshape objects:
DSC = 2*area(intersect(red,green))/(area(red)+area(green))
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Image Analyst am 19 Nov. 2021
Or, if you have the Image Processing Toolbox:
dice
Sørensen-Dice similarity coefficient for image segmentation
Syntax
Description
similarity = dice(BW1,BW2) computes the Sørensen-Dice similarity coefficient between binary images BW1 and BW2.
similarity = dice(L1,L2) computes the Dice index for each label in label images L1 and L2.
similarity = dice(C1,C2) computes the Dice index for each category in categorical images C1 and C2.

Melden Sie sich an, um zu kommentieren.

Kelly Kearney am 19 Nov. 2021
Other possible metrics commonly used to measure the error of a polygon simplification algorithm involve comparing the perimeter and/or area of the original and simplified polygons. For example, Matlab's reducem function (in the Mapping Toolbox) returns the difference between new and original perimeter length normalized by the original perimeter.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Elementary Polygons finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by