convexityDefects[contour_,t_:2]:=Module[{convexHull,nearest,dist,defects,dents,peaks,peakCount,shape},convexHull=ConvexHullMesh[contour];dist=RegionDistance[RegionBoundary@convexHull][contour];defects=UnitStep[dist-t];peaks=PeakDetect[dist,2,Automatic,t];peakCount=Count[Split[peaks],{1..}];shape=Switch[peakCount,0|1,"Simple",2,"Pair",_,"Complex"];AssociationThread[{"Contour","ConvexHull","Distance","Defects","Peaks","Shape"},{contour,convexHull,dist,defects,peaks,shape}]]