16 #if MRPT_HAS_WXWIDGETS 18 #include <mrpt/3rdparty/do_opencv_includes.h> 45 const int row_in_bytes =
49 static_cast<uint8_t*
>(malloc(row_in_bytes * new_image.
getHeight()));
55 if (row_in_bytes != rs)
58 const auto* src = new_image.
ptrLine<uint8_t>(0);
59 for (
int y = 0; y < h; y++, src += rs, trg += row_in_bytes)
60 memcpy(trg, src, row_in_bytes);
68 return new wxImage(w, h,
data,
false );
78 auto ret =
new wxBitmap(*i);
93 const size_t lx = img.GetWidth();
94 const size_t ly = img.GetHeight();
96 newImg->loadFromMemoryBuffer(
97 lx, ly,
true, img.GetData(),
true );
114 wxWindow* parent, wxWindowID winID,
int x,
int y,
int width,
int height)
117 this->Create(parent, winID, wxPoint(x, y), wxSize(width, height));
126 std::lock_guard<std::mutex> lock(
m_img_cs);
148 std::lock_guard<std::mutex> lock(
m_img_cs);
162 std::lock_guard<std::mutex> lock(
m_img_cs);
176 std::lock_guard<std::mutex> lock(
m_img_cs);
183 dc.DrawBitmap(*
m_img, 0, 0);
188 std::lock_guard<std::mutex> lock(
m_img_cs);
253 wxStaticBoxSizer* StaticBoxSizer2;
254 wxFlexGridSizer* FlexGridSizer4;
255 wxFlexGridSizer* FlexGridSizer16;
256 wxFlexGridSizer* FlexGridSizer10;
257 wxFlexGridSizer* FlexGridSizer3;
258 wxFlexGridSizer* FlexGridSizer5;
259 wxFlexGridSizer* FlexGridSizer2;
260 wxFlexGridSizer* FlexGridSizer18;
261 wxFlexGridSizer* FlexGridSizer13;
262 wxFlexGridSizer* FlexGridSizer12;
263 wxStaticBoxSizer* StaticBoxSizer1;
264 wxFlexGridSizer* FlexGridSizer1;
265 wxFlexGridSizer* FlexGridSizer11;
268 parent,
id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
270 FlexGridSizer1 =
new wxFlexGridSizer(0, 1, 0, 0);
271 FlexGridSizer1->AddGrowableCol(0);
272 FlexGridSizer1->AddGrowableRow(0);
273 pagesCameras =
new wxNotebook(
274 this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0,
276 Panel2 =
new wxPanel(
277 pagesCameras, ID_PANEL2, wxDefaultPosition, wxDefaultSize,
278 wxTAB_TRAVERSAL, _T(
"ID_PANEL2"));
279 FlexGridSizer10 =
new wxFlexGridSizer(0, 2, 0, 0);
280 FlexGridSizer10->AddGrowableCol(1);
281 StaticText1 =
new wxStaticText(
282 Panel2, ID_STATICTEXT1, _(
"Camera index:"), wxDefaultPosition,
283 wxDefaultSize, 0, _T(
"ID_STATICTEXT1"));
284 FlexGridSizer10->Add(
285 StaticText1, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
286 opencvCamIndex =
new wxSpinCtrl(
287 Panel2, ID_SPINCTRL1, _T(
"0"), wxDefaultPosition, wxDefaultSize, 0, 0,
288 100, 0, _T(
"ID_SPINCTRL1"));
289 opencvCamIndex->SetValue(_T(
"0"));
290 FlexGridSizer10->Add(
291 opencvCamIndex, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
292 StaticText3 =
new wxStaticText(
293 Panel2, ID_STATICTEXT3, _(
"Camera type:"), wxDefaultPosition,
294 wxDefaultSize, 0, _T(
"ID_STATICTEXT3"));
295 FlexGridSizer10->Add(
297 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
298 cbOpencvCamType =
new wxChoice(
299 Panel2, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0,
nullptr, 0,
300 wxDefaultValidator, _T(
"ID_CHOICE1"));
301 cbOpencvCamType->SetSelection(
302 cbOpencvCamType->Append(_(
"CAMERA_CV_AUTODETECT")));
303 cbOpencvCamType->Append(_(
"CAMERA_CV_DC1394"));
304 cbOpencvCamType->Append(_(
"CAMERA_CV_VFL"));
305 cbOpencvCamType->Append(_(
"CAMERA_CV_VFW"));
306 cbOpencvCamType->Append(_(
"CAMERA_CV_MIL"));
307 cbOpencvCamType->Append(_(
"CAMERA_CV_DSHOW"));
308 FlexGridSizer10->Add(
309 cbOpencvCamType, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
310 StaticText6 =
new wxStaticText(
311 Panel2, ID_STATICTEXT6, _(
"Resolution:"), wxDefaultPosition,
312 wxDefaultSize, 0, _T(
"ID_STATICTEXT6"));
313 FlexGridSizer10->Add(
314 StaticText6, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
315 cbOpencvResolution =
new wxChoice(
316 Panel2, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 0,
nullptr, 0,
317 wxDefaultValidator, _T(
"ID_CHOICE2"));
318 cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_(
"default")));
319 cbOpencvResolution->Append(_(
"320x240"));
320 cbOpencvResolution->Append(_(
"640x480"));
321 FlexGridSizer10->Add(
322 cbOpencvResolution, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
324 FlexGridSizer10->Add(
325 -1, -1, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
327 Panel2->SetSizer(FlexGridSizer10);
328 FlexGridSizer10->Fit(Panel2);
329 FlexGridSizer10->SetSizeHints(Panel2);
330 Panel3 =
new wxPanel(
331 pagesCameras, ID_PANEL3, wxDefaultPosition, wxDefaultSize,
332 wxTAB_TRAVERSAL, _T(
"ID_PANEL3"));
333 FlexGridSizer11 =
new wxFlexGridSizer(0, 1, 0, 0);
334 FlexGridSizer11->AddGrowableCol(0);
335 StaticText7 =
new wxStaticText(
336 Panel3, ID_STATICTEXT7, _(
"IP Camera URL:"), wxDefaultPosition,
337 wxDefaultSize, 0, _T(
"ID_STATICTEXT7"));
338 FlexGridSizer11->Add(
339 StaticText7, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
340 edIPcamURL =
new wxTextCtrl(
341 Panel3, ID_TEXTCTRL1, _(
"rtsp://192.168.0.1/live.sdp"),
342 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
344 FlexGridSizer11->Add(
345 edIPcamURL, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
346 Panel3->SetSizer(FlexGridSizer11);
347 FlexGridSizer11->Fit(Panel3);
348 FlexGridSizer11->SetSizeHints(Panel3);
349 Panel4 =
new wxPanel(
350 pagesCameras, ID_PANEL4, wxDefaultPosition, wxDefaultSize,
351 wxTAB_TRAVERSAL, _T(
"ID_PANEL4"));
352 FlexGridSizer16 =
new wxFlexGridSizer(0, 1, 0, 0);
353 FlexGridSizer16->AddGrowableCol(0);
354 FlexGridSizer16->AddGrowableRow(0);
355 edCustomCamConfig =
new wxTextCtrl(
356 Panel4, ID_TEXTCTRL6,
357 _(
"// Configuration block for the CCameraSensor object.\n// Check out " 358 "its documentation at:\n// " 359 "http://reference.mrpt.org/devel/" 360 "classmrpt_1_1hwdrivers_1_1_c_camera_sensor.html\n\n[CONFIG]" 361 "\ngrabber_type = opencv \ncv_camera_index = 0\ncv_camera_type = " 362 "CAMERA_CV_AUTODETECT\n\n"),
363 wxDefaultPosition, wxDefaultSize,
364 wxTE_MULTILINE | wxHSCROLL | wxTE_DONTWRAP | wxVSCROLL |
366 wxDefaultValidator, _T(
"ID_TEXTCTRL6"));
367 wxFont edCustomCamConfigFont =
368 wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT);
369 if (!edCustomCamConfigFont.Ok())
370 edCustomCamConfigFont =
371 wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
372 edCustomCamConfigFont.SetPointSize(7);
373 edCustomCamConfig->SetFont(edCustomCamConfigFont);
374 FlexGridSizer16->Add(
375 edCustomCamConfig, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
376 Panel4->SetSizer(FlexGridSizer16);
377 FlexGridSizer16->Fit(Panel4);
378 FlexGridSizer16->SetSizeHints(Panel4);
379 Panel5 =
new wxPanel(
380 pagesCameras, ID_PANEL5, wxDefaultPosition, wxDefaultSize,
381 wxTAB_TRAVERSAL, _T(
"ID_PANEL5"));
382 FlexGridSizer12 =
new wxFlexGridSizer(0, 1, 0, 0);
383 FlexGridSizer12->AddGrowableCol(0);
384 StaticText8 =
new wxStaticText(
385 Panel5, ID_STATICTEXT8, _(
"Video file to open:"), wxDefaultPosition,
386 wxDefaultSize, 0, _T(
"ID_STATICTEXT8"));
387 FlexGridSizer12->Add(
388 StaticText8, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
389 edVideoFile =
new wxTextCtrl(
390 Panel5, ID_TEXTCTRL2, _(
"test.avi"), wxDefaultPosition, wxDefaultSize,
391 0, wxDefaultValidator, _T(
"ID_TEXTCTRL2"));
392 FlexGridSizer12->Add(
393 edVideoFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
394 btnBrowseVideo =
new wxButton(
395 Panel5, ID_BUTTON7, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
396 wxDefaultValidator, _T(
"ID_BUTTON7"));
397 FlexGridSizer12->Add(
399 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
400 Panel5->SetSizer(FlexGridSizer12);
401 FlexGridSizer12->Fit(Panel5);
402 FlexGridSizer12->SetSizeHints(Panel5);
403 Panel6 =
new wxPanel(
404 pagesCameras, ID_PANEL6, wxDefaultPosition, wxDefaultSize,
405 wxTAB_TRAVERSAL, _T(
"ID_PANEL6"));
406 FlexGridSizer13 =
new wxFlexGridSizer(0, 3, 0, 0);
407 FlexGridSizer13->AddGrowableCol(1);
408 StaticText9 =
new wxStaticText(
409 Panel6, ID_STATICTEXT9, _(
"Rawlog \nfile:"), wxDefaultPosition,
410 wxDefaultSize, 0, _T(
"ID_STATICTEXT9"));
411 FlexGridSizer13->Add(
412 StaticText9, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
413 edRawlogFile =
new wxTextCtrl(
414 Panel6, ID_TEXTCTRL3, _(
"test.rawlog"), wxDefaultPosition,
415 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL3"));
416 FlexGridSizer13->Add(
417 edRawlogFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
418 btnBrowseRawlog =
new wxButton(
419 Panel6, ID_BUTTON8, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
420 wxDefaultValidator, _T(
"ID_BUTTON8"));
421 FlexGridSizer13->Add(
423 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
424 StaticText5 =
new wxStaticText(
425 Panel6, ID_STATICTEXT5, _(
"External \nimages:"), wxDefaultPosition,
426 wxDefaultSize, 0, _T(
"ID_STATICTEXT5"));
427 FlexGridSizer13->Add(
428 StaticText5, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
429 edRawlogImgDir =
new wxTextCtrl(
430 Panel6, ID_TEXTCTRL7, _(
"./Images"), wxDefaultPosition, wxDefaultSize,
431 0, wxDefaultValidator, _T(
"ID_TEXTCTRL7"));
432 FlexGridSizer13->Add(
433 edRawlogImgDir, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
434 btnBrowseRawlogDir =
new wxButton(
435 Panel6, ID_BUTTON9, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
436 wxDefaultValidator, _T(
"ID_BUTTON9"));
437 FlexGridSizer13->Add(
438 btnBrowseRawlogDir, 1,
439 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
440 StaticText10 =
new wxStaticText(
441 Panel6, ID_STATICTEXT10, _(
"Sensor\nlabel:"), wxDefaultPosition,
442 wxDefaultSize, 0, _T(
"ID_STATICTEXT10"));
443 FlexGridSizer13->Add(
444 StaticText10, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
445 edRawlogLabel =
new wxTextCtrl(
446 Panel6, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize,
447 0, wxDefaultValidator, _T(
"ID_TEXTCTRL8"));
448 FlexGridSizer13->Add(
449 edRawlogLabel, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
450 StaticText11 =
new wxStaticText(
451 Panel6, ID_STATICTEXT11, _(
"(empty=any)"), wxDefaultPosition,
452 wxDefaultSize, 0, _T(
"ID_STATICTEXT11"));
453 FlexGridSizer13->Add(
455 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
456 Panel6->SetSizer(FlexGridSizer13);
457 FlexGridSizer13->Fit(Panel6);
458 FlexGridSizer13->SetSizeHints(Panel6);
459 Panel1 =
new wxPanel(
460 pagesCameras, ID_PANEL7, wxDefaultPosition, wxDefaultSize,
461 wxTAB_TRAVERSAL, _T(
"ID_PANEL7"));
462 FlexGridSizer18 =
new wxFlexGridSizer(2, 2, 0, 0);
463 wxString __wxRadioBoxChoices_1[2] = {_(
"Left"), _(
"Right")};
464 rbBumblebeeSel =
new wxRadioBox(
465 Panel1, ID_RADIOBOX1, _(
"Select monocular input"), wxDefaultPosition,
466 wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator,
468 rbBumblebeeSel->SetSelection(0);
469 FlexGridSizer18->Add(
471 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
472 cbBumblebeeRectif =
new wxCheckBox(
473 Panel1, ID_CHECKBOX1, _(
"Use vendor\'s rectify"), wxDefaultPosition,
474 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX1"));
475 cbBumblebeeRectif->SetValue(
false);
476 FlexGridSizer18->Add(
477 cbBumblebeeRectif, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL,
479 FlexGridSizer18->Add(-1, -1, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
480 StaticText2 =
new wxStaticText(
481 Panel1, ID_STATICTEXT2, _(
"(Unchecked = raw images)"),
482 wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT2"));
483 FlexGridSizer18->Add(
484 StaticText2, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
485 Panel1->SetSizer(FlexGridSizer18);
486 FlexGridSizer18->Fit(Panel1);
487 FlexGridSizer18->SetSizeHints(Panel1);
488 pnSwissRanger =
new wxPanel(
489 pagesCameras, ID_PANEL1, wxDefaultPosition, wxDefaultSize,
490 wxTAB_TRAVERSAL, _T(
"ID_PANEL1"));
491 FlexGridSizer2 =
new wxFlexGridSizer(2, 3, 0, 0);
492 wxString __wxRadioBoxChoices_2[2] = {_(
"USB"), _(
"Ethernet")};
493 rbSR_usb =
new wxRadioBox(
494 pnSwissRanger, ID_RADIOBOX2, _(
"Connection"), wxDefaultPosition,
495 wxDefaultSize, 2, __wxRadioBoxChoices_2, 1, 0, wxDefaultValidator,
498 rbSR_usb, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
499 StaticText4 =
new wxStaticText(
500 pnSwissRanger, ID_STATICTEXT4, _(
"IP:"), wxDefaultPosition,
501 wxDefaultSize, 0, _T(
"ID_STATICTEXT4"));
503 StaticText4, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
504 edSR_IP =
new wxTextCtrl(
505 pnSwissRanger, ID_TEXTCTRL4, _(
"192.168.2.14"), wxDefaultPosition,
506 wxSize(120, -1), 0, wxDefaultValidator, _T(
"ID_TEXTCTRL4"));
508 edSR_IP, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
509 StaticBoxSizer1 =
new wxStaticBoxSizer(
510 wxHORIZONTAL, pnSwissRanger, _(
"Channels to grab: "));
511 FlexGridSizer3 =
new wxFlexGridSizer(4, 1, 0, 0);
512 cbSR_chIntensity =
new wxCheckBox(
513 pnSwissRanger, ID_CHECKBOX3, _(
"Grayscale intensity"),
514 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
516 cbSR_chIntensity->SetValue(
true);
517 cbSR_chIntensity->Disable();
519 cbSR_chIntensity, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
520 cbSR_ch3D =
new wxCheckBox(
521 pnSwissRanger, ID_CHECKBOX4, _(
"3D point cloud"), wxDefaultPosition,
522 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX4"));
523 cbSR_ch3D->SetValue(
false);
524 FlexGridSizer3->Add(cbSR_ch3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
525 cbSR_chRange =
new wxCheckBox(
526 pnSwissRanger, ID_CHECKBOX5, _(
"Depth image"), wxDefaultPosition,
527 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX5"));
528 cbSR_chRange->SetValue(
false);
530 cbSR_chRange, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
531 cbSR_chConf =
new wxCheckBox(
532 pnSwissRanger, ID_CHECKBOX6, _(
"Confidence"), wxDefaultPosition,
533 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX6"));
534 cbSR_chConf->SetValue(
false);
536 cbSR_chConf, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
537 StaticBoxSizer1->Add(
538 FlexGridSizer3, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
540 StaticBoxSizer1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
542 pnSwissRanger->SetSizer(FlexGridSizer2);
543 FlexGridSizer2->Fit(pnSwissRanger);
544 FlexGridSizer2->SetSizeHints(pnSwissRanger);
545 pnKinect =
new wxPanel(
546 pagesCameras, ID_PANEL8, wxDefaultPosition, wxDefaultSize,
547 wxTAB_TRAVERSAL, _T(
"ID_PANEL8"));
548 FlexGridSizer4 =
new wxFlexGridSizer(2, 3, 0, 0);
550 new wxStaticBoxSizer(wxHORIZONTAL, pnKinect, _(
"Channels to grab: "));
551 FlexGridSizer5 =
new wxFlexGridSizer(4, 1, 0, 0);
552 cbKinect_Int =
new wxCheckBox(
553 pnKinect, ID_CHECKBOX7, _(
"Intensity"), wxDefaultPosition,
554 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX7"));
555 cbKinect_Int->SetValue(
true);
556 cbKinect_Int->Disable();
558 cbKinect_Int, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
559 cbKinect_3D =
new wxCheckBox(
560 pnKinect, ID_CHECKBOX8, _(
"3D point cloud"), wxDefaultPosition,
561 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX8"));
562 cbKinect_3D->SetValue(
false);
564 cbKinect_3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
565 cbKinect_Depth =
new wxCheckBox(
566 pnKinect, ID_CHECKBOX9, _(
"Depth image"), wxDefaultPosition,
567 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX9"));
568 cbKinect_Depth->SetValue(
false);
570 cbKinect_Depth, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
571 StaticBoxSizer2->Add(
572 FlexGridSizer5, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
574 StaticBoxSizer2, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
576 wxString __wxRadioBoxChoices_3[2] = {_(
"RGB camera"), _(
"IR camera")};
577 rbKinect_int =
new wxRadioBox(
578 pnKinect, ID_RADIOBOX3, _(
"Intensity channel:"), wxDefaultPosition,
579 wxDefaultSize, 2, __wxRadioBoxChoices_3, 1, 0, wxDefaultValidator,
581 rbKinect_int->SetSelection(0);
583 rbKinect_int, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL, 5);
584 pnKinect->SetSizer(FlexGridSizer4);
585 FlexGridSizer4->Fit(pnKinect);
586 FlexGridSizer4->SetSizeHints(pnKinect);
587 pagesCameras->AddPage(Panel2, _(
"Camera (opencv)"),
false);
588 pagesCameras->AddPage(Panel3, _(
"Camera (FFmpeg)"),
false);
589 pagesCameras->AddPage(Panel4, _(
"Camera (custom)"),
false);
590 pagesCameras->AddPage(Panel5, _(
"Video file"),
false);
591 pagesCameras->AddPage(Panel6, _(
"Rawlog file"),
false);
592 pagesCameras->AddPage(Panel1, _(
"Bumblebee"),
false);
593 pagesCameras->AddPage(pnSwissRanger, _(
"SwissRanger ToF"),
false);
594 pagesCameras->AddPage(pnKinect, _(
"Kinect"),
false);
596 pagesCameras, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
597 cbGrayscale =
new wxCheckBox(
598 this, ID_CHECKBOX2, _(
"Capture in grayscale"), wxDefaultPosition,
599 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX2"));
600 cbGrayscale->SetValue(
true);
602 cbGrayscale, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
603 SetSizer(FlexGridSizer1);
604 FlexGridSizer1->Fit(
this);
605 FlexGridSizer1->SetSizeHints(
this);
619 cbOpencvResolution->Clear();
620 cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_(
"default")));
622 cbOpencvResolution->Append(_(
"320x240"));
623 cbOpencvResolution->Append(_(
"640x480"));
624 cbOpencvResolution->Append(_(
"800x600"));
625 cbOpencvResolution->Append(_(
"1024x768"));
626 cbOpencvResolution->Append(_(
"1280x1024"));
632 this, wxT(
"Choose a video to open"), wxT(
"."), wxT(
""),
633 wxT(
"Video files (*.avi;*.mpg;*.mov)|*.avi;*.mpg;*.mov|All files " 635 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
637 if (dialog.ShowModal() == wxID_OK)
edVideoFile->SetValue(dialog.GetPath());
643 this, wxT(
"Choose a rawlog to open"), wxT(
"."), wxT(
""),
644 wxT(
"Rawlog files (*.rawlog;*.rawlog.gz)|*.rawlog;*.rawlog.gz|All " 646 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
648 if (dialog.ShowModal() == wxID_OK)
655 string fil = string(dialog.GetPath().mb_str());
657 fil_path +=
"/Images";
666 this, wxT(
"Choose the rawlog directory with external images"),
669 if (dialog.ShowModal() == wxID_OK)
693 cfg->
write(
sect,
"grabber_type",
"opencv");
695 sect,
"cv_camera_index",
698 sect,
"cv_camera_type",
701 const std::string sRes =
706 const size_t p = sRes.find(
"x");
707 if (p != std::string::npos)
709 const std::string sW = sRes.substr(0, p);
710 const std::string sH = sRes.substr(p + 1);
723 cfg->
write(
sect,
"grabber_type",
"ffmpeg");
726 string(this->
edIPcamURL->GetValue().mb_str()));
737 std::vector<std::string> allSects;
739 for (
const auto& allSect : allSects)
741 std::vector<std::string> keys;
743 for (
const auto& key : keys)
745 allSect, key, cfgIn.
read_string(allSect, key,
""));
754 cfg->
write(
sect,
"grabber_type",
"ffmpeg");
765 cfg->
write(
sect,
"grabber_type",
"rawlog");
770 const string rawlog_lb =
772 if (!rawlog_lb.empty())
773 cfg->
write(
sect,
"rawlog_camera_sensor_label", rawlog_lb);
784 cfg->
write(
sect,
"grabber_type",
"bumblebee");
787 sect,
"bumblebee_mono",
794 sect,
"bumblebee_get_rectified",
803 cfg->
write(
sect,
"grabber_type",
"swissranger");
819 cfg->
write(
sect,
"grabber_type",
"kinect");
826 sect,
"kinect_video_rgb",
833 cerr <<
"[MRPT CPanelCameraSelection] ERROR: Unknown camera " 853 const std::string grab_type =
856 if (grab_type ==
"opencv")
874 else if (grab_type ==
"ffmpeg")
880 if (
url.substr(0, 5) ==
"rtsp:")
891 else if (grab_type ==
"rawlog")
902 else if (grab_type ==
"bumblebee")
911 else if (grab_type ==
"swissranger")
930 "Error: Unknown choice in 'grabber_type': '%s'", grab_type.c_str());
950 #endif // MRPT_HAS_WXWIDGETS wxTextCtrl * edRawlogFile
This class implements a config file-like interface over a memory-stored string list.
Shallow copy: the copied object is a reference to the original one.
static const long ID_BUTTON9
static const long ID_CHOICE1
static const long ID_PANEL3
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
void GetBitmap(wxBitmap &bmp)
#define THROW_EXCEPTION(msg)
std::string std::string format(std::string_view fmt, ARGS &&... args)
wxTextCtrl * edRawlogImgDir
void OnbtnBrowseRawlogDirClick(wxCommandEvent &event)
wxCheckBox * cbSR_chIntensity
const T * ptrLine(unsigned int row) const
Returns a pointer to the first pixel of the given line.
static const long ID_SPINCTRL1
static const long ID_STATICTEXT9
static const long ID_STATICTEXT1
static const long ID_CHECKBOX4
static const long ID_RADIOBOX3
static const long ID_RADIOBOX2
void OnMouseMove(wxMouseEvent &ev)
static const long ID_PANEL1
static const long ID_CHECKBOX1
static const long ID_TEXTCTRL6
TImageChannels getChannelCount() const
Returns the number of channels, typically 1 (GRAY) or 3 (RGB)
size_t getHeight() const override
Returns the height of the image in pixels.
std::string getChannelsOrder() const
As of mrpt 2.0.0, this returns either "GRAY" or "BGR".
static const long ID_NOTEBOOK1
wxPoint m_last_mouse_point
wxPoint m_last_mouse_click
wxMRPTImageControl(wxWindow *parent, wxWindowID winID, int x, int y, int width, int height)
static const long ID_CHECKBOX6
static const long ID_CHECKBOX5
wxImage * MRPTImage2wxImage(const mrpt::img::CImage &img)
Create a wxImage from a MRPT image.
void getAllKeys(const std::string §ion, std::vector< std::string > &keys) const override
Returs a list with all the keys into a section.
mrpt::img::CImage * wxImage2MRPTImage(const wxImage &img)
Create a MRPT image from a wxImage.
static const long ID_CHECKBOX3
static const long ID_TEXTCTRL8
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
static const long ID_TEXTCTRL3
void swapRB()
Swaps red and blue channels.
CImage colorImage() const
Returns a color (RGB) version of the grayscale image, or a shallow copy of itself if it is already a ...
This class allows loading and storing values and vectors of different types from a configuration text...
size_t getWidth() const override
Returns the width of the image in pixels.
static const long ID_TEXTCTRL1
void OnMouseClick(wxMouseEvent &ev)
static const long ID_CHECKBOX8
static const long ID_CHECKBOX7
wxCheckBox * cbKinect_Int
wxChoice * cbOpencvResolution
void OnbtnBrowseVideoClick(wxCommandEvent &event)
void readConfigIntoVideoSourcePanel(const std::string §, const mrpt::config::CConfigFileBase *cfg) const
static const long ID_CHOICE2
wxBitmap * MRPTImage2wxBitmap(const mrpt::img::CImage &img)
Create a wxBitmap from a MRPT image.
static const long ID_STATICTEXT6
wxCheckBox * cbBumblebeeRectif
static const long ID_TEXTCTRL2
static const long ID_CHECKBOX2
static const long ID_PANEL2
static const long ID_STATICTEXT3
void writeConfigFromVideoSourcePanel(const std::string §, mrpt::config::CConfigFileBase *cfg) const
static const long ID_PANEL5
wxRadioBox * rbBumblebeeSel
mrptKeyModifier keyEventToMrptKeyModifier(const wxKeyEvent &ev)
Extracts the key modifiers from a wxKeyEvent.
wxTextCtrl * edCustomCamConfig
static const long ID_STATICTEXT2
void getAllSections(std::vector< std::string > §ions) const override
Returns a list with all the section names.
void write(const std::string §ion, const std::string &name, enum_t value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
static const long ID_STATICTEXT11
wxCheckBox * cbKinect_Depth
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::shared_ptr< mrpt::img ::CImage > Ptr
CImage makeDeepCopy() const
Returns a deep copy of this image.
bool isColor() const
Returns true if the image is RGB, false if it is grayscale.
wxSpinCtrl * opencvCamIndex
static const long ID_STATICTEXT10
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
static const long ID_TEXTCTRL7
size_t getRowStride() const
Returns the row stride of the image: this is the number of bytes between two consecutive rows...
static const long ID_TEXTCTRL4
wxNotebook * pagesCameras
static const long ID_STATICTEXT5
A panel to select the camera input from all the formats supported by MRPT.
void OnPaint(wxPaintEvent &ev)
static const long ID_CHECKBOX9
wxTextCtrl * edRawlogLabel
static const long ID_PANEL8
static const long ID_RADIOBOX1
static const long ID_PANEL4
Classes for creating GUI windows for 2D and 3D visualization.
static const long ID_PANEL7
void OnbtnBrowseRawlogClick(wxCommandEvent &event)
bool directoryExists(const std::string &fileName)
Test if a given directory exists (it fails if the given path refers to an existing file)...
mrpt::img::CImage::Ptr wxImage2MRPTImagePtr(const wxImage &img)
Create a MRPT image from a wxImage.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
~wxMRPTImageControl() override
static const long ID_BUTTON7
static void setImagesPathBase(const std::string &path)
static const long ID_STATICTEXT4
~CPanelCameraSelection() override
wxCheckBox * cbSR_chRange
static const long ID_STATICTEXT7
std::string extractFileDirectory(const std::string &filePath)
Extract the whole path (the directory) of a filename from a complete path plus name plus extension...
wxRadioBox * rbKinect_int
void AssignImage(wxBitmap *img)
Assigns this image.
A class for storing images as grayscale or RGB bitmaps.
static const long ID_PANEL6
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".
static const long ID_BUTTON8
static const long ID_STATICTEXT8
wxChoice * cbOpencvCamType
static struct FontData data