Open fist and fist detection

I tried to follow the algorithm, but it does not work. I can’t understand what the problem is. Can someone help me?

Where can I find / find examples of gesture recognition passed from Kinect using OpenCV?

Image<Gray, Byte> dest = new Image<Gray, Byte>(this.bitmap.Width, this.bitmap.Height);

CvInvoke.cvThreshold(src, dest, 220, 300, Emgu.CV.CvEnum.THRESH.CV_THRESH_BINARY);
Bitmap nem1 = new Bitmap(dest.Bitmap);
this.bitmap = nem1;

Graphics g = Graphics.FromImage(this.bitmap);

using (MemStorage storage = new MemStorage()) //allocate storage for contour approximation
{
    for (Contour<Point> contours = dest.FindContours(); 
        contours != null; 
        contours = contours.HNext)
    {
        g.DrawRectangle(new Pen(new SolidBrush(Color.Green)),contours.BoundingRectangle);

        IntPtr seq = CvInvoke.cvConvexHull2(contours,storage.Ptr, Emgu.CV.CvEnum.ORIENTATION.CV_CLOCKWISE, 0);
        IntPtr defects = CvInvoke.cvConvexityDefects(contours, seq, storage);
        Seq<Point> tr= contours.GetConvexHull(Emgu.CV.CvEnum.ORIENTATION.CV_CLOCKWISE);

        Seq<Emgu.CV.Structure.MCvConvexityDefect> te = contours.GetConvexityDefacts(storage, Emgu.CV.CvEnum.ORIENTATION.CV_CLOCKWISE);
        g.DrawRectangle(new Pen(new SolidBrush(Color.Green)), tr.BoundingRectangle);
    }
}
+3
source share
1 answer

Without any graphic data, this is difficult to help (I also do not have the proper equipment). Anyway, I offer you two things:

  • since this is a graphical procedure, debug anything, or show some intermediate step (threshold, contours, bulge)
  • switch to a simpler approach. For instance:
    • apply the threshold value (as a result, you get a map of your cards 0/1)
    • for each row, counting 0/1 transitions
    • : .. 7, .

, : -)

0

Source: https://habr.com/ru/post/1787901/


All Articles