diff --git a/TIASshot/Lucam.cs b/TIASshot/Lucam.cs index 6d68ae8..b8d4175 100644 --- a/TIASshot/Lucam.cs +++ b/TIASshot/Lucam.cs @@ -65,6 +65,7 @@ int _detectionCount = 0; Point2f _lastPosition = new Point2f(0, 0); Mat _convRGB2SRGB; + Mat _convRGB2XYZ; Mat _tccRois; // TCCのROI検出結果画像 /// @@ -330,12 +331,14 @@ private void CalcTcc(Mat img) { _convRGB2SRGB = CalcConvertMatrix(img, TCC_SRGB); + _convRGB2XYZ = CalcConvertMatrix(img, TCC_XYZ); // データ保存 var folder = GetSaveFolder("校正"); Cv2.ImWrite(Path.Combine(folder, Config.GetString("TccSaveFile")), img); Cv2.ImWrite(Path.Combine(folder, Config.GetString("TccRoisFile")), _tccRois); SaveMatToCsv(Path.Combine(folder, Config.GetString("ConvSrgbSaveFile")), _convRGB2SRGB); + SaveMatToCsv(Path.Combine(folder, Config.GetString("ConvXyzSaveFile")), _convRGB2XYZ); _form.ShowMessage("自動校正完了"); _form.EnableShots(); @@ -509,7 +512,14 @@ /// private void SaveMatToCsv(string csvFile, Mat m) { using (var writer = new StreamWriter(csvFile)) { - writer.Write(m.Dump(FormatType.CSV)); + for(var row = 0; row < m.Rows; row++) { + var line = ""; + for(var col = 0; col < m.Cols; col++) { + if (col > 0) line += ","; + line += $"{m.At(row, col):0.0000000}"; + } + writer.WriteLine(line); + } } } diff --git a/TIASshot/config.xml b/TIASshot/config.xml index 29d47cb..d66d0dd 100644 --- a/TIASshot/config.xml +++ b/TIASshot/config.xml @@ -19,6 +19,7 @@ tcc_xyz.csv tcc.png tcc_rois.jpg - conv_mat_srgb.csv + conv_rgb_srgb.csv + conv_rgb_xyz.csv C:\TIAS_Data