convexityDefects[contour_List,args___]:=Map[convexityDefects[#,args]&,contour]convexityDefects[contour_List?MatrixQ,scale_:3,t_:2]:=Module[{convexHull,dist,defects,peaks,peakCount},convexHull=ConvexHullMesh[contour,ImageSizeTiny];dist=RegionDistance[RegionBoundary@convexHull][contour];defects=UnitStep[dist-t];peaks=PeakDetect[GaussianFilter[-dist,scale],0,Automatic,-t];peakCount=Count[Split[peaks],{1..}];If[First[peaks]Last[peaks]1,peakCount-=1];AssociationThread[{"Contour","ConvexHull","Distance","Defects","Peaks","Teeth"},{contour,convexHull,dist,defects,peaks,peakCount}]]