16 #if MRPT_HAS_WXWIDGETS 18 #include <mrpt/otherlibs/do_opencv_includes.h> 32 IplImage*
image =
const_cast<IplImage*
>(
img.getAs<IplImage>());
33 bool free_image_at_end =
false;
37 if (
image->nChannels == 1)
41 new_image->origin =
image->origin;
42 cvCvtColor(
image, new_image, CV_GRAY2RGB);
44 free_image_at_end =
true;
48 if (
image->origin == 1) options |= CV_CVTIMG_FLIP;
49 if (
image->nChannels == 3 &&
image->channelSeq[0] ==
'B' &&
50 image->channelSeq[2] ==
'R')
51 options |= CV_CVTIMG_SWAP_RB;
54 IplImage* the_input_img =
image;
56 image = cvCreateImage(
57 cvSize(the_input_img->width, the_input_img->height),
58 the_input_img->depth, 3);
59 if (the_input_img->width && the_input_img->height)
60 cvConvertImage(the_input_img,
image, options);
62 if (free_image_at_end) cvReleaseImage(&the_input_img);
63 free_image_at_end =
true;
66 int row_in_bytes =
image->width *
image->nChannels;
67 unsigned char*
data = (
unsigned char*)malloc(row_in_bytes *
image->height);
70 if (row_in_bytes !=
image->widthStep)
72 unsigned char* trg =
data;
74 for (
int y = 0;
y <
image->height;
75 y++,
src +=
image->widthStep, trg += row_in_bytes)
84 int h =
image->height;
86 if (free_image_at_end)
88 cvReleaseImage(&
image);
96 int x,
y, lx =
img.getWidth(), ly =
img.getHeight();
97 unsigned char* imgData = (
unsigned char*)malloc(3 * lx * ly);
98 unsigned char* imgPtr = imgData;
103 if (
img.isOriginTopLeft())
105 for (
y = 0;
y < ly;
y++)
107 for (
x = 0;
x < lx;
x++)
109 *(imgPtr++) = *
img(
x,
y, 2);
110 *(imgPtr++) = *
img(
x,
y, 1);
111 *(imgPtr++) = *
img(
x,
y, 0);
117 for (
y = ly - 1;
y >= 0;
y--)
119 for (
x = 0;
x < lx;
x++)
121 *(imgPtr++) = *
img(
x,
y, 2);
122 *(imgPtr++) = *
img(
x,
y, 1);
123 *(imgPtr++) = *
img(
x,
y, 0);
131 if (
img.isOriginTopLeft())
133 for (
y = 0;
y < ly;
y++)
135 for (
x = 0;
x < lx;
x++)
137 unsigned char c = *
img(
x,
y);
146 for (
y = ly - 1;
y >= 0;
y--)
148 for (
x = 0;
x < lx;
x++)
150 unsigned char c = *
img(
x,
y);
171 IplImage*
image =
const_cast<IplImage*
>(
img.getAs<IplImage>());
172 bool free_image_at_end =
false;
176 if (
image->nChannels == 1)
178 IplImage* new_image =
180 new_image->origin =
image->origin;
181 cvCvtColor(
image, new_image, CV_GRAY2RGB);
183 free_image_at_end =
true;
187 if (
image->origin == 1) options |= CV_CVTIMG_FLIP;
188 if (
image->nChannels == 3 &&
image->channelSeq[0] ==
'B' &&
189 image->channelSeq[2] ==
'R')
190 options |= CV_CVTIMG_SWAP_RB;
193 IplImage* the_input_img =
image;
195 image = cvCreateImage(
196 cvSize(the_input_img->width, the_input_img->height),
197 the_input_img->depth, 3);
198 cvConvertImage(the_input_img,
image, options);
200 if (free_image_at_end) cvReleaseImage(&the_input_img);
201 free_image_at_end =
true;
204 int row_in_bytes =
image->width *
image->nChannels;
205 unsigned char*
data = (
unsigned char*)malloc(row_in_bytes *
image->height);
208 if (row_in_bytes !=
image->widthStep)
210 unsigned char* trg =
data;
212 for (
int y = 0;
y <
image->height;
213 y++,
src +=
image->widthStep, trg += row_in_bytes)
222 int h =
image->height;
224 if (free_image_at_end)
226 cvReleaseImage(&
image);
230 return new wxBitmap(wxImage(
w, h,
data,
false));
239 IplImage*
image =
static_cast<IplImage*
>(
img);
246 if (
image->origin == 1) options |= CV_CVTIMG_FLIP;
247 if (
image->channelSeq[0] ==
'B' &&
image->channelSeq[2] ==
'R')
248 options |= CV_CVTIMG_SWAP_RB;
255 unsigned char* imageData =
256 (
unsigned char*)malloc(row_bytes *
image->height);
260 if (row_bytes !=
image->widthStep)
262 for (
int y = 0;
y <
image->height;
y++)
264 (imageData +
y * row_bytes),
265 (
image->imageData +
y *
image->widthStep), row_bytes);
273 return new wxImage(
image->width,
image->height, imageData,
false);
284 const size_t lx =
img.GetWidth();
285 const size_t ly =
img.GetHeight();
288 lx, ly,
true,
img.GetData(),
true );
305 wxWindow* parent, wxWindowID winID,
int x,
int y,
int width,
int height)
308 this->Create(parent, winID, wxPoint(
x,
y), wxSize(
width,
height));
313 wxID_ANY, wxEVT_LEFT_DOWN,
321 std::lock_guard<std::mutex> lock(
m_img_cs);
343 std::lock_guard<std::mutex> lock(
m_img_cs);
357 std::lock_guard<std::mutex> lock(
m_img_cs);
371 std::lock_guard<std::mutex> lock(
m_img_cs);
378 dc.DrawBitmap(*
m_img, 0, 0);
383 std::lock_guard<std::mutex> lock(
m_img_cs);
448 wxStaticBoxSizer* StaticBoxSizer2;
449 wxFlexGridSizer* FlexGridSizer4;
450 wxFlexGridSizer* FlexGridSizer16;
451 wxFlexGridSizer* FlexGridSizer10;
452 wxFlexGridSizer* FlexGridSizer3;
453 wxFlexGridSizer* FlexGridSizer5;
454 wxFlexGridSizer* FlexGridSizer2;
455 wxFlexGridSizer* FlexGridSizer18;
456 wxFlexGridSizer* FlexGridSizer13;
457 wxFlexGridSizer* FlexGridSizer12;
458 wxStaticBoxSizer* StaticBoxSizer1;
459 wxFlexGridSizer* FlexGridSizer1;
460 wxFlexGridSizer* FlexGridSizer11;
463 parent,
id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
465 FlexGridSizer1 =
new wxFlexGridSizer(0, 1, 0, 0);
466 FlexGridSizer1->AddGrowableCol(0);
467 FlexGridSizer1->AddGrowableRow(0);
468 pagesCameras =
new wxNotebook(
469 this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0,
471 Panel2 =
new wxPanel(
472 pagesCameras, ID_PANEL2, wxDefaultPosition, wxDefaultSize,
473 wxTAB_TRAVERSAL, _T(
"ID_PANEL2"));
474 FlexGridSizer10 =
new wxFlexGridSizer(0, 2, 0, 0);
475 FlexGridSizer10->AddGrowableCol(1);
476 StaticText1 =
new wxStaticText(
477 Panel2, ID_STATICTEXT1, _(
"Camera index:"), wxDefaultPosition,
478 wxDefaultSize, 0, _T(
"ID_STATICTEXT1"));
479 FlexGridSizer10->Add(
480 StaticText1, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
481 opencvCamIndex =
new wxSpinCtrl(
482 Panel2, ID_SPINCTRL1, _T(
"0"), wxDefaultPosition, wxDefaultSize, 0, 0,
483 100, 0, _T(
"ID_SPINCTRL1"));
484 opencvCamIndex->SetValue(_T(
"0"));
485 FlexGridSizer10->Add(
486 opencvCamIndex, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
487 StaticText3 =
new wxStaticText(
488 Panel2, ID_STATICTEXT3, _(
"Camera type:"), wxDefaultPosition,
489 wxDefaultSize, 0, _T(
"ID_STATICTEXT3"));
490 FlexGridSizer10->Add(
492 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
493 cbOpencvCamType =
new wxChoice(
494 Panel2, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, 0, 0,
495 wxDefaultValidator, _T(
"ID_CHOICE1"));
496 cbOpencvCamType->SetSelection(
497 cbOpencvCamType->Append(_(
"CAMERA_CV_AUTODETECT")));
498 cbOpencvCamType->Append(_(
"CAMERA_CV_DC1394"));
499 cbOpencvCamType->Append(_(
"CAMERA_CV_VFL"));
500 cbOpencvCamType->Append(_(
"CAMERA_CV_VFW"));
501 cbOpencvCamType->Append(_(
"CAMERA_CV_MIL"));
502 cbOpencvCamType->Append(_(
"CAMERA_CV_DSHOW"));
503 FlexGridSizer10->Add(
504 cbOpencvCamType, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
505 StaticText6 =
new wxStaticText(
506 Panel2, ID_STATICTEXT6, _(
"Resolution:"), wxDefaultPosition,
507 wxDefaultSize, 0, _T(
"ID_STATICTEXT6"));
508 FlexGridSizer10->Add(
509 StaticText6, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
510 cbOpencvResolution =
new wxChoice(
511 Panel2, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 0, 0, 0,
512 wxDefaultValidator, _T(
"ID_CHOICE2"));
513 cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_(
"default")));
514 cbOpencvResolution->Append(_(
"320x240"));
515 cbOpencvResolution->Append(_(
"640x480"));
516 FlexGridSizer10->Add(
517 cbOpencvResolution, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
519 FlexGridSizer10->Add(
520 -1, -1, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
522 Panel2->SetSizer(FlexGridSizer10);
523 FlexGridSizer10->Fit(Panel2);
524 FlexGridSizer10->SetSizeHints(Panel2);
525 Panel3 =
new wxPanel(
526 pagesCameras, ID_PANEL3, wxDefaultPosition, wxDefaultSize,
527 wxTAB_TRAVERSAL, _T(
"ID_PANEL3"));
528 FlexGridSizer11 =
new wxFlexGridSizer(0, 1, 0, 0);
529 FlexGridSizer11->AddGrowableCol(0);
530 StaticText7 =
new wxStaticText(
531 Panel3, ID_STATICTEXT7, _(
"IP Camera URL:"), wxDefaultPosition,
532 wxDefaultSize, 0, _T(
"ID_STATICTEXT7"));
533 FlexGridSizer11->Add(
534 StaticText7, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
535 edIPcamURL =
new wxTextCtrl(
536 Panel3, ID_TEXTCTRL1, _(
"rtsp://192.168.0.1/live.sdp"),
537 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
539 FlexGridSizer11->Add(
540 edIPcamURL, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
541 Panel3->SetSizer(FlexGridSizer11);
542 FlexGridSizer11->Fit(Panel3);
543 FlexGridSizer11->SetSizeHints(Panel3);
544 Panel4 =
new wxPanel(
545 pagesCameras, ID_PANEL4, wxDefaultPosition, wxDefaultSize,
546 wxTAB_TRAVERSAL, _T(
"ID_PANEL4"));
547 FlexGridSizer16 =
new wxFlexGridSizer(0, 1, 0, 0);
548 FlexGridSizer16->AddGrowableCol(0);
549 FlexGridSizer16->AddGrowableRow(0);
550 edCustomCamConfig =
new wxTextCtrl(
551 Panel4, ID_TEXTCTRL6,
552 _(
"// Configuration block for the CCameraSensor object.\n// Check out " 553 "its documentation at:\n// " 554 "http://reference.mrpt.org/devel/" 555 "classmrpt_1_1hwdrivers_1_1_c_camera_sensor.html\n\n[CONFIG]" 556 "\ngrabber_type = opencv \ncv_camera_index = 0\ncv_camera_type = " 557 "CAMERA_CV_AUTODETECT\n\n"),
558 wxDefaultPosition, wxDefaultSize,
559 wxTE_MULTILINE | wxHSCROLL | wxTE_DONTWRAP | wxVSCROLL |
561 wxDefaultValidator, _T(
"ID_TEXTCTRL6"));
562 wxFont edCustomCamConfigFont =
563 wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT);
564 if (!edCustomCamConfigFont.Ok())
565 edCustomCamConfigFont =
566 wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
567 edCustomCamConfigFont.SetPointSize(7);
568 edCustomCamConfig->SetFont(edCustomCamConfigFont);
569 FlexGridSizer16->Add(
570 edCustomCamConfig, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
571 Panel4->SetSizer(FlexGridSizer16);
572 FlexGridSizer16->Fit(Panel4);
573 FlexGridSizer16->SetSizeHints(Panel4);
574 Panel5 =
new wxPanel(
575 pagesCameras, ID_PANEL5, wxDefaultPosition, wxDefaultSize,
576 wxTAB_TRAVERSAL, _T(
"ID_PANEL5"));
577 FlexGridSizer12 =
new wxFlexGridSizer(0, 1, 0, 0);
578 FlexGridSizer12->AddGrowableCol(0);
579 StaticText8 =
new wxStaticText(
580 Panel5, ID_STATICTEXT8, _(
"Video file to open:"), wxDefaultPosition,
581 wxDefaultSize, 0, _T(
"ID_STATICTEXT8"));
582 FlexGridSizer12->Add(
583 StaticText8, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
584 edVideoFile =
new wxTextCtrl(
585 Panel5, ID_TEXTCTRL2, _(
"test.avi"), wxDefaultPosition, wxDefaultSize,
586 0, wxDefaultValidator, _T(
"ID_TEXTCTRL2"));
587 FlexGridSizer12->Add(
588 edVideoFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
589 btnBrowseVideo =
new wxButton(
590 Panel5, ID_BUTTON7, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
591 wxDefaultValidator, _T(
"ID_BUTTON7"));
592 FlexGridSizer12->Add(
594 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
595 Panel5->SetSizer(FlexGridSizer12);
596 FlexGridSizer12->Fit(Panel5);
597 FlexGridSizer12->SetSizeHints(Panel5);
598 Panel6 =
new wxPanel(
599 pagesCameras, ID_PANEL6, wxDefaultPosition, wxDefaultSize,
600 wxTAB_TRAVERSAL, _T(
"ID_PANEL6"));
601 FlexGridSizer13 =
new wxFlexGridSizer(0, 3, 0, 0);
602 FlexGridSizer13->AddGrowableCol(1);
603 StaticText9 =
new wxStaticText(
604 Panel6, ID_STATICTEXT9, _(
"Rawlog \nfile:"), wxDefaultPosition,
605 wxDefaultSize, 0, _T(
"ID_STATICTEXT9"));
606 FlexGridSizer13->Add(
607 StaticText9, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
608 edRawlogFile =
new wxTextCtrl(
609 Panel6, ID_TEXTCTRL3, _(
"test.rawlog"), wxDefaultPosition,
610 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL3"));
611 FlexGridSizer13->Add(
612 edRawlogFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
613 btnBrowseRawlog =
new wxButton(
614 Panel6, ID_BUTTON8, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
615 wxDefaultValidator, _T(
"ID_BUTTON8"));
616 FlexGridSizer13->Add(
618 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
619 StaticText5 =
new wxStaticText(
620 Panel6, ID_STATICTEXT5, _(
"External \nimages:"), wxDefaultPosition,
621 wxDefaultSize, 0, _T(
"ID_STATICTEXT5"));
622 FlexGridSizer13->Add(
623 StaticText5, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
624 edRawlogImgDir =
new wxTextCtrl(
625 Panel6, ID_TEXTCTRL7, _(
"./Images"), wxDefaultPosition, wxDefaultSize,
626 0, wxDefaultValidator, _T(
"ID_TEXTCTRL7"));
627 FlexGridSizer13->Add(
628 edRawlogImgDir, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
629 btnBrowseRawlogDir =
new wxButton(
630 Panel6, ID_BUTTON9, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0,
631 wxDefaultValidator, _T(
"ID_BUTTON9"));
632 FlexGridSizer13->Add(
633 btnBrowseRawlogDir, 1,
634 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
635 StaticText10 =
new wxStaticText(
636 Panel6, ID_STATICTEXT10, _(
"Sensor\nlabel:"), wxDefaultPosition,
637 wxDefaultSize, 0, _T(
"ID_STATICTEXT10"));
638 FlexGridSizer13->Add(
639 StaticText10, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
640 edRawlogLabel =
new wxTextCtrl(
641 Panel6, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize,
642 0, wxDefaultValidator, _T(
"ID_TEXTCTRL8"));
643 FlexGridSizer13->Add(
644 edRawlogLabel, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
645 StaticText11 =
new wxStaticText(
646 Panel6, ID_STATICTEXT11, _(
"(empty=any)"), wxDefaultPosition,
647 wxDefaultSize, 0, _T(
"ID_STATICTEXT11"));
648 FlexGridSizer13->Add(
650 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
651 Panel6->SetSizer(FlexGridSizer13);
652 FlexGridSizer13->Fit(Panel6);
653 FlexGridSizer13->SetSizeHints(Panel6);
654 Panel1 =
new wxPanel(
655 pagesCameras, ID_PANEL7, wxDefaultPosition, wxDefaultSize,
656 wxTAB_TRAVERSAL, _T(
"ID_PANEL7"));
657 FlexGridSizer18 =
new wxFlexGridSizer(2, 2, 0, 0);
658 wxString __wxRadioBoxChoices_1[2] = {_(
"Left"), _(
"Right")};
659 rbBumblebeeSel =
new wxRadioBox(
660 Panel1, ID_RADIOBOX1, _(
"Select monocular input"), wxDefaultPosition,
661 wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator,
663 rbBumblebeeSel->SetSelection(0);
664 FlexGridSizer18->Add(
666 wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
667 cbBumblebeeRectif =
new wxCheckBox(
668 Panel1, ID_CHECKBOX1, _(
"Use vendor\'s rectify"), wxDefaultPosition,
669 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX1"));
670 cbBumblebeeRectif->SetValue(
false);
671 FlexGridSizer18->Add(
672 cbBumblebeeRectif, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL,
674 FlexGridSizer18->Add(-1, -1, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
675 StaticText2 =
new wxStaticText(
676 Panel1, ID_STATICTEXT2, _(
"(Unchecked = raw images)"),
677 wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT2"));
678 FlexGridSizer18->Add(
679 StaticText2, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
680 Panel1->SetSizer(FlexGridSizer18);
681 FlexGridSizer18->Fit(Panel1);
682 FlexGridSizer18->SetSizeHints(Panel1);
683 pnSwissRanger =
new wxPanel(
684 pagesCameras, ID_PANEL1, wxDefaultPosition, wxDefaultSize,
685 wxTAB_TRAVERSAL, _T(
"ID_PANEL1"));
686 FlexGridSizer2 =
new wxFlexGridSizer(2, 3, 0, 0);
687 wxString __wxRadioBoxChoices_2[2] = {_(
"USB"), _(
"Ethernet")};
688 rbSR_usb =
new wxRadioBox(
689 pnSwissRanger, ID_RADIOBOX2, _(
"Connection"), wxDefaultPosition,
690 wxDefaultSize, 2, __wxRadioBoxChoices_2, 1, 0, wxDefaultValidator,
693 rbSR_usb, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
694 StaticText4 =
new wxStaticText(
695 pnSwissRanger, ID_STATICTEXT4, _(
"IP:"), wxDefaultPosition,
696 wxDefaultSize, 0, _T(
"ID_STATICTEXT4"));
698 StaticText4, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
699 edSR_IP =
new wxTextCtrl(
700 pnSwissRanger, ID_TEXTCTRL4, _(
"192.168.2.14"), wxDefaultPosition,
701 wxSize(120, -1), 0, wxDefaultValidator, _T(
"ID_TEXTCTRL4"));
703 edSR_IP, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
704 StaticBoxSizer1 =
new wxStaticBoxSizer(
705 wxHORIZONTAL, pnSwissRanger, _(
"Channels to grab: "));
706 FlexGridSizer3 =
new wxFlexGridSizer(4, 1, 0, 0);
707 cbSR_chIntensity =
new wxCheckBox(
708 pnSwissRanger, ID_CHECKBOX3, _(
"Grayscale intensity"),
709 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
711 cbSR_chIntensity->SetValue(
true);
712 cbSR_chIntensity->Disable();
714 cbSR_chIntensity, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
715 cbSR_ch3D =
new wxCheckBox(
716 pnSwissRanger, ID_CHECKBOX4, _(
"3D point cloud"), wxDefaultPosition,
717 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX4"));
718 cbSR_ch3D->SetValue(
false);
719 FlexGridSizer3->Add(cbSR_ch3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
720 cbSR_chRange =
new wxCheckBox(
721 pnSwissRanger, ID_CHECKBOX5, _(
"Depth image"), wxDefaultPosition,
722 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX5"));
723 cbSR_chRange->SetValue(
false);
725 cbSR_chRange, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
726 cbSR_chConf =
new wxCheckBox(
727 pnSwissRanger, ID_CHECKBOX6, _(
"Confidence"), wxDefaultPosition,
728 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX6"));
729 cbSR_chConf->SetValue(
false);
731 cbSR_chConf, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
732 StaticBoxSizer1->Add(
733 FlexGridSizer3, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
735 StaticBoxSizer1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
737 pnSwissRanger->SetSizer(FlexGridSizer2);
738 FlexGridSizer2->Fit(pnSwissRanger);
739 FlexGridSizer2->SetSizeHints(pnSwissRanger);
740 pnKinect =
new wxPanel(
741 pagesCameras, ID_PANEL8, wxDefaultPosition, wxDefaultSize,
742 wxTAB_TRAVERSAL, _T(
"ID_PANEL8"));
743 FlexGridSizer4 =
new wxFlexGridSizer(2, 3, 0, 0);
745 new wxStaticBoxSizer(wxHORIZONTAL, pnKinect, _(
"Channels to grab: "));
746 FlexGridSizer5 =
new wxFlexGridSizer(4, 1, 0, 0);
747 cbKinect_Int =
new wxCheckBox(
748 pnKinect, ID_CHECKBOX7, _(
"Intensity"), wxDefaultPosition,
749 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX7"));
750 cbKinect_Int->SetValue(
true);
751 cbKinect_Int->Disable();
753 cbKinect_Int, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
754 cbKinect_3D =
new wxCheckBox(
755 pnKinect, ID_CHECKBOX8, _(
"3D point cloud"), wxDefaultPosition,
756 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX8"));
757 cbKinect_3D->SetValue(
false);
759 cbKinect_3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
760 cbKinect_Depth =
new wxCheckBox(
761 pnKinect, ID_CHECKBOX9, _(
"Depth image"), wxDefaultPosition,
762 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX9"));
763 cbKinect_Depth->SetValue(
false);
765 cbKinect_Depth, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
766 StaticBoxSizer2->Add(
767 FlexGridSizer5, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
769 StaticBoxSizer2, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
771 wxString __wxRadioBoxChoices_3[2] = {_(
"RGB camera"), _(
"IR camera")};
772 rbKinect_int =
new wxRadioBox(
773 pnKinect, ID_RADIOBOX3, _(
"Intensity channel:"), wxDefaultPosition,
774 wxDefaultSize, 2, __wxRadioBoxChoices_3, 1, 0, wxDefaultValidator,
776 rbKinect_int->SetSelection(0);
778 rbKinect_int, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL, 5);
779 pnKinect->SetSizer(FlexGridSizer4);
780 FlexGridSizer4->Fit(pnKinect);
781 FlexGridSizer4->SetSizeHints(pnKinect);
782 pagesCameras->AddPage(Panel2, _(
"Camera (opencv)"),
false);
783 pagesCameras->AddPage(Panel3, _(
"Camera (FFmpeg)"),
false);
784 pagesCameras->AddPage(Panel4, _(
"Camera (custom)"),
false);
785 pagesCameras->AddPage(Panel5, _(
"Video file"),
false);
786 pagesCameras->AddPage(Panel6, _(
"Rawlog file"),
false);
787 pagesCameras->AddPage(Panel1, _(
"Bumblebee"),
false);
788 pagesCameras->AddPage(pnSwissRanger, _(
"SwissRanger ToF"),
false);
789 pagesCameras->AddPage(pnKinect, _(
"Kinect"),
false);
791 pagesCameras, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
792 cbGrayscale =
new wxCheckBox(
793 this, ID_CHECKBOX2, _(
"Capture in grayscale"), wxDefaultPosition,
794 wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX2"));
795 cbGrayscale->SetValue(
true);
797 cbGrayscale, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
798 SetSizer(FlexGridSizer1);
799 FlexGridSizer1->Fit(
this);
800 FlexGridSizer1->SetSizeHints(
this);
803 ID_BUTTON7, wxEVT_COMMAND_BUTTON_CLICKED,
806 ID_BUTTON8, wxEVT_COMMAND_BUTTON_CLICKED,
809 ID_BUTTON9, wxEVT_COMMAND_BUTTON_CLICKED,
811 OnbtnBrowseRawlogDirClick);
815 cbOpencvResolution->Clear();
816 cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_(
"default")));
818 cbOpencvResolution->Append(_(
"320x240"));
819 cbOpencvResolution->Append(_(
"640x480"));
820 cbOpencvResolution->Append(_(
"800x600"));
821 cbOpencvResolution->Append(_(
"1024x768"));
822 cbOpencvResolution->Append(_(
"1280x1024"));
828 this, wxT(
"Choose a video to open"), wxT(
"."), wxT(
""),
829 wxT(
"Video files (*.avi;*.mpg;*.mov)|*.avi;*.mpg;*.mov|All files " 831 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
833 if (dialog.ShowModal() == wxID_OK)
edVideoFile->SetValue(dialog.GetPath());
839 this, wxT(
"Choose a rawlog to open"), wxT(
"."), wxT(
""),
840 wxT(
"Rawlog files (*.rawlog;*.rawlog.gz)|*.rawlog;*.rawlog.gz|All " 842 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
844 if (dialog.ShowModal() == wxID_OK)
851 string fil =
string(dialog.GetPath().mb_str());
853 fil_path +=
"/Images";
862 this, wxT(
"Choose the rawlog directory with external images"),
865 if (dialog.ShowModal() == wxID_OK)
889 cfg->
write(sect,
"grabber_type",
"opencv");
891 sect,
"cv_camera_index",
894 sect,
"cv_camera_type",
902 const size_t p = sRes.find(
"x");
903 if (
p != std::string::npos)
908 cfg->
write(sect,
"cv_frame_width", sW);
909 cfg->
write(sect,
"cv_frame_height", sH);
919 cfg->
write(sect,
"grabber_type",
"ffmpeg");
922 string(this->
edIPcamURL->GetValue().mb_str()));
935 for (
size_t idxSect = 0; idxSect < allSects.size(); idxSect++)
939 for (
size_t i = 0; i < keys.size(); i++)
941 allSects[idxSect], keys[i],
942 cfgIn.
read_string(allSects[idxSect], keys[i],
""));
951 cfg->
write(sect,
"grabber_type",
"ffmpeg");
962 cfg->
write(sect,
"grabber_type",
"rawlog");
967 const string rawlog_lb =
969 if (!rawlog_lb.empty())
970 cfg->
write(sect,
"rawlog_camera_sensor_label", rawlog_lb);
972 CImage::setImagesPathBase(
string(this->
edRawlogImgDir->GetValue().mb_str()));
980 cfg->
write(sect,
"grabber_type",
"bumblebee");
983 sect,
"bumblebee_mono",
988 cfg->
write(sect,
"bumblebee_fps", 15);
990 sect,
"bumblebee_get_rectified",
999 cfg->
write(sect,
"grabber_type",
"swissranger");
1001 cfg->
write(sect,
"sr_use_usb",
rbSR_usb->GetSelection() == 0);
1002 cfg->
write(sect,
"sr_IP",
string(
edSR_IP->GetValue().mb_str()));
1015 cfg->
write(sect,
"grabber_type",
"kinect");
1022 sect,
"kinect_video_rgb",
1029 cerr <<
"[MRPT CPanelCameraSelection] ERROR: Unknown camera " 1052 if (grab_type ==
"opencv")
1057 cfg->
read_int(sect,
"cv_camera_index", 0));
1061 const int w = cfg->
read_int(sect,
"cv_frame_width", 0);
1070 else if (grab_type ==
"ffmpeg")
1074 cfg->
read_string(sect,
"ffmpeg_url",
"rtsp://192.168.0.1/live.sdp");
1076 if (url.substr(0, 5) ==
"rtsp:")
1087 else if (grab_type ==
"rawlog")
1095 cfg->
read_string(sect,
"rawlog_camera_sensor_label",
"");
1098 else if (grab_type ==
"bumblebee")
1103 cfg->
read_int(sect,
"bumblebee_mono", 0));
1105 cfg->
read_bool(sect,
"bumblebee_get_rectified",
false));
1107 else if (grab_type ==
"swissranger")
1112 cfg->
read_bool(sect,
"sr_use_usb",
true) ? 0 : 1);
1114 _U(cfg->
read_string(sect,
"sr_IP",
"192.168.0.1").c_str()));
1117 cfg->
read_bool(sect,
"sr_grab_grayscale",
true));
1120 cfg->
read_bool(sect,
"sr_grab_range",
false));
1122 cfg->
read_bool(sect,
"sr_grab_confidence",
false));
1126 "Error: Unknown choice in 'grabber_type': '%s'", grab_type.c_str());
1130 cfg->
read_bool(sect,
"capture_grayscale",
false));
1146 #endif // MRPT_HAS_WXWIDGETS wxTextCtrl * edRawlogFile
static const long ID_BUTTON9
static const long ID_CHOICE1
void writeConfigFromVideoSourcePanel(const std::string §, mrpt::utils::CConfigFileBase *cfg) const
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
static const long ID_PANEL3
void GetBitmap(wxBitmap &bmp)
wxTextCtrl * edRawlogImgDir
void OnbtnBrowseRawlogDirClick(wxCommandEvent &event)
A class for storing images as grayscale or RGB bitmaps.
wxCheckBox * cbSR_chIntensity
static const long ID_SPINCTRL1
void getAllSections(vector_string §ions) const override
Returns a list with all the section names.
static const long ID_STATICTEXT9
static const long ID_STATICTEXT1
static const long ID_CHECKBOX4
#define THROW_EXCEPTION(msg)
static const long ID_RADIOBOX3
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
static const long ID_RADIOBOX2
void OnMouseMove(wxMouseEvent &ev)
static const long ID_PANEL1
static const long ID_CHECKBOX1
static const long ID_TEXTCTRL6
GLenum GLsizei GLenum GLenum const GLvoid * image
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
static const long ID_NOTEBOOK1
wxPoint m_last_mouse_point
virtual ~wxMRPTImageControl()
wxPoint m_last_mouse_click
wxMRPTImageControl(wxWindow *parent, wxWindowID winID, int x, int y, int width, int height)
void readConfigIntoVideoSourcePanel(const std::string §, const mrpt::utils::CConfigFileBase *cfg) const
static const long ID_CHECKBOX6
static const long ID_CHECKBOX5
wxImage * IplImage2wxImage(void *img)
Create a wxImage from a IPL image.
GLubyte GLubyte GLubyte GLubyte w
static const long ID_CHECKBOX3
static const long ID_TEXTCTRL8
This class allows loading and storing values and vectors of different types from a configuration text...
static const long ID_TEXTCTRL3
This class implements a config file-like interface over a memory-stored string list.
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
std::vector< std::string > vector_string
A type for passing a vector of strings.
wxBitmap * MRPTImage2wxBitmap(const mrpt::utils::CImage &img)
Create a wxBitmap from a MRPT image.
static const long ID_TEXTCTRL1
void OnMouseClick(wxMouseEvent &ev)
void loadFromMemoryBuffer(unsigned int width, unsigned int height, bool color, unsigned char *rawpixels, bool swapRedBlue=false)
Reads the image from raw pixels buffer in memory.
static const long ID_CHECKBOX8
mrpt::utils::CImage * wxImage2MRPTImage(const wxImage &img)
Create a MRPT image from a wxImage.
static const long ID_CHECKBOX7
wxCheckBox * cbKinect_Int
wxChoice * cbOpencvResolution
void OnbtnBrowseVideoClick(wxCommandEvent &event)
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
static const long ID_CHOICE2
std::shared_ptr< CImage > Ptr
static const long ID_STATICTEXT6
wxImage * MRPTImage2wxImage(const mrpt::utils::CImage &img)
Create a wxImage from a MRPT image.
wxCheckBox * cbBumblebeeRectif
static const long ID_TEXTCTRL2
static const long ID_CHECKBOX2
static const long ID_PANEL2
static const long ID_STATICTEXT3
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
static const long ID_STATICTEXT11
wxCheckBox * cbKinect_Depth
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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())
wxSpinCtrl * opencvCamIndex
static const long ID_STATICTEXT10
mrpt::utils::CImage::Ptr wxImage2MRPTImagePtr(const wxImage &img)
Create a MRPT image from a wxImage.
static const long ID_TEXTCTRL7
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.
virtual ~CPanelCameraSelection()
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)...
void getAllKeys(const std::string §ion, vector_string &keys) const override
Returs a list with all the keys into a section.
GLenum GLsizei GLsizei height
static const long ID_BUTTON7
GLsizei GLsizei GLenum GLenum const GLvoid * data
static const long ID_STATICTEXT4
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.
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