private bool IsBlink(Emgu.CV.Image <Gray, byte> eye, Emgu.CV.Image <Gray, byte> mouth)
        {
            if (mouth == null)
            {
                return(false);
            }
            Gray      eyeAvg;
            MCvScalar eyeSc;

            eye.AvgSdv(out eyeAvg, out eyeSc);

            Gray      mouthAvg;
            MCvScalar mouthSc;

            mouth.AvgSdv(out mouthAvg, out mouthSc);
            label1.Text = "Mouth: " + mouthAvg.Intensity.ToString();
            label2.Text = "Eyes:" + eyeAvg.Intensity.ToString();
            return(eyeAvg.Intensity > 20.0 && mouthAvg.Intensity < 10.0);
        }
示例#2
0
        public void Compute(FrameData data)
        {
            Rectangle rect = data.Mouth.rect;

            if (rect.Height != 0 && rect.Width != 0)
            {
                rect.X += data.MouthROI.X;
                rect.Y += data.MouthROI.Y;
                Emgu.CV.Image <Gray, byte> mouth = data.GrayFrame.GetSubRect(rect);
                mouth._ThresholdToZero(new Gray(100));
                mouth._SmoothGaussian(3);
                mouth._Erode(4);
                Gray      avg = new Gray();
                MCvScalar sdv = new MCvScalar();
                mouth.AvgSdv(out avg, out sdv);
                if (avg.Intensity < 150)
                {
                    gatherer.PushGesture(GestureGatherer.GestureType.MOUTH_OPENED, data.Epoch);
                }
            }
        }