質問編集履歴

1

MemoryMappedFile を追記しました。

2018/12/08 06:26

投稿

mypace
mypace

スコア45

test CHANGED
File without changes
test CHANGED
@@ -140,13 +140,41 @@
140
140
 
141
141
  コード
142
142
 
143
+ string mappedName = "ImageAccess";
144
+
145
+ MemoryMappedFile mmf;
146
+
147
+ try
148
+
149
+ {
150
+
151
+ //--- メモリマップドファイルを開く ---//
152
+
153
+ using (mmf = MemoryMappedFile.CreateNew(mappedName, width * height * 5, MemoryMappedFileAccess.ReadWrite))
154
+
155
+ {
156
+
157
+
158
+
159
+ //C++側 マップ書き込み ※FilePathを可変的な記述へ変更のこと
160
+
161
+
162
+
163
+ string filePath = "C:\images";
164
+
165
+
166
+
167
+ int check = RecVideoL(camNo, width, height, fps, filePath, mappedName);
168
+
169
+ //}
170
+
143
171
  //--- マップドストリーム作成 マップ操作 ---//
144
172
 
145
173
  using (MemoryMappedViewStream stream = mmf.CreateViewStream())
146
174
 
147
175
  {
148
176
 
149
-
177
+
150
178
 
151
179
  //C#側 マップデータ読み込み
152
180
 
@@ -156,10 +184,40 @@
156
184
 
157
185
  //C#側 BMP変換
158
186
 
187
+
188
+
189
+ ImageConverter imgConv = new ImageConverter();
190
+
191
+ if (imgConv != null)
192
+
193
+ {
194
+
195
+ Image img = (Image)imgConv.ConvertFrom(imageArr);
196
+
197
+ Bitmap bmp = new Bitmap(img);
198
+
159
- //BMP ピクチャボックス表示
199
+ //PictureBoxへの表示
200
+
160
-
201
+ CameraImg.Image = bmp;
202
+
161
-
203
+ }
162
204
 
163
205
  }
164
206
 
207
+ }
208
+
209
+
210
+
211
+ }
212
+
213
+ catch (Exception ex)
214
+
215
+ {
216
+
217
+ MessageBox.Show(ex.Message);
218
+
219
+ this.Close();
220
+
221
+ }
222
+
165
223
  ```