# Polygon Shape Comparison

Comparing the similarity of two simple rasterized polygons

Metric 1: Jaccard index. Represent similarity through overlap of sets. Sets are represented by counting the pixels of two rasterized polygons onto an HTML canvas.

Metric 2: Added weighting to the Jaccard index. Smaller dissimilarities are exaggerated, and union pixels not present in B count worse than pixels not present in A.

where $w_0, w_1 \in [0, 1]$

In my use case polygons are hand drawn annotations, I’d rather accept a slightly too large annotation than too small. This non-uniform weighting encourages B to be smaller than A.