private void UpdateValuesCameraSettings() { ZEDCameraSettingsManager.CameraSettings settings = zedCamera.GetCameraSettings(); hue = settings.Hue; brightness = settings.Brightness; contrast = settings.Contrast; exposure = settings.Exposure; saturation = settings.Saturation; gain = settings.Gain; }
/// <summary> /// Initializes all the starting values, and gets current values from the ZED. /// </summary> void FirstInit() { if (!isInit) { zedCamera = sl.ZEDCamera.GetInstance(); EditorApplication.playmodeStateChanged += Draw; if (zedCamera != null && zedCamera.IsCameraReady) { isInit = true; if (!loaded) { if (resetWanted) { ResetValues(groupAuto); resetWanted = false; } zedCamera.RetrieveCameraSettings(); ZEDCameraSettingsManager.CameraSettings settings = zedCamera.GetCameraSettings(); groupAuto = zedCamera.GetExposureUpdateType(); whiteBalanceAuto = zedCamera.GetWhiteBalanceUpdateType(); hue = settings.Hue; brightness = settings.Brightness; contrast = settings.Contrast; saturation = settings.Saturation; exposure = settings.Exposure; gain = settings.Gain; zedCamera.SetCameraSettings(sl.CAMERA_SETTINGS.GAIN, gain, groupAuto); zedCamera.SetCameraSettings(sl.CAMERA_SETTINGS.EXPOSURE, exposure, groupAuto); zedCamera.SetCameraSettings(sl.CAMERA_SETTINGS.WHITEBALANCE, whiteBalance, whiteBalanceAuto); } else { LoadCameraSettings(); } parameters = zedCamera.GetCalibrationParameters(false); zed_serial_number = zedCamera.GetZEDSerialNumber(); zed_fw_version = zedCamera.GetZEDFirmwareVersion(); zed_model = zedCamera.GetCameraModel(); } } }
void FirstInit() { if (!isInit) { zedCamera = sl.ZEDCamera.GetInstance(); EditorApplication.playmodeStateChanged += Draw; if (zedCamera != null && zedCamera.CameraIsReady) { isInit = true; if (!loaded) { if (resetWanted) { ResetValues(groupAuto); resetWanted = false; } zedCamera.RetrieveCameraSettings(); ZEDCameraSettingsManager.CameraSettings settings = zedCamera.GetCameraSettings(); hue = settings.Hue; brightness = settings.Brightness; contrast = settings.Contrast; saturation = settings.Saturation; if (groupAuto) { exposure = settings.Exposure; gain = settings.Gain; zedCamera.SetCameraSettings(sl.CAMERA_SETTINGS.GAIN, gain, true); zedCamera.SetCameraSettings(sl.CAMERA_SETTINGS.EXPOSURE, exposure, true); zedCamera.SetCameraSettings(sl.CAMERA_SETTINGS.WHITEBALANCE, -1, false); } } else { LoadCameraSettings(); //loaded = false; } parameters = zedCamera.GetCameraInformation(); } } }
public void changeGUIFromCurrentSettings() { m_camera.RetrieveCameraSettings(); // this will make the whiteBalance not -1 but previous value when autoWhitebalance, please note this ZEDCameraSettingsManager.CameraSettings settings = m_camera.GetCameraSettings(); int hue = settings.Hue; int brightness = settings.Brightness; int contrast = settings.Contrast; int saturation = settings.Saturation; int exposure = settings.Exposure; int gain = settings.Gain; int whiteBalance = settings.WhiteBalance; // GUI BrightnessTrackBar.Value = brightness; BrightnessTextBox.Text = brightness.ToString(); ContrastTrackBar.Value = contrast; ContrastTextBox.Text = contrast.ToString(); HueTrackBar.Value = hue; HueTextBox.Text = hue.ToString(); SaturationTrackBar.Value = saturation; SaturationTextBox.Text = saturation.ToString(); if (whiteBalance == -1) { whiteBalance = 2600; } AWBTrackBar.Value = whiteBalance / 100; AWBTextBox.Text = whiteBalance.ToString(); if (AWBAutoCheckBox.Checked) // AUTO { AWBTrackBar.Enabled = false; m_camera.SetCameraSettings(sl.CAMERA_SETTINGS.WHITEBALANCE, 0, true); } else { AWBTrackBar.Enabled = true; } if (exposure == -1) { exposure = 0; } if (gain == -1) { gain = 0; } GainTrackBar.Value = gain; ExposureTrackBar.Value = exposure; GainTextBox.Text = gain.ToString(); ExposureTextBox.Text = exposure.ToString(); if (GECheckBox.Checked) { GainTrackBar.Enabled = false; ExposureTrackBar.Enabled = false; m_camera.SetCameraSettings(sl.CAMERA_SETTINGS.GAIN, 0, true); // NOTE 0, should has no imapct m_camera.SetCameraSettings(sl.CAMERA_SETTINGS.EXPOSURE, 0, true); } else { GainTrackBar.Enabled = true; ExposureTrackBar.Enabled = true; } }