Exemple #1
0
        //ROI definition is complete so tell the camera. we first scale the ROI units to the cameras current ROI
        private void roi_KeyDown(object sender, KeyEventArgs e)
        {
            if (_isDown)
            {
                Console.WriteLine("DragFinishedMouseHandler _isDown");
                _isDown     = false;
                _isDragging = false;
                //              return;
            }

            RoiSizes[(int)rectSides.left]   = (float)Math.Round(((Canvas.GetLeft(roi))) * scaleX);
            RoiSizes[(int)rectSides.top]    = (float)Math.Round((float)((Canvas.GetTop(roi))) * scaleY);
            RoiSizes[(int)rectSides.width]  = (float)Math.Round(roi.Width * scaleX);
            RoiSizes[(int)rectSides.height] = (float)Math.Round(roi.Height * scaleY);
            Mouse.OverrideCursor            = Cursors.Wait;

            cam.SetFeature(Feature.Roi, RoiSizes);

            Adorner[] toRemoveArray = aLayer.GetAdorners(roi);
            if (toRemoveArray != null)
            {
                aLayer.Remove(toRemoveArray[0]);
            }
            roi.Visibility = Visibility.Hidden;
            top.Text       = RoiSizes[(int)rectSides.top].ToString();
            left.Text      = RoiSizes[(int)rectSides.left].ToString();
            width.Text     = RoiSizes[(int)rectSides.width].ToString();
            height.Text    = RoiSizes[(int)rectSides.height].ToString();
            cam.StartCamera();
            Mouse.OverrideCursor = null;
            e.Handled            = true;
        }
Exemple #2
0
        private void FrameRateValue_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            bool bStopped = false;

            if (!cam.FeatureSupportsFlag((int)Feature.FrameRate, FEATURE_FLAG_SETTABLE_WHILE_STREAMING))
            {
                cam.StopCamera();
                bStopped = true;
            }
            float[] parms = new float[1];
            parms[0] = (float)Math.Round(Double.Parse(FrameRateSet.Text));
            cam.SetFeature(Feature.FrameRate, parms);
            if (bStopped)
            {
                cam.StartCamera();
            }
        }