private void btnSnap_Click(object sender, RoutedEventArgs e)
        {
            if (is_playing)
            {
                mediaPlayer.Pause();
            }
            last_selection_prop = selection.prop_rect;
            reduction_factor    = Math.Sqrt(10000 / (((selection.prop_rect.X - selection.prop_rect.x) * video_natural_dimensions.Width) * ((selection.prop_rect.Y - selection.prop_rect.y) * video_natural_dimensions.Height)));
            reduction_factor    = Math.Min(reduction_factor, 1);
            var xx = (int)((selection.prop_rect.X - selection.prop_rect.x) * video_natural_dimensions.Width);
            var yy = (int)((selection.prop_rect.Y - selection.prop_rect.y) * video_natural_dimensions.Height);

            //lvList.Items.Insert(0, "Selection natural size: " + xx + "x" + yy);
            //lvList.Items.Insert(0, "Selection reduced size: " + (int)(xx*reduction_factor) + "x" + (int)(yy* reduction_factor) + " = " + xx*yy*reduction_factor*reduction_factor);


            PreviewTemplate();
            btnCount.IsEnabled = true;
            btnTest.IsEnabled  = true;
            if (is_playing)
            {
                mediaPlayer.Play();
            }
        }
 public void PropFromAbs()
 {
     prop_rect = abs_rect / new Size(canvas.ActualWidth, canvas.ActualHeight);
 }
 public void AbsFromProp()
 {
     abs_rect = prop_rect * new Size(canvas.ActualWidth, canvas.ActualHeight);
 }