检测开拳并闭拳

时间:2011-01-26 08:53:11

标签: c# kinect gesture-recognition

我尝试过遵循算法,但它不起作用。我无法确定问题是什么。 有人能帮助我吗?

Where can I learn/find examples of gesture recognitions streamed 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);
    }
}

1 个答案:

答案 0 :(得分:0)

没有一些图形数据,很难提供帮助(我也没有适当的硬件)。无论如何,我建议你做两件事:

  • 因为它是一个图形化程序,调试一切保存或显示任何中间步骤(阈值,轮廓,凸包)
  • 改为更简单的方法。例如:
    1. 应用一个阈值(产生一张0/1的手图)
    2. 每行
    3. ,计数0/1过渡
    4. 测试最大转换次数:即,如果它高于7,则指针打开

让我知道它是否有效: - )