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; } } }
// 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); }
// 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); }
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; } } }