diff --git a/TIASshot/CameraBase.cs b/TIASshot/CameraBase.cs
index a3edfc9..55eac5f 100644
--- a/TIASshot/CameraBase.cs
+++ b/TIASshot/CameraBase.cs
@@ -46,6 +46,26 @@
readonly Point2f[] PointsDst41 = new Point2f[]{
new Point2f(345, 1200), new Point2f(465, 1200), new Point2f(465, 1320), new Point2f(345, 1320),
};
+ readonly int[][] ExtendChannels = new int[][]
+ {
+ new int[] { 3, 3, 3 }, // 1
+ new int[] { 0, 3, 3 }, // R
+ new int[] { 1, 3, 3 }, // G
+ new int[] { 2, 3, 3 }, // B
+ new int[] { 0, 1, 3 }, // RG
+ new int[] { 1, 2, 3 }, // GB
+ new int[] { 2, 0, 3 }, // BR
+ new int[] { 0, 0, 3 }, // RR
+ new int[] { 1, 1, 3 }, // GG
+ new int[] { 2, 2, 3 }, // BB
+ new int[] { 0, 0, 1 }, // RRG
+ new int[] { 0, 0, 2 }, // RRB
+ new int[] { 1, 1, 2 }, // GGB
+ new int[] { 1, 1, 0 }, // GGR
+ new int[] { 2, 2, 0 }, // BBR
+ new int[] { 2, 2, 1 }, // BBG
+ new int[] { 0, 1, 2 }, // RGB
+ };
readonly Mat TCC_SRGB;
readonly Mat TCC_XYZ;
readonly float UpdateRate;
@@ -343,30 +363,19 @@
///
///
///
- private Mat ExtendMat(Mat src) {
+ private Mat ExtendMat(Mat src, int channels = 17) {
if (src.Cols * src.Channels() != 3) return src;
- var dst = new Mat(src.Rows, 17, MatType.CV_64FC1);
+ var dst = new Mat(src.Rows, channels, MatType.CV_64FC1);
Parallel.For(0, src.Rows, row => {
- double b = (src.Cols == 1 ? src.At(row, 0)[0] : src.At(row, 0));
- double g = (src.Cols == 1 ? src.At(row, 0)[1] : src.At(row, 1));
- double r = (src.Cols == 1 ? src.At(row, 0)[2] : src.At(row, 2));
- dst.At(row, 0) = r;
- dst.At(row, 1) = g;
- dst.At(row, 2) = b;
- dst.At(row, 3) = r * g;
- dst.At(row, 4) = r * b;
- dst.At(row, 5) = g * b;
- dst.At(row, 6) = r * r;
- dst.At(row, 7) = g * g;
- dst.At(row, 8) = b * b;
- dst.At(row, 9) = r * r * b;
- dst.At(row, 10) = r * r * g;
- dst.At(row, 11) = g * g * r;
- dst.At(row, 12) = g * g * b;
- dst.At(row, 13) = b * b * r;
- dst.At(row, 14) = b * b * g;
- dst.At(row, 15) = r * g * b;
- dst.At(row, 16) = 1.0;
+ var vals = new double[] {
+ src.Cols == 1 ? src.At(row, 0)[2] : src.At(row, 2), // R
+ src.Cols == 1 ? src.At(row, 0)[1] : src.At(row, 1), // G
+ src.Cols == 1 ? src.At(row, 0)[0] : src.At(row, 0), // B
+ 1.0
+ };
+ for (int i = 0; i < ExtendChannels.Length; i++) {
+ dst.At(row, i) = vals[ExtendChannels[i][0]] * vals[ExtendChannels[i][1]] * vals[ExtendChannels[i][2]];
+ }
});
return dst;
}
diff --git a/TIASshot/DBK33UX178.xml b/TIASshot/DBK33UX178.xml
new file mode 100644
index 0000000..38c40fc
--- /dev/null
+++ b/TIASshot/DBK33UX178.xml
@@ -0,0 +1,144 @@
+
+
+ RGB24 (3072x2048)
+ 30.000030
+ 0
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
diff --git a/TIASshot/DFK23UX249.xml b/TIASshot/DFK23UX249.xml
new file mode 100644
index 0000000..024be0d
--- /dev/null
+++ b/TIASshot/DFK23UX249.xml
@@ -0,0 +1,133 @@
+
+
+ RGB24 (1920x1200)
+ 30.000030
+ 0
+ 0
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
diff --git a/TIASshot/Form1.cs b/TIASshot/Form1.cs
index b806c9a..3910e60 100644
--- a/TIASshot/Form1.cs
+++ b/TIASshot/Form1.cs
@@ -49,10 +49,12 @@
}
if (_camera == null) {
- _camera = new IScam(this, icImagingControl1, "DBK33UX178");
- if (!_camera.Connect()) {
+ var cameraList = icImagingControl1.Devices.Select(d => d.Name.Replace(" ", ""));
+ foreach (var cam in cameraList) {
+ _camera = new IScam(this, icImagingControl1, cam);
+ if (_camera.Connect()) break;
Debug.WriteLine(_camera.ErrorMsg);
- Debug.WriteLine("DBK33UX178の接続に失敗しました");
+ Debug.WriteLine($"{cam}の接続に失敗しました");
_camera = null;
}
}
diff --git a/TIASshot/IScam.cs b/TIASshot/IScam.cs
index 5a23fbc..bc68195 100644
--- a/TIASshot/IScam.cs
+++ b/TIASshot/IScam.cs
@@ -42,15 +42,19 @@
public override bool Connect() {
if (!BootCheck()) return false;
- _ic.LoadDeviceStateFromFile($"{DeviceName}.xml", true);
- if (!_ic.DeviceValid) {
- ErrorMsg = "IScamの設定ファイルが見つかりません";
+ var configFile = $"{DeviceName}.xml";
+ if (!File.Exists(configFile)) {
+ ErrorMsg = $"{configFile}が見つかりません";
return false;
}
- //if (!_ic.LoadShowSaveDeviceState("lastSelectedDeviceState.xml")) {
+ _ic.LoadDeviceStateFromFile(configFile, true);
+ if (!_ic.DeviceValid) {
+ ErrorMsg = $"設定ファイル{configFile}の読み込みに失敗しました";
+ return false;
+ }
+ //if (!_ic.LoadShowSaveDeviceState(configFile)) {
// return false;
//}
- //_ic.SaveDeviceStateToFile("DBK33UX178.xml");
_queueSink = new FrameQueueSink(Retrieve, MediaSubtypes.RGB24, 5);
_snapSink = new FrameSnapSink(MediaSubtypes.RGB24);
@@ -64,13 +68,13 @@
_whiteBalanceBlue = _ic.VCDPropertyItems.Find(VCDGUIDs.VCDID_WhiteBalance, VCDGUIDs.VCDElement_WhiteBalanceBlue);
_whiteBalanceGreen = _ic.VCDPropertyItems.Find(VCDGUIDs.VCDID_WhiteBalance, VCDGUIDs.VCDElement_WhiteBalanceGreen);
_whiteBalanceRed = _ic.VCDPropertyItems.Find(VCDGUIDs.VCDID_WhiteBalance, VCDGUIDs.VCDElement_WhiteBalanceRed);
- _brightness.Value = Config.GetInt("ISCAM/Brightness");
- _gain.Value = Config.GetInt("ISCAM/Gain");
- _exposure.Value = Config.GetInt("ISCAM/Exposure");
- _gamma.Value = Config.GetInt("ISCAM/Gamma");
- _whiteBalanceBlue.Value = Config.GetInt("ISCAM/WBBlue");
- _whiteBalanceGreen.Value = Config.GetInt("ISCAM/WBGreen");
- _whiteBalanceRed.Value = Config.GetInt("ISCAM/WBRed");
+ //_brightness.Value = Config.GetInt("ISCAM/Brightness");
+ //_gain.Value = Config.GetInt("ISCAM/Gain");
+ //_exposure.Value = Config.GetInt("ISCAM/Exposure");
+ //_gamma.Value = Config.GetInt("ISCAM/Gamma");
+ //_whiteBalanceBlue.Value = Config.GetInt("ISCAM/WBBlue");
+ //_whiteBalanceGreen.Value = Config.GetInt("ISCAM/WBGreen");
+ //_whiteBalanceRed.Value = Config.GetInt("ISCAM/WBRed");
Debug.WriteLine($"Exposure range: {_exposure.RangeMin} to {_exposure.RangeMax} value={_exposure.Value}" );
Debug.WriteLine($"Gain range: {_gain.RangeMin} to {_gain.RangeMax} value={_gain.Value}");
Debug.WriteLine($"Brightness range: {_brightness.RangeMin} to {_brightness.RangeMax} value={_brightness.Value}");
@@ -144,6 +148,8 @@
var snapSink = _ic.Sink as FrameSnapSink;
_shots.Clear();
+ snapSink.SnapSingle(TimeSpan.FromSeconds(5)); // 最初のフレームを捨てる
+
var thread = new Thread(() => SaveThread(numImages));
thread.Start();
diff --git a/TIASshot/config.xml b/TIASshot/config.xml
index 17bcc81..d4b43c5 100644
--- a/TIASshot/config.xml
+++ b/TIASshot/config.xml
@@ -7,7 +7,7 @@
1.72
1.70
-
+
226
226
226