コード例 #1
0
        // On "Define motion regions" menu item selected
        private void defineMotionregionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (videoSourcePlayer.VideoSource != null)
            {
                Bitmap currentVideoFrame = videoSourcePlayer.GetCurrentVideoFrame( );

                if (currentVideoFrame != null)
                {
                    MotionRegionsForm form = new MotionRegionsForm( );
                    form.VideoFrame       = currentVideoFrame;
                    form.MotionRectangles = detector.MotionZones;

                    // show the dialog
                    if (form.ShowDialog(this) == DialogResult.OK)
                    {
                        Rectangle[] rects = form.MotionRectangles;

                        if (rects.Length == 0)
                        {
                            rects = null;
                        }

                        detector.MotionZones = rects;
                    }

                    return;
                }
            }

            MessageBox.Show("It is required to start video source and receive at least first video frame before setting motion zones.",
                            "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: xyicheng/Accord
        private void defineObjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (videoSourcePlayer.VideoSource != null)
            {
                Bitmap currentVideoFrame = videoSourcePlayer.GetCurrentVideoFrame();

                if (currentVideoFrame != null)
                {
                    MotionRegionsForm form = new MotionRegionsForm();
                    form.VideoFrame = currentVideoFrame;

                    // show the dialog
                    if (form.ShowDialog(this) == DialogResult.OK)
                    {
                        Rectangle[] rects = form.ObjectRectangles;

                        if (rects.Length == 0)
                            rects = null;

                        tracker.Reset();
                        tracker.SearchWindow = rects[0];
                        detecting = false;
                        tracking = true;
                    }

                    return;
                }
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: centrolutions/AForge.NET
        // On "Define motion regions" menu item selected
        private void defineMotionregionsToolStripMenuItem_Click( object sender, EventArgs e )
        {
            if ( videoSourcePlayer.VideoSource != null )
            {
                Bitmap currentVideoFrame = videoSourcePlayer.GetCurrentVideoFrame( );

                if ( currentVideoFrame != null )
                {
                    MotionRegionsForm form = new MotionRegionsForm( );
                    form.VideoFrame = currentVideoFrame;
                    form.MotionRectangles = detector.MotionZones;

                    // show the dialog
                    if ( form.ShowDialog( this ) == DialogResult.OK )
                    {
                        Rectangle[] rects = form.MotionRectangles;

                        if ( rects.Length == 0 )
                            rects = null;

                        detector.MotionZones = rects;
                    }

                    return;
                }
            }

            MessageBox.Show( "It is required to start video source and receive at least first video frame before setting motion zones.",
                "Message", MessageBoxButtons.OK, MessageBoxIcon.Information );
        }