Ejemplo n.º 1
0
 private void SensorColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
 {
     using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
     {
         //System.Threading.Thread.Sleep(50);
         if (colorFrame != null)
         {
             Bitmap b = convertFromColorFrame(colorFrame);
             frameHeight = b.Height;
             frameWidth = b.Width;
             currentFrame = new Image<Bgr, Byte>(b);
             removeFace(b);
             if (currentFrame != null)
             {
                 skinDetector = new YCrCbSkinDetector();
                 Image<Gray, Byte> skin = skinDetector.DetectSkin(currentFrame, YCrCb_min, YCrCb_max);
                 Contour<Point> bContour = biggestContour(skin);
                 if (bContour != null)
                 {
                     box = bContour.GetMinAreaRect();
                     currentFrame.Draw(new CircleF(new PointF(box.center.X, box.center.Y), 3), new Bgr(200, 125, 75), 2);
                     currentFrame.Draw(bContour, new Bgr(System.Drawing.Color.LimeGreen), 2);
                     extractContourInfo(bContour, 5, currentFrame);
                     findFingerTips(bContour, 5);
                     drawTips(tipPts, foldPts);
                 }
                 imageBoxSkin.Image = skin;
                 imageBoxFrameGrabber.Image = currentFrame;
             }
         }
     }
 }
        private void procesarImagen()
        {
            //Image<Gray, Byte> skin = new Image<Gray, byte>(imagen.Width, imagen.Height);
               // detector.Process(imagen,skin);

            skinDetector = new YCrCbSkinDetector();

            Image<Gray, Byte> skin = skinDetector.DetectSkin(imagen, YCrCb_min, YCrCb_max);

            observedImageVector =  ObservedImageFunctions.ExtractFeatures(skin,imagen);
               hypothesisImageVector = HypothesisImageFunctions.createFirstHypothesis(imagen2);

            //imgCaja.Image = skin;

            imgCaja.Refresh();
            imgCaja2.Refresh();
        }
Ejemplo n.º 3
0
        void FrameGrabber(object sender, EventArgs e)
        {
            currentFrame = grabber.QueryFrame();
            System.Threading.Thread.Sleep(50);
            if (currentFrame != null)
            {
                currentFrameCopy = currentFrame.Copy();

                // Uncomment if using opencv adaptive skin detector
                //Image<Gray,Byte> skin = new Image<Gray,byte>(currentFrameCopy.Width,currentFrameCopy.Height);
                //detector.Process(currentFrameCopy, skin);

                skinDetector = new YCrCbSkinDetector();
                Image<Gray, Byte> skin = skinDetector.DetectSkin(currentFrameCopy,YCrCb_min,YCrCb_max);
                /*List<Contour<Point>> handContours = findHandContour(skin);
                if (handContours != null)
                {
                    for (int i = 0; i < handContours.Count(); i++)
                    {
                        if (handContours.ElementAt(i) != null)
                        {
                            extractContourInfo(handContours.ElementAt(i), 5, currentFrame); // find the COG and angle to horizontal of the contour
                            findFingerTips(handContours.ElementAt(i), 5); // detect the fingertips positions in the contour
                            //nameFingers(cogPt, contourAxisAngle, fingerTips);
                        }
                    }
                }*/
                ExtractContourAndHull(skin);
                DrawAndComputeFingersNum();

                imageBoxSkin.Image = skin;
                imageBoxFrameGrabber.Image = currentFrame;
            }
        }
Ejemplo n.º 4
0
        void FrameGrabber(object sender, EventArgs e)
        {
            currentFrame = grabber.QueryFrame();
            if (currentFrame != null)
            {
                currentFrameCopy = currentFrame.Copy();

                // Uncomment if using opencv adaptive skin detector
                //Image<Gray,Byte> skin = new Image<Gray,byte>(currentFrameCopy.Width,currentFrameCopy.Height);
                //detector.Process(currentFrameCopy, skin);

                skinDetector = new YCrCbSkinDetector();

                Image<Gray, Byte> skin = skinDetector.DetectSkin(currentFrameCopy,YCrCb_min,YCrCb_max);

                ExtractContourAndHull(skin);

                DrawAndComputeFingersNum();

                imageBoxSkin.Image = skin;
                imageBoxFrameGrabber.Image = currentFrame;
            }
        }
 void processFrameAndUpdateGUI(object sender, EventArgs e)
 {
     try
     {
         imgOriginal = capwebcam.RetrieveBgrFrame();
         currentFrame = capwebcam.QueryFrame();
         if (imgOriginal == null) return;
         skinDetector = new YCrCbSkinDetector();
         Image<Gray, Byte> skin = skinDetector.DetectSkin(currentFrame, YCrCb_min, YCrCb_max);
         imgProcessed = skin.SmoothGaussian(9);
         tbImageName.Text = i.ToString() + ".jpg";
         ExtractContourAndHull(imgProcessed);
         if (defects != null)
             DrawAndComputeFingersNum();
         ibOriginal.Image = currentFrame;
     }
     catch (Exception ex)
     {
         tbGesture.Text="Exception found!"+ ex ;
     }
 }
 void processFrameAndUpdateGUI(object sender, EventArgs e)
 {
     imgOriginal = capwebcam.RetrieveBgrFrame();
       currentFrame = capwebcam.QueryFrame();
       if (imgOriginal == null) return;
       skinDetector = new YCrCbSkinDetector();
       Image<Gray, Byte> skin = skinDetector.DetectSkin(currentFrame, YCrCb_min, YCrCb_max);
       imgProcessed = skin.SmoothGaussian(9);
       ExtractContourAndHull(imgProcessed);
       if(defects != null)
        DrawAndComputeFingersNum();
       ibOriginal.Image = currentFrame;
 }
        void FrameGrabber(object sender, EventArgs e)
        {
            currentFrame = grabber.QueryFrame();
            if (currentFrame != null)
            {
                currentFrameCopy = currentFrame.Copy();

                skinDetector = new YCrCbSkinDetector();

                Image<Gray, Byte> skin = skinDetector.DetectSkin(currentFrameCopy,YCrCb_min,YCrCb_max);

                ExtractContourAndHull(skin);

                DrawAndComputeFingersNum();

                imageBoxSkin.Image = skin;
                imageBoxFrameGrabber.Image = currentFrame;
            }
        }