internal override void SettingsUpdated() { base.SettingsUpdated(); var firstNotSecond = ResponseValues.Select(c => c.Y).Except(Parent.SettingContainer.Settings.CalibrationSettings.PhotometricCalibrationSettings.ResponseValues).ToList(); var secondNotFirst = Parent.SettingContainer.Settings.CalibrationSettings.PhotometricCalibrationSettings.ResponseValues.Except(ResponseValues.Select(c => c.Y)).ToList(); bool changed = firstNotSecond.Any() || secondNotFirst.Any(); if (changed) { List <double> l = Parent.SettingContainer.Settings.CalibrationSettings.PhotometricCalibrationSettings.ResponseValues.ToList(); ResponseValues.Clear(); ResponseValues.AddRange(l.Select((c, i) => new DataPoint(i, c))); } Vignette = new CvImageContainer(); try { if (!string.IsNullOrEmpty(Parent.SettingContainer.Settings.CalibrationSettings.PhotometricCalibrationSettings.VignetteFileBase64)) { byte[] data = Convert.FromBase64String(Parent.SettingContainer.Settings.CalibrationSettings.PhotometricCalibrationSettings.VignetteFileBase64); Mat temp = new Mat(); CvInvoke.Imdecode(data, Emgu.CV.CvEnum.ImreadModes.Grayscale, temp); Vignette.CvImage = temp; } } catch (Exception) { } }
private void ParseResponseResult(string outputPath) { ResponseValues.Clear(); int i = 0; string file = Path.Combine(outputPath, "photoCalibResult", "pcalib.txt"); string content = File.ReadAllText(file); foreach (string item in content.Split(' ')) { if (i >= 256) { break; } double val = 0.0; double.TryParse(item, NumberStyles.Any, CultureInfo.InvariantCulture, out val); ResponseValues.Add(new DataPoint(i++, val)); } }