Пример #1
0
        /// <summary>
        /// Read the device configuration from the ASCOM Profile store
        /// </summary>
        internal void ReadProfile()
        {
            using (Profile driverProfile = new Profile())
            {
                driverProfile.DeviceType = "Camera";
                tl.Enabled = Convert.ToBoolean(driverProfile.GetValue(driverID, traceStateProfileName, string.Empty, traceStateDefault));

                DeserializeModelsFromJson();

                string cameraModelID = driverProfile.GetValue(driverID, cameraModelProfileName, string.Empty, "");

                var firstCameraModel = CameraModel.Models.FirstOrDefault();

                if (string.IsNullOrEmpty(cameraModelID))
                {
                    cameraModel = firstCameraModel;
                }
                else
                {
                    cameraModel = CameraModel.Models.FirstOrDefault(m => m.ID == cameraModelID) ?? firstCameraModel;
                }

                string isoAsString = driverProfile.GetValue(driverID, isoProfileName, string.Empty, cameraModel.Gains.First().ToString());
                iso  = short.Parse(isoAsString);
                Gain = (short)Array.IndexOf(Gains.ToArray(), iso);

                imageFormat         = (ImageFormat)Enum.Parse(typeof(ImageFormat), driverProfile.GetValue(driverID, imageFormatProfileName, string.Empty, ImageFormat.CFA.ToString()));
                autoDeleteImageFile = Boolean.Parse(driverProfile.GetValue(driverID, autoDeleteImageFileProfileName, string.Empty, false.ToString()));


                cameraNumX = cameraModel.Sensor.GetReadoutWidth(imageFormat);
                cameraNumY = cameraModel.Sensor.GetReadoutHeight(imageFormat);
            }
        }
Пример #2
0
        private void InitUI()
        {
            _cameraModel     = Camera.cameraModel;
            chkTrace.Checked = Camera.tl.Enabled;

            cbImageFormat.Items.Clear();
            cbImageFormat.Items.AddRange(new[]
            {
                (object)ImageFormat.CFA,
                ImageFormat.Debayered,
                ImageFormat.JPG
            });
            cbImageFormat.SelectedItem = Camera.imageFormat;

            checkAutoDeleteFile.Checked = Camera.autoDeleteImageFile;

            cbCameraModel.Items.Clear();
            cbCameraModel.Items.AddRange(CameraModel.Models.Select(m => (object)m).ToArray());
            cbCameraModel.DisplayMember = "Name";
            if (string.IsNullOrEmpty(_cameraModel.ID) == false)
            {
                cbCameraModel.SelectedItem = _cameraModel;
            }

            cbISO.Items.Clear();
            if (_cameraModel != null)
            {
                cbISO.Items.AddRange(Camera.cameraModel.Gains.Select(iso => (object)iso).ToArray());
                cbISO.SelectedItem = Camera.iso;
            }

            ToggleCameraSettings();
        }
Пример #3
0
        public SonyCamera(CameraModel cameraModel, ImageFormat imageFormat, bool autoDeleteImageFile)
        {
            _cameraModel = cameraModel;
            _remoteApp   = new ImagingEdgeRemoteInterop(cameraModel, imageFormat, autoDeleteImageFile);

            _remoteApp.ExposureCompleted += _remoteApp_ExposureCompleted;
            _remoteApp.ExposureReady     += _remoteApp_ExposureReady;
            _remoteApp.ExposureFailed    += _remoteApp_ExposureFailed;
        }
Пример #4
0
        private void cbCameraModel_SelectedValueChanged(object sender, EventArgs e)
        {
            cbISO.Items.Clear();
            CameraModel selectedCameraModel = (CameraModel)cbCameraModel.SelectedItem;

            if (selectedCameraModel != null)
            {
                cbISO.Items.AddRange(selectedCameraModel.Gains.Select(iso => (object)iso).ToArray());
                if (selectedCameraModel.Gains.Contains(Camera.iso))
                {
                    cbISO.SelectedItem = Camera.iso;
                }
                else
                {
                    cbISO.SelectedItem = selectedCameraModel.Gains.FirstOrDefault();
                }
            }

            PopulateCameraSettings(selectedCameraModel);
        }
Пример #5
0
        private void PopulateCameraSettings(CameraModel cameraModel)
        {
            if (cameraModel != null)
            {
                txtCameraModel.Text      = cameraModel.Name;
                txtSensorName.Text       = cameraModel.Sensor.Name;
                txtSensorSizeWidth.Text  = cameraModel.Sensor.Width.ToString();
                txtSensorSizeHeight.Text = cameraModel.Sensor.Height.ToString();
                txtFrameSizeWidth.Text   = cameraModel.Sensor.FrameWidth.ToString();
                txtFrameSizeHeight.Text  = cameraModel.Sensor.FrameHeight.ToString();
                txtCropSizeWidth.Text    = cameraModel.Sensor.CropWidth.ToString();
                txtCropSizeHeight.Text   = cameraModel.Sensor.CropHeight.ToString();
                txtPixelSizeWidth.Text   = cameraModel.Sensor.PixelSizeWidth.ToString();
                txtPixelSizeHeight.Text  = cameraModel.Sensor.PixelSizeHeight.ToString();
                txtExposureMin.Text      = cameraModel.ExposureMin.ToString();
                txtExposureMax.Text      = cameraModel.ExposureMax.ToString();

                lbISO.Items.Clear();
                lbISO.Items.AddRange(new ListBox.ObjectCollection(lbISO, cameraModel.Gains.OrderBy(g => g).Select(g => (object)g.ToString()).ToArray()));

                lbShutterSpeed.Items.Clear();
                lbShutterSpeed.Items.AddRange(new ListBox.ObjectCollection(lbShutterSpeed, cameraModel.ShutterSpeeds.OrderBy(s => s.DurationSeconds).Select(s => (object)$"{s.Name};{s.DurationSeconds.ToString()}").ToArray()));
            }
            else
            {
                txtCameraModel.Text      = string.Empty;
                txtSensorName.Text       = string.Empty;
                txtSensorSizeWidth.Text  = string.Empty;
                txtSensorSizeHeight.Text = string.Empty;
                txtFrameSizeWidth.Text   = string.Empty;
                txtFrameSizeHeight.Text  = string.Empty;
                txtCropSizeWidth.Text    = string.Empty;
                txtCropSizeHeight.Text   = string.Empty;
                txtPixelSizeWidth.Text   = string.Empty;
                txtPixelSizeHeight.Text  = string.Empty;
                txtExposureMin.Text      = string.Empty;
                txtExposureMax.Text      = string.Empty;
                lbISO.Items.Clear();
                lbShutterSpeed.Items.Clear();
            }
        }
Пример #6
0
 public ImagingEdgeRemoteInterop(CameraModel cameraModel, ImageFormat imageFormat, bool autoDeleteImageFile)
 {
     _cameraModel         = cameraModel;
     _imageFormat         = imageFormat;
     _autoDeleteImageFile = autoDeleteImageFile;
 }