teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

hensyuu

2018/11/15 19:20

投稿

coco_
coco_

スコア19

title CHANGED
File without changes
body CHANGED
@@ -17,29 +17,88 @@
17
17
  {
18
18
  public partial class Form1 : Form
19
19
  {
20
- // 係数用にメンバー変数を定義
21
- Dictionary<string, Dictionary<string, Dictionary<string, double>>> keisuu = null;
20
+ keisuu = new Dictionary<string, Dictionary<string, Dictionary<string, double>>>();
22
21
 
22
+ // xxxxx1 = 基本色、全色相、活気、評価値の平均
23
+ keisuu["xxx1"] = new Dictionary<string, Dictionary<string, double>>();
24
+ keisuu["xxx1"]["a0"] = new Dictionary<string, double>();
25
+ keisuu["xxx1"]["a0"]["B"] = -0.138;
26
+ keisuu["xxx1"]["a0"]["G"] = -0.137;
27
+ keisuu["xxx1"]["a0"]["P"] = -0.134;
28
+ keisuu["xxx1"]["a0"]["R"] = -0.135;
29
+ keisuu["xxx1"]["a0"]["Y"] = -0.137;
30
+         .
31
+ .
32
+ .
33
+ keisuu["xxx1"]["a5"] = new Dictionary<string, double>();
34
+ keisuu["xxx1"]["a5"]["B"] = 0.013;
35
+ keisuu["xxx1"]["a5"]["G"] = 0.008;
36
+ keisuu["xxx1"]["a5"]["P"] = 0.017;
37
+ keisuu["xxx1"]["a5"]["R"] = 0.007;
38
+ keisuu["xxx1"]["a5"]["Y"] = 0.010;
39
+ //xxx2 = 基本色、全色相、落ち着き、評価値の平均
40
+ keisuu["xxx2"] = new Dictionary<string, Dictionary<string, double>>();
41
+ keisuu["xxx2"]["a0"] = new Dictionary<string, double>();
42
+ keisuu["xxx2"]["a0"]["B"] = 0.268;
43
+ keisuu["xxx2"]["a0"]["G"] = 0.267;
44
+ keisuu["xxx2"]["a0"]["P"] = 0.265;
45
+ keisuu["xxx2"]["a0"]["R"] = 0.251;
46
+ keisuu["xxx2"]["a0"]["Y"] = 0.258;
47
+ .
48
+ .
49
+ .
50
+ keisuu["xxx2"]["a5"] = new Dictionary<string, double>();
51
+ keisuu["xxx2"]["a5"]["B"] = 0.003;
52
+ keisuu["xxx2"]["a5"]["G"] = -0.020;
53
+ keisuu["xxx2"]["a5"]["P"] = 0.010;
54
+ keisuu["xxx2"]["a5"]["R"] = -0.017;
55
+ keisuu["xxx2"]["a5"]["Y"] = -0.028;
56
+ // xxx3 = 強調色、全色相、活気、評価値の平均
57
+ keisuu["xxx3"] = new Dictionary<string, Dictionary<string, double>>();
58
+ keisuu["xxx3"]["a0"] = new Dictionary<string, double>();
59
+ keisuu["xxx3"]["a0"]["B"] = 0.044;
60
+ keisuu["xxx3"]["a0"]["G"] = 0.043;
61
+ keisuu["xxx3"]["a0"]["P"] = 0.047;
62
+ keisuu["xxx3"]["a0"]["R"] = 0.047;
63
+ keisuu["xxx3"]["a0"]["Y"] = 0.043;
64
+ .
65
+ .
66
+ .
67
+ keisuu["xxx3"]["a5"] = new Dictionary<string, double>();
68
+ keisuu["xxx3"]["a5"]["B"] = 0.011;
69
+ keisuu["xxx3"]["a5"]["G"] = 0.007;
70
+ keisuu["xxx3"]["a5"]["P"] = 0.007;
71
+ keisuu["xxx3"]["a5"]["R"] = 0.003;
72
+ keisuu["xxx3"]["a5"]["Y"] = 0.006;
73
+ // xxx4 = 強調色、全色相、落ち着き、評価値の平均
74
+ keisuu["xxx4"] = new Dictionary<string, Dictionary<string, double>>();
75
+ keisuu["xxx4"]["a0"] = new Dictionary<string, double>();
76
+ keisuu["xxx4"]["a0"]["B"] = 0.426;
77
+ keisuu["xxx4"]["a0"]["G"] = 0.427;
78
+ keisuu["xxx4"]["a0"]["P"] = 0.415;
79
+ keisuu["xxx4"]["a0"]["R"] = 0.412;
80
+ keisuu["xxx4"]["a0"]["Y"] = 0.417;
81
+ .
82
+ .
83
+ .
84
+ keisuu["xxx4"]["a5"] = new Dictionary<string, double>();
85
+ keisuu["xxx4"]["a5"]["B"] = 0.001;
86
+ keisuu["xxx4"]["a5"]["G"] = -0.017;
87
+ keisuu["xxx4"]["a5"]["P"] = -0.004;
88
+ keisuu["xxx4"]["a5"]["R"] = -0.004;
89
+ keisuu["xxx4"]["a5"]["Y"] = -0.014;
23
90
 
24
- /// <summary>
91
+ // 文字列定義している場所は変数に入れて使える。
92
+ /*
25
- /// コンストラクタ
93
+ string xxx = "xxx1";
94
+ string tarColor ="B";
26
- /// </summary>
95
+ double z = keisuu[xxx]["a0"][tarColor]
27
- public Form1()
28
- {
29
- InitializeComponent();
30
-
31
- // 係数ファイルを読み込み。
96
+ + (keisuu[xxx]["a1"][tarColor] * x)
32
- try
97
+ + (keisuu[xxx]["a2"][tarColor] * y)
33
- {
34
- string filepath = @"D:\temp\sample20181025byMH\keisuu_utf8.csv";
98
+ + (keisuu[xxx]["a3"][tarColor] * x * x)
99
+ + (keisuu[xxx]["a4"][tarColor] * x * y)
35
- keisuu = KeisuuReader.Read(filepath, Encoding.UTF8);
100
+ + (keisuu[xxx]["a5"][tarColor] * y * y);
36
- }
37
- catch (Exception ex)
101
+ */
38
- {
39
- System.Console.WriteLine(ex);
40
- MessageBox.Show(ex.Message);
41
- }
42
-
43
102
  }
44
103
 
45
104
 
@@ -132,15 +191,7 @@
132
191
  }
133
192
 
134
193
 
135
- /// <summary>
136
- /// X座標とY座標の位置から描画する条件に一致している確認する。
137
- /// </summary>
138
- /// <param name="tarColor">ターゲットカラー</param>
139
- /// <param name="keisuuType">係数タイプ</param>
140
- /// <param name="x">明度(saturation)0~100</param>
141
- /// <param name="y">彩度(brightness)0~100</param>
142
- /// <returns>出力条件を満たした場合True</returns>
143
- private bool IsDraw(string tarColor, string kanten1, string kanten2, string keisuuType, float y, float x)
194
+ private bool IsDraw(string tarColor, string kanten1, string kanten2, string keisuuType, float y, float x)
144
195
  {
145
196
 
146
197
  double m, n;
@@ -152,15 +203,7 @@
152
203
  double h = m; // 刻み値
153
204
  double j = n; // 余り範囲
154
205
 
155
- // 予測値zを求める
206
+
156
- // 予測式:z=a? +a? x+a? y+a? x2+a? xy+a? y2
157
- // x :明度 y :彩度 a ?? ? :係数 z :予測値
158
- // 予測式は着色する部分{基本色、強調色}、色相{Blue、Green、Purple、Red、Yellow}、
159
- // 観点を表す言葉{にぎやかで活気があること、静かで落ち着きがあること}、
160
- // 値の種類{評価値の平均、評価値の標準偏差}ごとに作成する
161
- // Wは観点の重視度(Tracberツール)
162
- // double zは活気 z1は落ち着き
163
-
164
207
  ** // double z= の式でエラーが出ました。
165
208
  double z = keisuu[keisuuType][kanten1]["a0"][tarColor]
166
209
  + (keisuu[keisuuType][kanten1]["a1"][tarColor] * x)

1

naosita

2018/11/15 19:20

投稿

coco_
coco_

スコア19

title CHANGED
File without changes
body CHANGED
@@ -40,10 +40,9 @@
40
40
  MessageBox.Show(ex.Message);
41
41
  }
42
42
 
43
+ }
43
44
 
44
- }
45
45
 
46
-
47
46
  private void button1_Click(object sender, EventArgs e)
48
47
  {
49
48