16 #if MRPT_HAS_WXWIDGETS 18 #include <mrpt/otherlibs/do_opencv_includes.h> 45 const int row_in_bytes =
55 if (row_in_bytes != rs)
59 for (
int y = 0;
y < h;
y++,
src += rs, trg += row_in_bytes)
68 return new wxImage(
w, h,
data,
false );
76 auto ret =
new wxBitmap(*i);
91 const size_t lx =
img.GetWidth();
92 const size_t ly =
img.GetHeight();
94 newImg->loadFromMemoryBuffer(
95 lx, ly,
true,
img.GetData(),
true );
112 wxWindow* parent, wxWindowID winID,
int x,
int y,
int width,
int height)
115 this->Create(parent, winID, wxPoint(
x,
y), wxSize(
width,
height));
120 wxID_ANY, wxEVT_LEFT_DOWN,
128 std::lock_guard<std::mutex> lock(
m_img_cs);
150 std::lock_guard<std::mutex> lock(
m_img_cs);
164 std::lock_guard<std::mutex> lock(
m_img_cs);
178 std::lock_guard<std::mutex> lock(
m_img_cs);
185 dc.DrawBitmap(*
m_img, 0, 0);
190 std::lock_guard<std::mutex> lock(
m_img_cs);
255 wxStaticBoxSizer* StaticBoxSizer2;
256 wxFlexGridSizer* FlexGridSizer4;
257 wxFlexGridSizer* FlexGridSizer16;
258 wxFlexGridSizer* FlexGridSizer10;
259 wxFlexGridSizer* FlexGridSizer3;
260 wxFlexGridSizer* FlexGridSizer5;
261 wxFlexGridSizer* FlexGridSizer2;
262 wxFlexGridSizer* FlexGridSizer18;
263 wxFlexGridSizer* FlexGridSizer13;
264 wxFlexGridSizer* FlexGridSizer12;
265 wxStaticBoxSizer* StaticBoxSizer1;
266 wxFlexGridSizer* FlexGridSizer1;
267 wxFlexGridSizer* FlexGridSizer11;
270 parent,
id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
272 FlexGridSizer1 =
new wxFlexGridSizer(0, 1, 0, 0);
273 FlexGridSizer1->AddGrowableCol(0);
274 FlexGridSizer1->AddGrowableRow(0);
275 pagesCameras =
new wxNotebook(
276 this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0,
278 Panel2 =
new wxPanel(
279 pagesCameras, ID_PANEL2, wxDefaultPosition, wxDefaultSize,
280 wxTAB_TRAVERSAL, _T(
"ID_PANEL2"));
281 FlexGridSizer10 =
new wxFlexGridSizer(0, 2, 0, 0);
282 FlexGridSizer10->AddGrowableCol(1);
283 StaticText1 =
new wxStaticText(
284 Panel2, ID_STATICTEXT1, _(
"Camera index:"), wxDefaultPosition,
285 wxDefaultSize, 0, _T(
"ID_STATICTEXT1"));
286 FlexGridSizer10->Add(
287 StaticText1, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
288 opencvCamIndex =
new wxSpinCtrl(
289 Panel2, ID_SPINCTRL1, _T(
"0"), wxDefaultPosition, wxDefaultSize, 0, 0,
290 100, 0, _T(
"ID_SPINCTRL1"));
291 opencvCamIndex->SetValue(_T(
"0"));
292 FlexGridSizer10->Add(
293 opencvCamIndex, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
294 StaticText3 =
new wxStaticText(
295 Panel2, ID_STATICTEXT3, _(
"Camera type:"), wxDefaultPosition,
296 wxDefaultSize, 0, _T(
"ID_STATICTEXT3"));
297 FlexGridSizer10->Add(
299 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
300 cbOpencvCamType =
new wxChoice(
301 Panel2, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0,
nullptr, 0,
302 wxDefaultValidator, _T(
"ID_CHOICE1"));
303 cbOpencvCamType->SetSelection(
304 cbOpencvCamType->Append(_(
"CAMERA_CV_AUTODETECT")));
305 cbOpencvCamType->Append(_(
"CAMERA_CV_DC1394"));
306 cbOpencvCamType->Append(_(
"CAMERA_CV_VFL"));
307 cbOpencvCamType->Append(_(
"CAMERA_CV_VFW"));
308 cbOpencvCamType->Append(_(
"CAMERA_CV_MIL"));
309 cbOpencvCamType->Append(_(
"CAMERA_CV_DSHOW"));
310 FlexGridSizer10->Add(
311 cbOpencvCamType, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
312 StaticText6 =
new wxStaticText(
313 Panel2, ID_STATICTEXT6, _(
"Resolution:"), wxDefaultPosition,
314 wxDefaultSize, 0, _T(
"ID_STATICTEXT6"));
315 FlexGridSizer10->Add(
316 StaticText6, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
317 cbOpencvResolution =
new wxChoice(
318 Panel2, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 0,
nullptr, 0,
319 wxDefaultValidator, _T(
"ID_CHOICE2"));
320 cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_(
"default")));
321 cbOpencvResolution->Append(_(
"320x240"));
322 cbOpencvResolution->Append(_(
"640x480"));
323 FlexGridSizer10->Add(
324 cbOpencvResolution, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
326 FlexGridSizer10->Add(
327 -1, -1, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
329 Panel2->SetSizer(FlexGridSizer10);
330 FlexGridSizer10->Fit(Panel2);
331 FlexGridSizer10->SetSizeHints(Panel2);
332 Panel3 =
new wxPanel(
333 pagesCameras, ID_PANEL3, wxDefaultPosition, wxDefaultSize,
334 wxTAB_TRAVERSAL, _T(
"ID_PANEL3"));
335 FlexGridSizer11 =
new wxFlexGridSizer(0, 1, 0, 0);
336 FlexGridSizer11->AddGrowableCol(0);
337 StaticText7 =
new wxStaticText(
338 Panel3, ID_STATICTEXT7, _(
"IP Camera URL:"), wxDefaultPosition,
339 wxDefaultSize, 0, _T(
"ID_STATICTEXT7"));
340 FlexGridSizer11->Add(
341 StaticText7, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
342 edIPcamURL =
new wxTextCtrl(
343 Panel3, ID_TEXTCTRL1, _(
"rtsp://192.168.0.1/live.sdp"),
344 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
346 FlexGridSizer11->Add(
347 edIPcamURL, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
348 Panel3->SetSizer(FlexGridSizer11);
349 FlexGridSizer11->Fit(Panel3);
350 FlexGridSizer11->SetSizeHints(Panel3);
351 Panel4 =
new wxPanel(
352 pagesCameras, ID_PANEL4, wxDefaultPosition, wxDefaultSize,
353 wxTAB_TRAVERSAL, _T(
"ID_PANEL4"));
354 FlexGridSizer16 =
new wxFlexGridSizer(0, 1, 0, 0);
355 FlexGridSizer16->AddGrowableCol(0);
356 FlexGridSizer16->AddGrowableRow(0);
357 edCustomCamConfig =
new wxTextCtrl(
358 Panel4, ID_TEXTCTRL6,
359 _(
"// Configuration block for the CCameraSensor object.\n// Check out " 360 "its documentation at:\n// " 361 "http://reference.mrpt.org/devel/" 362 "classmrpt_1_1hwdrivers_1_1_c_camera_sensor.html\n\n[CONFIG]" 363 "\ngrabber_type = opencv \ncv_camera_index = 0\ncv_camera_type = " 364 "CAMERA_CV_AUTODETECT\n\n"),
365 wxDefaultPosition, wxDefaultSize,
366 wxTE_MULTILINE | wxHSCROLL | wxTE_DONTWRAP | wxVSCROLL |
368 wxDefaultValidator, _T(
"ID_TEXTCTRL6"));
369 wxFont edCustomCamConfigFont =
370 wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT);
371 if (!edCustomCamConfigFont.Ok())
372 edCustomCamConfigFont =
373 wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
374 edCustomCamConfigFont.SetPointSize(7);
375 edCustomCamConfig->SetFont(edCustomCamConfigFont);
376 FlexGridSizer16->Add(
377 edCustomCamConfig, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
378 Panel4->SetSizer(FlexGridSizer16);
379 FlexGridSizer16->Fit(Panel4);
380 FlexGridSizer16->SetSizeHints(Panel4);
381 Panel5 =
new wxPanel(
382 pagesCameras, ID_PANEL5, wxDefaultPosition, wxDefaultSize,
383 wxTAB_TRAVERSAL, _T(
"ID_PANEL5"));
384 FlexGridSizer12 =
new wxFlexGridSizer(0, 1, 0, 0);
385 FlexGridSizer12->AddGrowableCol(0);
386 StaticText8 =
new wxStaticText(
387 Panel5, ID_STATICTEXT8, _(
"Video file to open:"), wxDefaultPosition,
388 wxDefaultSize, 0, _T(
"ID_STATICTEXT8"));
389 FlexGridSizer12->Add(
390 StaticText8, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
391 edVideoFile =
new wxTextCtrl(
392 Panel5, ID_TEXTCTRL2, _(
"test.avi"), wxDefaultPosition, wxDefaultSize,
393 0, wxDefaultValidator, _T(
"ID_TEXTCTRL2"));
394 FlexGridSizer12->Add(
395 edVideoFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
396 btnBrowseVideo =
new wxButton(
397 Panel5, ID_BUTTON7, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
398 wxDefaultValidator, _T(
"ID_BUTTON7"));
399 FlexGridSizer12->Add(
401 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
402 Panel5->SetSizer(FlexGridSizer12);
403 FlexGridSizer12->Fit(Panel5);
404 FlexGridSizer12->SetSizeHints(Panel5);
405 Panel6 =
new wxPanel(
406 pagesCameras, ID_PANEL6, wxDefaultPosition, wxDefaultSize,
407 wxTAB_TRAVERSAL, _T(
"ID_PANEL6"));
408 FlexGridSizer13 =
new wxFlexGridSizer(0, 3, 0, 0);
409 FlexGridSizer13->AddGrowableCol(1);
410 StaticText9 =
new wxStaticText(
411 Panel6, ID_STATICTEXT9, _(
"Rawlog \nfile:"), wxDefaultPosition,
412 wxDefaultSize, 0, _T(
"ID_STATICTEXT9"));
413 FlexGridSizer13->Add(
414 StaticText9, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
415 edRawlogFile =
new wxTextCtrl(
416 Panel6, ID_TEXTCTRL3, _(
"test.rawlog"), wxDefaultPosition,
417 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL3"));
418 FlexGridSizer13->Add(
419 edRawlogFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
420 btnBrowseRawlog =
new wxButton(
421 Panel6, ID_BUTTON8, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
422 wxDefaultValidator, _T(
"ID_BUTTON8"));
423 FlexGridSizer13->Add(
425 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
426 StaticText5 =
new wxStaticText(
427 Panel6, ID_STATICTEXT5, _(
"External \nimages:"), wxDefaultPosition,
428 wxDefaultSize, 0, _T(
"ID_STATICTEXT5"));
429 FlexGridSizer13->Add(
430 StaticText5, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
431 edRawlogImgDir =
new wxTextCtrl(
432 Panel6, ID_TEXTCTRL7, _(
"./Images"), wxDefaultPosition, wxDefaultSize,
433 0, wxDefaultValidator, _T(
"ID_TEXTCTRL7"));
434 FlexGridSizer13->Add(
435 edRawlogImgDir, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
436 btnBrowseRawlogDir =
new wxButton(
437 Panel6, ID_BUTTON9, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
438 wxDefaultValidator, _T(
"ID_BUTTON9"));
439 FlexGridSizer13->Add(
440 btnBrowseRawlogDir, 1,
441 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
442 StaticText10 =
new wxStaticText(
443 Panel6, ID_STATICTEXT10, _(
"Sensor\nlabel:"), wxDefaultPosition,
444 wxDefaultSize, 0, _T(
"ID_STATICTEXT10"));
445 FlexGridSizer13->Add(
446 StaticText10, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
447 edRawlogLabel =
new wxTextCtrl(
448 Panel6, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize,
449 0, wxDefaultValidator, _T(
"ID_TEXTCTRL8"));
450 FlexGridSizer13->Add(
451 edRawlogLabel, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
452 StaticText11 =
new wxStaticText(
453 Panel6, ID_STATICTEXT11, _(
"(empty=any)"), wxDefaultPosition,
454 wxDefaultSize, 0, _T(
"ID_STATICTEXT11"));
455 FlexGridSizer13->Add(
457 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
458 Panel6->SetSizer(FlexGridSizer13);
459 FlexGridSizer13->Fit(Panel6);
460 FlexGridSizer13->SetSizeHints(Panel6);
461 Panel1 =
new wxPanel(
462 pagesCameras, ID_PANEL7, wxDefaultPosition, wxDefaultSize,
463 wxTAB_TRAVERSAL, _T(
"ID_PANEL7"));
464 FlexGridSizer18 =
new wxFlexGridSizer(2, 2, 0, 0);
465 wxString __wxRadioBoxChoices_1[2] = {_(
"Left"), _(
"Right")};
466 rbBumblebeeSel =
new wxRadioBox(
467 Panel1, ID_RADIOBOX1, _(
"Select monocular input"), wxDefaultPosition,
468 wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator,
470 rbBumblebeeSel->SetSelection(0);
471 FlexGridSizer18->Add(
473 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
474 cbBumblebeeRectif =
new wxCheckBox(
475 Panel1, ID_CHECKBOX1, _(
"Use vendor\'s rectify"), wxDefaultPosition,
476 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX1"));
477 cbBumblebeeRectif->SetValue(
false);
478 FlexGridSizer18->Add(
479 cbBumblebeeRectif, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL,
481 FlexGridSizer18->Add(-1, -1, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
482 StaticText2 =
new wxStaticText(
483 Panel1, ID_STATICTEXT2, _(
"(Unchecked = raw images)"),
484 wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT2"));
485 FlexGridSizer18->Add(
486 StaticText2, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
487 Panel1->SetSizer(FlexGridSizer18);
488 FlexGridSizer18->Fit(Panel1);
489 FlexGridSizer18->SetSizeHints(Panel1);
490 pnSwissRanger =
new wxPanel(
491 pagesCameras, ID_PANEL1, wxDefaultPosition, wxDefaultSize,
492 wxTAB_TRAVERSAL, _T(
"ID_PANEL1"));
493 FlexGridSizer2 =
new wxFlexGridSizer(2, 3, 0, 0);
494 wxString __wxRadioBoxChoices_2[2] = {_(
"USB"), _(
"Ethernet")};
495 rbSR_usb =
new wxRadioBox(
496 pnSwissRanger, ID_RADIOBOX2, _(
"Connection"), wxDefaultPosition,
497 wxDefaultSize, 2, __wxRadioBoxChoices_2, 1, 0, wxDefaultValidator,
500 rbSR_usb, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
501 StaticText4 =
new wxStaticText(
502 pnSwissRanger, ID_STATICTEXT4, _(
"IP:"), wxDefaultPosition,
503 wxDefaultSize, 0, _T(
"ID_STATICTEXT4"));
505 StaticText4, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
506 edSR_IP =
new wxTextCtrl(
507 pnSwissRanger, ID_TEXTCTRL4, _(
"192.168.2.14"), wxDefaultPosition,
508 wxSize(120, -1), 0, wxDefaultValidator, _T(
"ID_TEXTCTRL4"));
510 edSR_IP, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
511 StaticBoxSizer1 =
new wxStaticBoxSizer(
512 wxHORIZONTAL, pnSwissRanger, _(
"Channels to grab: "));
513 FlexGridSizer3 =
new wxFlexGridSizer(4, 1, 0, 0);
514 cbSR_chIntensity =
new wxCheckBox(
515 pnSwissRanger, ID_CHECKBOX3, _(
"Grayscale intensity"),
516 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
518 cbSR_chIntensity->SetValue(
true);
519 cbSR_chIntensity->Disable();
521 cbSR_chIntensity, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
522 cbSR_ch3D =
new wxCheckBox(
523 pnSwissRanger, ID_CHECKBOX4, _(
"3D point cloud"), wxDefaultPosition,
524 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX4"));
525 cbSR_ch3D->SetValue(
false);
526 FlexGridSizer3->Add(cbSR_ch3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
527 cbSR_chRange =
new wxCheckBox(
528 pnSwissRanger, ID_CHECKBOX5, _(
"Depth image"), wxDefaultPosition,
529 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX5"));
530 cbSR_chRange->SetValue(
false);
532 cbSR_chRange, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
533 cbSR_chConf =
new wxCheckBox(
534 pnSwissRanger, ID_CHECKBOX6, _(
"Confidence"), wxDefaultPosition,
535 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX6"));
536 cbSR_chConf->SetValue(
false);
538 cbSR_chConf, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
539 StaticBoxSizer1->Add(
540 FlexGridSizer3, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
542 StaticBoxSizer1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
544 pnSwissRanger->SetSizer(FlexGridSizer2);
545 FlexGridSizer2->Fit(pnSwissRanger);
546 FlexGridSizer2->SetSizeHints(pnSwissRanger);
547 pnKinect =
new wxPanel(
548 pagesCameras, ID_PANEL8, wxDefaultPosition, wxDefaultSize,
549 wxTAB_TRAVERSAL, _T(
"ID_PANEL8"));
550 FlexGridSizer4 =
new wxFlexGridSizer(2, 3, 0, 0);
552 new wxStaticBoxSizer(wxHORIZONTAL, pnKinect, _(
"Channels to grab: "));
553 FlexGridSizer5 =
new wxFlexGridSizer(4, 1, 0, 0);
554 cbKinect_Int =
new wxCheckBox(
555 pnKinect, ID_CHECKBOX7, _(
"Intensity"), wxDefaultPosition,
556 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX7"));
557 cbKinect_Int->SetValue(
true);
558 cbKinect_Int->Disable();
560 cbKinect_Int, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
561 cbKinect_3D =
new wxCheckBox(
562 pnKinect, ID_CHECKBOX8, _(
"3D point cloud"), wxDefaultPosition,
563 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX8"));
564 cbKinect_3D->SetValue(
false);
566 cbKinect_3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
567 cbKinect_Depth =
new wxCheckBox(
568 pnKinect, ID_CHECKBOX9, _(
"Depth image"), wxDefaultPosition,
569 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX9"));
570 cbKinect_Depth->SetValue(
false);
572 cbKinect_Depth, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
573 StaticBoxSizer2->Add(
574 FlexGridSizer5, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
576 StaticBoxSizer2, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
578 wxString __wxRadioBoxChoices_3[2] = {_(
"RGB camera"), _(
"IR camera")};
579 rbKinect_int =
new wxRadioBox(
580 pnKinect, ID_RADIOBOX3, _(
"Intensity channel:"), wxDefaultPosition,
581 wxDefaultSize, 2, __wxRadioBoxChoices_3, 1, 0, wxDefaultValidator,
583 rbKinect_int->SetSelection(0);
585 rbKinect_int, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL, 5);
586 pnKinect->SetSizer(FlexGridSizer4);
587 FlexGridSizer4->Fit(pnKinect);
588 FlexGridSizer4->SetSizeHints(pnKinect);
589 pagesCameras->AddPage(Panel2, _(
"Camera (opencv)"),
false);
590 pagesCameras->AddPage(Panel3, _(
"Camera (FFmpeg)"),
false);
591 pagesCameras->AddPage(Panel4, _(
"Camera (custom)"),
false);
592 pagesCameras->AddPage(Panel5, _(
"Video file"),
false);
593 pagesCameras->AddPage(Panel6, _(
"Rawlog file"),
false);
594 pagesCameras->AddPage(Panel1, _(
"Bumblebee"),
false);
595 pagesCameras->AddPage(pnSwissRanger, _(
"SwissRanger ToF"),
false);
596 pagesCameras->AddPage(pnKinect, _(
"Kinect"),
false);
598 pagesCameras, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
599 cbGrayscale =
new wxCheckBox(
600 this, ID_CHECKBOX2, _(
"Capture in grayscale"), wxDefaultPosition,
601 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX2"));
602 cbGrayscale->SetValue(
true);
604 cbGrayscale, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
605 SetSizer(FlexGridSizer1);
606 FlexGridSizer1->Fit(
this);
607 FlexGridSizer1->SetSizeHints(
this);
610 ID_BUTTON7, wxEVT_COMMAND_BUTTON_CLICKED,
613 ID_BUTTON8, wxEVT_COMMAND_BUTTON_CLICKED,
616 ID_BUTTON9, wxEVT_COMMAND_BUTTON_CLICKED,
618 OnbtnBrowseRawlogDirClick);
622 cbOpencvResolution->Clear();
623 cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_(
"default")));
625 cbOpencvResolution->Append(_(
"320x240"));
626 cbOpencvResolution->Append(_(
"640x480"));
627 cbOpencvResolution->Append(_(
"800x600"));
628 cbOpencvResolution->Append(_(
"1024x768"));
629 cbOpencvResolution->Append(_(
"1280x1024"));
635 this, wxT(
"Choose a video to open"), wxT(
"."), wxT(
""),
636 wxT(
"Video files (*.avi;*.mpg;*.mov)|*.avi;*.mpg;*.mov|All files " 638 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
640 if (dialog.ShowModal() == wxID_OK)
edVideoFile->SetValue(dialog.GetPath());
646 this, wxT(
"Choose a rawlog to open"), wxT(
"."), wxT(
""),
647 wxT(
"Rawlog files (*.rawlog;*.rawlog.gz)|*.rawlog;*.rawlog.gz|All " 649 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
651 if (dialog.ShowModal() == wxID_OK)
658 string fil =
string(dialog.GetPath().mb_str());
660 fil_path +=
"/Images";
669 this, wxT(
"Choose the rawlog directory with external images"),
672 if (dialog.ShowModal() == wxID_OK)
696 cfg->
write(sect,
"grabber_type",
"opencv");
698 sect,
"cv_camera_index",
701 sect,
"cv_camera_type",
709 const size_t p = sRes.find(
"x");
710 if (
p != std::string::npos)
715 cfg->
write(sect,
"cv_frame_width", sW);
716 cfg->
write(sect,
"cv_frame_height", sH);
726 cfg->
write(sect,
"grabber_type",
"ffmpeg");
729 string(this->
edIPcamURL->GetValue().mb_str()));
740 std::vector<std::string> allSects;
742 for (
const auto& allSect : allSects)
744 std::vector<std::string> keys;
746 for (
const auto& key : keys)
748 allSect, key, cfgIn.
read_string(allSect, key,
""));
757 cfg->
write(sect,
"grabber_type",
"ffmpeg");
768 cfg->
write(sect,
"grabber_type",
"rawlog");
773 const string rawlog_lb =
775 if (!rawlog_lb.empty())
776 cfg->
write(sect,
"rawlog_camera_sensor_label", rawlog_lb);
787 cfg->
write(sect,
"grabber_type",
"bumblebee");
790 sect,
"bumblebee_mono",
795 cfg->
write(sect,
"bumblebee_fps", 15);
797 sect,
"bumblebee_get_rectified",
806 cfg->
write(sect,
"grabber_type",
"swissranger");
808 cfg->
write(sect,
"sr_use_usb",
rbSR_usb->GetSelection() == 0);
809 cfg->
write(sect,
"sr_IP",
string(
edSR_IP->GetValue().mb_str()));
822 cfg->
write(sect,
"grabber_type",
"kinect");
829 sect,
"kinect_video_rgb",
836 cerr <<
"[MRPT CPanelCameraSelection] ERROR: Unknown camera " 859 if (grab_type ==
"opencv")
864 cfg->
read_int(sect,
"cv_camera_index", 0));
866 cfg->
read_string(sect,
"cv_camera_type",
"").c_str());
868 const int w = cfg->
read_int(sect,
"cv_frame_width", 0);
877 else if (grab_type ==
"ffmpeg")
881 cfg->
read_string(sect,
"ffmpeg_url",
"rtsp://192.168.0.1/live.sdp");
883 if (
url.substr(0, 5) ==
"rtsp:")
894 else if (grab_type ==
"rawlog")
899 cfg->
read_string(sect,
"rawlog_file",
"").c_str());
902 cfg->
read_string(sect,
"rawlog_camera_sensor_label",
"");
905 else if (grab_type ==
"bumblebee")
910 cfg->
read_int(sect,
"bumblebee_mono", 0));
912 cfg->
read_bool(sect,
"bumblebee_get_rectified",
false));
914 else if (grab_type ==
"swissranger")
919 cfg->
read_bool(sect,
"sr_use_usb",
true) ? 0 : 1);
921 cfg->
read_string(sect,
"sr_IP",
"192.168.0.1").c_str());
924 cfg->
read_bool(sect,
"sr_grab_grayscale",
true));
927 cfg->
read_bool(sect,
"sr_grab_range",
false));
929 cfg->
read_bool(sect,
"sr_grab_confidence",
false));
933 "Error: Unknown choice in 'grabber_type': '%s'", grab_type.c_str());
937 cfg->
read_bool(sect,
"capture_grayscale",
false));
953 #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)
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.
GLubyte GLubyte GLubyte GLubyte w
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
std::shared_ptr< CImage > Ptr
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
GLsizei const GLchar ** string
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.
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
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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
GLenum GLsizei GLenum format
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.
GLenum GLsizei GLsizei height
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
~wxMRPTImageControl() override
static const long ID_BUTTON7
GLsizei GLsizei GLenum GLenum const GLvoid * data
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