Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            //zum Beispiel:
            proto = new Prototype();
            proto.VideoFrameReady += new VideoFrameReadyDelegate(proto_VideoFrameReady);
            proto.AddComponent<PostureRecognition>();
            proto.AddComponent<GestureRecognition>();
            proto.AddComponent<ButtonRecognition>();

            ButtonRecognition br = proto.GetComponent<ButtonRecognition>();
            /*br.AddButton(new Triangle(0.5f, 0, 2, 0, 0.5f, 2, -0.5f, 0, 2));
            br.AddButton(new Triangle(0.5f, 1, 2, 0.5f, 1, 3, 0.5f, -1, 3));
            br.AddButton(new Triangle(0.5f, 1, 2, 0.5f, -1, 2, 0.5f, -1, 3));
            br.AddButton(new Triangle(-0.5f, 1, 2, -0.5f, 1, 3, -0.5f, -1, 3));
            br.AddButton(new Triangle(-0.5f, 1, 2, -0.5f, -1, 2, -0.5f, -1, 3));*/
            //br.AddSavedButtons("TestButtons.but");

            // Get notification if gesture was recognized by posture recognition component:
            // 1. Get posture recognition component
            PostureRecognition pr = proto.GetComponent<PostureRecognition>();
            // 2. Define which postures we want to listen for
            //some postures are hard coded...
            String[] postures = {"BothArmsUpPosture","BothHandsTogetherPosture","XPosture"};
            pr.setRecognizablePostures(postures, false);
            //...some are not
            String[] xmlPostures = { "TPosture", "LouderVolumePosture", "LowerVolumePosture" };
            pr.setRecognizablePostures(xmlPostures, true);
            // 3. Add new delegate with link to own method to the "postureRecognized" event
            // NOTE: By specifying the recognizable postures in the above step, we tell the system
            // to raise the "postureRecognized" Event only if any of the specified postures are recognized.
            pr.PostureRecognized += new PostureRecognizedDelegate(pr_postureRecognized);

            GestureRecognition gr = proto.GetComponent<GestureRecognition>();
            String[] gestures = { "ZoomOutGesture", "LeftHandSwipeRightGesture", "ZoomInGesture", "RightHandSwipeLeftGesture", "PushGesture" };
            gr.setRecognizableGestures(gestures, false);
            gr.GestureRecognized += new GestureRecognizedDelegate(gr_gestureRecognized);

            VideoImage.Width = 640;
            VideoImage.Height = 480;

            this.WindowState = WindowState.Minimized;
        }
Beispiel #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            proto = new Prototype(RequireKinect:false);
            proto.AddComponent<Recorder>();
            rec = proto.GetComponent<Recorder>();

            LogArrivedAnimation = new ColorAnimation(Colors.Red, Colors.White, new Duration(TimeSpan.FromMilliseconds(500)));
            txtLog.Background = new SolidColorBrush(Colors.Transparent);
        }