void SetReadings() { Dictionary <CAMERA_PROPERTY, double> readings = new Dictionary <CAMERA_PROPERTY, double>(); readings.Add(CAMERA_PROPERTY.Shutter, 0); readings.Add(CAMERA_PROPERTY.Temperature, 0); readings.Add(CAMERA_PROPERTY.WhiteBalanceRed, 0); readings.Add(CAMERA_PROPERTY.WhiteBalanceBlue, 0); _camera.GetInitializationPropertyValues(readings); _shutter = readings[CAMERA_PROPERTY.Shutter]; _cameraTemp = readings[CAMERA_PROPERTY.Temperature]; _wbRed = readings[CAMERA_PROPERTY.WhiteBalanceRed]; _wbBlue = readings[CAMERA_PROPERTY.WhiteBalanceBlue]; BitmapSource bmpSource = _controlViewModel.CameraImage; if (Properties.Settings.Default.WBInitialize) { _bValue = 0; _wbRed = 0; _wbBlue = 0; if (bmpSource != null) { System.Drawing.Bitmap img_Bmp = _controlViewModel.GetBitmap(bmpSource); ImageProcessing.calcBGR_wholeimage(ref img_Bmp, ref _bValue, ref _wbBlue, ref _wbRed); } } OnPropertyChanged("Shutter"); OnPropertyChanged("CameraTemp"); OnPropertyChanged("WBRed"); OnPropertyChanged("WBBlue"); OnPropertyChanged("BValue"); //////////////////////////////////////////// //Hiroshi add for light source stabilization //////////////////////////////////////////// if (bmpSource != null) { System.Drawing.Bitmap img_Bmp = _controlViewModel.GetBitmap(bmpSource); ImageProcessing.calcLab_ROI(ref img_Bmp, ref _L, ref _a, ref _b); _LList.Add(_L); _aList.Add(_a); _bList.Add(_b); } _shutterList.Add(_shutter); _cameraTempList.Add(_cameraTemp); _wbRedList.Add((int)_wbRed); _wbBlueList.Add((int)_wbBlue); //_LList.Add(_L); //_aList.Add(_a); //_bList.Add(_b); if (_aList.Count > Properties.Settings.Default.Time) { _shutterList.RemoveAt(0); _cameraTempList.RemoveAt(0); _wbRedList.RemoveAt(0); _wbBlueList.RemoveAt(0); _LList.RemoveAt(0); _aList.RemoveAt(0); _bList.RemoveAt(0); if (Math.Abs(_shutterList.Max() - _shutterList.Min()) < Properties.Settings.Default.ShutterTimeDiff && Math.Abs(_shutter - Properties.Settings.Default.ShutterTime) < _shutterTarget && Math.Abs(_cameraTempList.Max() - _cameraTempList.Min()) < Properties.Settings.Default.CameraTempDiff && _wbRedList.Min() == _wbRedList.Max() && _wbBlueList.Min() == _wbBlueList.Max() && Math.Abs(_aList.Max() - _aList.Min()) < Properties.Settings.Default.ADiff && Math.Abs(_bList.Max() - _bList.Min()) < Properties.Settings.Default.BDiff) { _enableReadyButton = true; } else { _enableReadyButton = false; } } }