質問編集履歴
1
試したことを記述しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -193,3 +193,115 @@
|
|
193
193
|
|
194
194
|
|
195
195
|
```
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
###追記
|
200
|
+
|
201
|
+
試した見たところ、以下の状態では正常に動きました。
|
202
|
+
|
203
|
+
```パターン1
|
204
|
+
|
205
|
+
int main(int argc, char** argv[])
|
206
|
+
|
207
|
+
{
|
208
|
+
|
209
|
+
char imgname[400];
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
ImgInfo imginfo;
|
214
|
+
|
215
|
+
ImgProcess imgprocess;
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
std::ofstream LValueFile("BValueFile.csv");
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
for (int i = 0; i < 125; i++) {
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
sprintf_s(imgname, "c:\Users\osumi\Documents\Yuki Tsuchiya\programs\ObjectHeight\ObjectHeight\img_%d.jpg", i);
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
imginfo.SetImg(cv::imread(imgname, CV_LOAD_IMAGE_COLOR));
|
232
|
+
|
233
|
+
if (imginfo.GetImg().empty()) return -1;
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
imgprocess.ImgInput(imginfo.GetImg());
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
cv::namedWindow("hsvimg", cv::WINDOW_AUTOSIZE);
|
242
|
+
|
243
|
+
cv::imshow("hsvimg",imginfo.GetImg()); ///←GetHsvImg()を変更
|
244
|
+
|
245
|
+
cv::waitKey(30);
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
return 0;
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
```
|
254
|
+
|
255
|
+
```パターン2
|
256
|
+
|
257
|
+
int main(int argc, char** argv[])
|
258
|
+
|
259
|
+
{
|
260
|
+
|
261
|
+
char imgname[400];
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
ImgInfo imginfo;
|
266
|
+
|
267
|
+
ImgProcess imgprocess;
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
std::ofstream LValueFile("BValueFile.csv");
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
for (int i = 0; i < 125; i++) {
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
sprintf_s(imgname, "c:\Users\osumi\Documents\Yuki Tsuchiya\programs\ObjectHeight\ObjectHeight\img_%d.jpg", i);
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
imginfo.SetImg(cv::imread(imgname, CV_LOAD_IMAGE_COLOR));
|
284
|
+
|
285
|
+
if (imginfo.GetImg().empty()) return -1;
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
cv::Mat hsvimg;
|
290
|
+
|
291
|
+
cvtColor(imginfo.GetImg(), hsvimg, CV_BGR2HSV); ///←imgperocess.Imginput(imginfo.GetImg())の内容を表示
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
cv::namedWindow("hsvimg", cv::WINDOW_AUTOSIZE);
|
296
|
+
|
297
|
+
cv::imshow("hsvimg",hsvimg);
|
298
|
+
|
299
|
+
cv::waitKey(30);
|
300
|
+
|
301
|
+
}
|
302
|
+
|
303
|
+
return 0;
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
```
|