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