Beispiel #1
0
        public HandDetectorState DetectHand(Bitmap source)
        {
            ImageFrame = new Image <Bgr, byte>(source);

            var skinDetector = new HsvSkinDetector();

            var skin = skinDetector.DetectSkin(ImageFrame, hsv_min, hsv_max);

            ExtractContourAndHull(ImageFrame, skin);

            var result = DrawAndComputeFingersNum();

            startIndex     = null;
            endIndex       = null;
            depthIndex     = null;
            defects        = null;
            currentContour = null;
            var handDetectorState =
                new HandDetectorState()
            {
                Coordinates = result, IsActive = IsDrawing(), CountedCoordinates = MainWindow.CountMousePosition(ImageFrame, result)
            };

            return(handDetectorState);
        }
        private void VideoTimerTick(object sender, EventArgs e)
        {
            HsvSkinDetector detector     = new HsvSkinDetector();
            var             currentFrame = _capture.QueryFrame();
            var             skin         = detector.DetectSkin(currentFrame.ToImage <Bgr, Byte>(), _hsvMin, _hsvMax);

            Image.Source = ToBitmapSource(skin);
        }