Skip to main content
. 2021 Sep 29;21(19):6525. doi: 10.3390/s21196525
Algorithm 2 Extraction of fingertips and fingers
Input: The palm center M0 and contour point set mContour
Output: The mFingertips and mFingers
Begin
Step1: Initialize the sets of candSet, mFingertips and mFingers;
  Step2: Calculate the average distance Ravg from M0 to all the points in mContour;
   Step3: Add those points to candSet, if their distances from M0 greater than or equal to Ravg;
   Step4: For each of the elements in candSet, compute its distance from M0. Then find the one corresponding to the largest distance and move it to both mFingertips and mFingers, and move all the rest points that are connected with it in the candSet to mFingers;
   Step5: Go to Step4 and repeat until candSet is empty;
   Step6: The fingertips and fingers are obtained in mFingertips and mFingers.
End