Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>as you know I'm the creator of the code you are using.</p> <p>One of my reader find sometimes an issue similar to yours, commented my post and suggest to remove the using Memstorage and put it globally then clear the storage inside <code>DrawAndComputeFingersNum()</code> function</p> <pre><code>MemStorage storage = new MemStorage() //Global Declaration private void DrawAndComputeFingersNum() { int fingerNum = 0; #region hull drawing //for (int i = 0; i &lt; filteredHull.Total; i++) //{ // PointF hullPoint = new PointF((float)filteredHull[i].X, // (float)filteredHull[i].Y); // CircleF hullCircle = new CircleF(hullPoint, 4); // image.Draw(hullCircle, new Bgr(Color.Aquamarine), 2); //} #endregion #region defects drawing defects = new Seq&lt;MCvConvexityDefect&gt;(storage); for (int i = 0; i &lt; defects.Total; i++) { PointF startPoint = new PointF((float)defectArray[i].StartPoint.X, (float)defectArray[i].StartPoint.Y); PointF depthPoint = new PointF((float)defectArray[i].DepthPoint.X, (float)defectArray[i].DepthPoint.Y); PointF endPoint = new PointF((float)defectArray[i].EndPoint.X, (float)defectArray[i].EndPoint.Y); LineSegment2D startDepthLine = new LineSegment2D(defectArray[i].StartPoint, defectArray[i].DepthPoint); LineSegment2D depthEndLine = new LineSegment2D(defectArray[i].DepthPoint, defectArray[i].EndPoint); CircleF startCircle = new CircleF(startPoint, 5f); CircleF depthCircle = new CircleF(depthPoint, 5f); CircleF endCircle = new CircleF(endPoint, 5f); MCvFont angga = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_SCRIPT_COMPLEX, 0.5, 0.5); // image.Draw(defectArray[i].StartPoint.X.ToString() + " , " + defectArray[i].StartPoint.Y.ToString(), ref angga, new Point(defectArray[i].StartPoint.X, defectArray[i].StartPoint.Y), new Bgr(Color.Red)); image.Draw(defectArray[i].StartPoint.X.ToString() + " , " + defectArray[i].StartPoint.Y.ToString() + " , " + i.ToString(), ref angga, new Point(defectArray[i].StartPoint.X, defectArray[i].StartPoint.Y), new Bgr(Color.Red)); //Custom heuristic based on some experiment, double check it before use if ((startCircle.Center.Y &lt; box.center.Y || depthCircle.Center.Y &lt; box.center.Y) &amp;&amp; (startCircle.Center.Y &lt; depthCircle.Center.Y) &amp;&amp; (Math.Sqrt(Math.Pow(startCircle.Center.X - depthCircle.Center.X, 2) + Math.Pow(startCircle.Center.Y - depthCircle.Center.Y, 2)) &gt; box.size.Height / 6.5)) { fingerNum++; //image.Draw(startDepthLine, new Bgr(Color.Blue), 2); //image.Draw(depthEndLine, new Bgr(Color.Magenta), 2); } image.Draw(startCircle, new Bgr(Color.Red), 2); image.Draw(depthCircle, new Bgr(Color.Yellow), 5); //image.Draw(endCircle, new Bgr(Color.DarkBlue), 4); } #endregion MCvFont font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_DUPLEX, 5d, 5d); image.Draw(fingerNum.ToString(), ref font, new Point(50, 150), new Bgr(Color.White)); hand.fingerChangedCompute = fingerNum; storage.clear(); // clear storage allocation } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload