Пример #1
0
        void ResetSettings()
        {
            if (_ptGreyCamera.DefaultSettings())
            {
                Gain    = DEFAULT_GAIN;
                Shutter = DEFAULT_SHUTTER_TIME;
                WBred   = DEFAULT_WB_RED;
                WBblue  = DEFAULT_WB_BLUE;

                _ptGreyCamera.StartVideo();
            }
            else
            {
                MessageBox.Show("Failed to restore camera settings", "Camera Error");
            }
        }
Пример #2
0
        void ConnectCameraDoWork(object sender, DoWorkEventArgs e)
        {
            _statusVM.Busy++;
            DateTime timestamp = DateTime.Now;
            var      sts       = new StatusMessage {
                Timestamp = timestamp, Message = "Trying to connect to camera..."
            };

            _statusVM.Messages.Add(sts);
            _timestamps.Push(timestamp);

            _ptGreyImageQueue = new ConcurrentQueue <PtGreyCameraImage>();
            _ptGreyCamera     = new PtGreyCamera();
            long   width, height;
            string message;

            if (_ptGreyCamera.Open(_ptGreyImageQueue, out message, out width, out height))
            {
                _ptGreyStopImageThreadEvent = new System.Threading.AutoResetEvent(false);

                if (_ptGreyCamera.DefaultSettings())
                {
                    Properties.Settings.Default.VideoMode = 0;
                    Properties.Settings.Default.Save();
                    Gain      = Properties.Settings.Default.Gain;
                    Shutter   = Properties.Settings.Default.ShutterTimePhos;
                    WBred     = Properties.Settings.Default.WBRed;
                    WBblue    = Properties.Settings.Default.WBBlue;
                    VideoMode = Properties.Settings.Default.VideoMode;
                    _ptGreyCamera.StartVideo();

                    ImageHeight = height;
                    ImageWidth  = width;
                }
                else
                {
                    message = "Error: Could not load default camera settings";
                }

                e.Result = message;
            }
            else
            {
                e.Result = "Error: " + message;
            }
        }
Пример #3
0
        private void InitializeCameraSettings(PtGreyCamera camera)
        {
            //first reset to default settings
            camera.DefaultSettings();

            // hue, gamma, and saturation setting controled by pixel format RGB8 will enable those settings
            //TODO: spinnaker
            //camera.SetCameraVideoModeAndFrameRate(VideoMode.VideoMode800x600Rgb,
            //    FrameRate.FrameRate30);
            camera.SetAbsolutePropertyValue("PixelFormat", "RGB8");
            camera.SetAbsolutePropertyValue("VideoMode", "Continuous");
            int width  = Convert.ToInt32(camera.GetPropertyValue("WidthMax"));
            int height = Convert.ToInt32(camera.GetPropertyValue("HeightMax"));

            camera.SetAbsolutePropertyValue("Width", width.ToString());
            camera.SetAbsolutePropertyValue("Height", height.ToString());

            camera.SetProprtyAutomaticSetting("Shutter", true);

            camera.SetAbsolutePropertyValue("Gain", "0");

            camera.SetProprtyEnabledSetting("AcquisitionFrameRate", true);
            camera.SetAbsolutePropertyValue("FrameRate", App.Settings.FrameRate.ToString());

            camera.SetProprtyEnabledSetting("Saturation", true);
            camera.SetAbsolutePropertyValue("Saturation", App.Settings.Saturation.ToString());

            camera.SetProprtyEnabledSetting("Gamma", true);
            camera.SetAbsolutePropertyValue("Gamma", App.Settings.Gamma.ToString());

            camera.SetProprtyEnabledSetting("Hue", true);
            camera.SetAbsolutePropertyValue("Hue", App.Settings.Hue.ToString());

            camera.SetStreamBufferCount(1); // test only
            camera.SetAbsolutePropertyValue("StreamBufferMode", "NewestOnly");
        }