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;
36 if (
image->nChannels==1)
38 IplImage* new_image = cvCreateImage( cvSize(
image->width,
image->height),
image->depth, 3 );
39 new_image->origin =
image->origin;
40 cvCvtColor(
image,new_image, CV_GRAY2RGB);
42 free_image_at_end =
true;
46 if(
image->origin == 1 ) options |= CV_CVTIMG_FLIP;
47 if(
image->nChannels == 3 &&
image->channelSeq[0] ==
'B' &&
image->channelSeq[2]==
'R') options |= CV_CVTIMG_SWAP_RB;
50 IplImage *the_input_img =
image;
52 image = cvCreateImage( cvSize(the_input_img->width,the_input_img->height),the_input_img->depth, 3 );
53 if (the_input_img->width && the_input_img->height)
54 cvConvertImage(the_input_img,
image, options);
56 if (free_image_at_end) cvReleaseImage(&the_input_img);
57 free_image_at_end =
true;
60 int row_in_bytes =
image->width *
image->nChannels;
61 unsigned char*
data = (
unsigned char*)malloc( row_in_bytes *
image->height );
64 if (row_in_bytes !=
image->widthStep)
66 unsigned char* trg =
data;
77 int h =
image->height;
79 if (free_image_at_end)
81 cvReleaseImage(&
image);
85 return new wxImage(
w,h,
data,
false );
88 int x,
y, lx =
img.getWidth(), ly =
img.getHeight();
89 unsigned char *imgData = (
unsigned char *)malloc( 3*lx*ly );
90 unsigned char *imgPtr = imgData;
95 if (
img.isOriginTopLeft())
101 *(imgPtr++) = *
img(
x,
y,2);
102 *(imgPtr++) = *
img(
x,
y,1);
103 *(imgPtr++) = *
img(
x,
y,0);
109 for (
y=ly-1;
y>=0;
y--)
113 *(imgPtr++) = *
img(
x,
y,2);
114 *(imgPtr++) = *
img(
x,
y,1);
115 *(imgPtr++) = *
img(
x,
y,0);
123 if (
img.isOriginTopLeft())
129 unsigned char c = *
img(
x,
y);
138 for (
y=ly-1;
y>=0;
y--)
142 unsigned char c = *
img(
x,
y);
150 return new wxImage( lx, ly, imgData,
false );
161 IplImage*
image =
const_cast<IplImage*
>(
img.getAs<IplImage>() );
162 bool free_image_at_end =
false;
165 if (
image->nChannels==1)
167 IplImage* new_image = cvCreateImage( cvSize(
image->width,
image->height),
image->depth, 3 );
168 new_image->origin =
image->origin;
169 cvCvtColor(
image,new_image, CV_GRAY2RGB);
171 free_image_at_end =
true;
175 if(
image->origin == 1 ) options |= CV_CVTIMG_FLIP;
176 if(
image->nChannels == 3 &&
image->channelSeq[0] ==
'B' &&
image->channelSeq[2]==
'R') options |= CV_CVTIMG_SWAP_RB;
179 IplImage *the_input_img =
image;
181 image = cvCreateImage( cvSize(the_input_img->width,the_input_img->height),the_input_img->depth, 3 );
182 cvConvertImage(the_input_img,
image, options);
184 if (free_image_at_end) cvReleaseImage(&the_input_img);
185 free_image_at_end =
true;
188 int row_in_bytes =
image->width *
image->nChannels;
189 unsigned char*
data = (
unsigned char*)malloc( row_in_bytes *
image->height );
192 if (row_in_bytes !=
image->widthStep)
194 unsigned char* trg =
data;
196 for (
int y=0;
y<
image->height;
y++,
src+=
image->widthStep, trg+= row_in_bytes)
205 int h =
image->height;
207 if (free_image_at_end)
209 cvReleaseImage(&
image);
213 return new wxBitmap( wxImage(
w,h,
data,
false ) );
223 IplImage*
image =
static_cast<IplImage *
>(
img);
230 if(
image->origin == 1 )
231 options |= CV_CVTIMG_FLIP;
232 if(
image->channelSeq[0] ==
'B' &&
image->channelSeq[2]==
'R')
233 options |= CV_CVTIMG_SWAP_RB;
237 int row_bytes =
image->width *
image->nChannels * ((
image->depth & 255)>>3);
239 unsigned char* imageData = (
unsigned char *)malloc(row_bytes *
image->height);
243 if (row_bytes !=
image->widthStep)
245 for (
int y = 0;
y <
image->height;
y++)
246 memcpy( (imageData +
y * row_bytes),
254 row_bytes *
image->height);
258 return new wxImage(
image->width,
image->height, imageData,
false );
269 const size_t lx =
img.GetWidth();
270 const size_t ly =
img.GetHeight();
297 this->Create(parent,winID,wxPoint(
x,
y),wxSize(
width,
height));
366 dc.DrawBitmap(*
m_img,0,0);
440 wxStaticBoxSizer* StaticBoxSizer2;
441 wxFlexGridSizer* FlexGridSizer4;
442 wxFlexGridSizer* FlexGridSizer16;
443 wxFlexGridSizer* FlexGridSizer10;
444 wxFlexGridSizer* FlexGridSizer3;
445 wxFlexGridSizer* FlexGridSizer5;
446 wxFlexGridSizer* FlexGridSizer2;
447 wxFlexGridSizer* FlexGridSizer18;
448 wxFlexGridSizer* FlexGridSizer13;
449 wxFlexGridSizer* FlexGridSizer12;
450 wxStaticBoxSizer* StaticBoxSizer1;
451 wxFlexGridSizer* FlexGridSizer1;
452 wxFlexGridSizer* FlexGridSizer11;
454 Create(parent,
id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"id"));
455 FlexGridSizer1 =
new wxFlexGridSizer(0, 1, 0, 0);
456 FlexGridSizer1->AddGrowableCol(0);
457 FlexGridSizer1->AddGrowableRow(0);
458 pagesCameras =
new wxNotebook(
this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_NOTEBOOK1"));
459 Panel2 =
new wxPanel(pagesCameras, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL2"));
460 FlexGridSizer10 =
new wxFlexGridSizer(0, 2, 0, 0);
461 FlexGridSizer10->AddGrowableCol(1);
462 StaticText1 =
new wxStaticText(Panel2, ID_STATICTEXT1, _(
"Camera index:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT1"));
463 FlexGridSizer10->Add(StaticText1, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
464 opencvCamIndex =
new wxSpinCtrl(Panel2, ID_SPINCTRL1, _T(
"0"), wxDefaultPosition, wxDefaultSize, 0, 0, 100, 0, _T(
"ID_SPINCTRL1"));
465 opencvCamIndex->SetValue(_T(
"0"));
466 FlexGridSizer10->Add(opencvCamIndex, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
467 StaticText3 =
new wxStaticText(Panel2, ID_STATICTEXT3, _(
"Camera type:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT3"));
468 FlexGridSizer10->Add(StaticText3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
469 cbOpencvCamType =
new wxChoice(Panel2, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"ID_CHOICE1"));
470 cbOpencvCamType->SetSelection( cbOpencvCamType->Append(_(
"CAMERA_CV_AUTODETECT")) );
471 cbOpencvCamType->Append(_(
"CAMERA_CV_DC1394"));
472 cbOpencvCamType->Append(_(
"CAMERA_CV_VFL"));
473 cbOpencvCamType->Append(_(
"CAMERA_CV_VFW"));
474 cbOpencvCamType->Append(_(
"CAMERA_CV_MIL"));
475 cbOpencvCamType->Append(_(
"CAMERA_CV_DSHOW"));
476 FlexGridSizer10->Add(cbOpencvCamType, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
477 StaticText6 =
new wxStaticText(Panel2, ID_STATICTEXT6, _(
"Resolution:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT6"));
478 FlexGridSizer10->Add(StaticText6, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
479 cbOpencvResolution =
new wxChoice(Panel2, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"ID_CHOICE2"));
480 cbOpencvResolution->SetSelection( cbOpencvResolution->Append(_(
"default")) );
481 cbOpencvResolution->Append(_(
"320x240"));
482 cbOpencvResolution->Append(_(
"640x480"));
483 FlexGridSizer10->Add(cbOpencvResolution, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
484 FlexGridSizer10->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
485 Panel2->SetSizer(FlexGridSizer10);
486 FlexGridSizer10->Fit(Panel2);
487 FlexGridSizer10->SetSizeHints(Panel2);
488 Panel3 =
new wxPanel(pagesCameras, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL3"));
489 FlexGridSizer11 =
new wxFlexGridSizer(0, 1, 0, 0);
490 FlexGridSizer11->AddGrowableCol(0);
491 StaticText7 =
new wxStaticText(Panel3, ID_STATICTEXT7, _(
"IP Camera URL:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT7"));
492 FlexGridSizer11->Add(StaticText7, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
493 edIPcamURL =
new wxTextCtrl(Panel3, ID_TEXTCTRL1, _(
"rtsp://192.168.0.1/live.sdp"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL1"));
494 FlexGridSizer11->Add(edIPcamURL, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 5);
495 Panel3->SetSizer(FlexGridSizer11);
496 FlexGridSizer11->Fit(Panel3);
497 FlexGridSizer11->SetSizeHints(Panel3);
498 Panel4 =
new wxPanel(pagesCameras, ID_PANEL4, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL4"));
499 FlexGridSizer16 =
new wxFlexGridSizer(0, 1, 0, 0);
500 FlexGridSizer16->AddGrowableCol(0);
501 FlexGridSizer16->AddGrowableRow(0);
502 edCustomCamConfig =
new wxTextCtrl(Panel4, ID_TEXTCTRL6, _(
"// Configuration block for the CCameraSensor object.\n// Check out its documentation at:\n// http://reference.mrpt.org/devel/classmrpt_1_1hwdrivers_1_1_c_camera_sensor.html\n\n[CONFIG]\ngrabber_type = opencv \ncv_camera_index = 0\ncv_camera_type = CAMERA_CV_AUTODETECT\n\n"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxHSCROLL|wxTE_DONTWRAP|wxVSCROLL|wxALWAYS_SHOW_SB, wxDefaultValidator, _T(
"ID_TEXTCTRL6"));
503 wxFont edCustomCamConfigFont = wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT);
504 if ( !edCustomCamConfigFont.Ok() ) edCustomCamConfigFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
505 edCustomCamConfigFont.SetPointSize(7);
506 edCustomCamConfig->SetFont(edCustomCamConfigFont);
507 FlexGridSizer16->Add(edCustomCamConfig, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 5);
508 Panel4->SetSizer(FlexGridSizer16);
509 FlexGridSizer16->Fit(Panel4);
510 FlexGridSizer16->SetSizeHints(Panel4);
511 Panel5 =
new wxPanel(pagesCameras, ID_PANEL5, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL5"));
512 FlexGridSizer12 =
new wxFlexGridSizer(0, 1, 0, 0);
513 FlexGridSizer12->AddGrowableCol(0);
514 StaticText8 =
new wxStaticText(Panel5, ID_STATICTEXT8, _(
"Video file to open:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT8"));
515 FlexGridSizer12->Add(StaticText8, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
516 edVideoFile =
new wxTextCtrl(Panel5, ID_TEXTCTRL2, _(
"test.avi"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL2"));
517 FlexGridSizer12->Add(edVideoFile, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 5);
518 btnBrowseVideo =
new wxButton(Panel5, ID_BUTTON7, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_BUTTON7"));
519 FlexGridSizer12->Add(btnBrowseVideo, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
520 Panel5->SetSizer(FlexGridSizer12);
521 FlexGridSizer12->Fit(Panel5);
522 FlexGridSizer12->SetSizeHints(Panel5);
523 Panel6 =
new wxPanel(pagesCameras, ID_PANEL6, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL6"));
524 FlexGridSizer13 =
new wxFlexGridSizer(0, 3, 0, 0);
525 FlexGridSizer13->AddGrowableCol(1);
526 StaticText9 =
new wxStaticText(Panel6, ID_STATICTEXT9, _(
"Rawlog \nfile:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT9"));
527 FlexGridSizer13->Add(StaticText9, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
528 edRawlogFile =
new wxTextCtrl(Panel6, ID_TEXTCTRL3, _(
"test.rawlog"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL3"));
529 FlexGridSizer13->Add(edRawlogFile, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 5);
530 btnBrowseRawlog =
new wxButton(Panel6, ID_BUTTON8, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_BUTTON8"));
531 FlexGridSizer13->Add(btnBrowseRawlog, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
532 StaticText5 =
new wxStaticText(Panel6, ID_STATICTEXT5, _(
"External \nimages:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT5"));
533 FlexGridSizer13->Add(StaticText5, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
534 edRawlogImgDir =
new wxTextCtrl(Panel6, ID_TEXTCTRL7, _(
"./Images"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL7"));
535 FlexGridSizer13->Add(edRawlogImgDir, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 5);
536 btnBrowseRawlogDir =
new wxButton(Panel6, ID_BUTTON9, _(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_BUTTON9"));
537 FlexGridSizer13->Add(btnBrowseRawlogDir, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
538 StaticText10 =
new wxStaticText(Panel6, ID_STATICTEXT10, _(
"Sensor\nlabel:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT10"));
539 FlexGridSizer13->Add(StaticText10, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
540 edRawlogLabel =
new wxTextCtrl(Panel6, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_TEXTCTRL8"));
541 FlexGridSizer13->Add(edRawlogLabel, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 5);
542 StaticText11 =
new wxStaticText(Panel6, ID_STATICTEXT11, _(
"(empty=any)"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT11"));
543 FlexGridSizer13->Add(StaticText11, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
544 Panel6->SetSizer(FlexGridSizer13);
545 FlexGridSizer13->Fit(Panel6);
546 FlexGridSizer13->SetSizeHints(Panel6);
547 Panel1 =
new wxPanel(pagesCameras, ID_PANEL7, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL7"));
548 FlexGridSizer18 =
new wxFlexGridSizer(2, 2, 0, 0);
549 wxString __wxRadioBoxChoices_1[2] =
554 rbBumblebeeSel =
new wxRadioBox(Panel1, ID_RADIOBOX1, _(
"Select monocular input"), wxDefaultPosition, wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator, _T(
"ID_RADIOBOX1"));
555 rbBumblebeeSel->SetSelection(0);
556 FlexGridSizer18->Add(rbBumblebeeSel, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
557 cbBumblebeeRectif =
new wxCheckBox(Panel1, ID_CHECKBOX1, _(
"Use vendor\'s rectify"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX1"));
558 cbBumblebeeRectif->SetValue(
false);
559 FlexGridSizer18->Add(cbBumblebeeRectif, 1, wxALL|wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 10);
560 FlexGridSizer18->Add(-1,-1,1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
561 StaticText2 =
new wxStaticText(Panel1, ID_STATICTEXT2, _(
"(Unchecked = raw images)"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT2"));
562 FlexGridSizer18->Add(StaticText2, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
563 Panel1->SetSizer(FlexGridSizer18);
564 FlexGridSizer18->Fit(Panel1);
565 FlexGridSizer18->SetSizeHints(Panel1);
566 pnSwissRanger =
new wxPanel(pagesCameras, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL1"));
567 FlexGridSizer2 =
new wxFlexGridSizer(2, 3, 0, 0);
568 wxString __wxRadioBoxChoices_2[2] =
573 rbSR_usb =
new wxRadioBox(pnSwissRanger, ID_RADIOBOX2, _(
"Connection"), wxDefaultPosition, wxDefaultSize, 2, __wxRadioBoxChoices_2, 1, 0, wxDefaultValidator, _T(
"ID_RADIOBOX2"));
574 FlexGridSizer2->Add(rbSR_usb, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
575 StaticText4 =
new wxStaticText(pnSwissRanger, ID_STATICTEXT4, _(
"IP:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT4"));
576 FlexGridSizer2->Add(StaticText4, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
577 edSR_IP =
new wxTextCtrl(pnSwissRanger, ID_TEXTCTRL4, _(
"192.168.2.14"), wxDefaultPosition, wxSize(120,-1), 0, wxDefaultValidator, _T(
"ID_TEXTCTRL4"));
578 FlexGridSizer2->Add(edSR_IP, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
579 StaticBoxSizer1 =
new wxStaticBoxSizer(wxHORIZONTAL, pnSwissRanger, _(
"Channels to grab: "));
580 FlexGridSizer3 =
new wxFlexGridSizer(4, 1, 0, 0);
581 cbSR_chIntensity =
new wxCheckBox(pnSwissRanger, ID_CHECKBOX3, _(
"Grayscale intensity"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX3"));
582 cbSR_chIntensity->SetValue(
true);
583 cbSR_chIntensity->Disable();
584 FlexGridSizer3->Add(cbSR_chIntensity, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
585 cbSR_ch3D =
new wxCheckBox(pnSwissRanger, ID_CHECKBOX4, _(
"3D point cloud"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX4"));
586 cbSR_ch3D->SetValue(
false);
587 FlexGridSizer3->Add(cbSR_ch3D, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
588 cbSR_chRange =
new wxCheckBox(pnSwissRanger, ID_CHECKBOX5, _(
"Depth image"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX5"));
589 cbSR_chRange->SetValue(
false);
590 FlexGridSizer3->Add(cbSR_chRange, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
591 cbSR_chConf =
new wxCheckBox(pnSwissRanger, ID_CHECKBOX6, _(
"Confidence"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX6"));
592 cbSR_chConf->SetValue(
false);
593 FlexGridSizer3->Add(cbSR_chConf, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
594 StaticBoxSizer1->Add(FlexGridSizer3, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 0);
595 FlexGridSizer2->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
596 pnSwissRanger->SetSizer(FlexGridSizer2);
597 FlexGridSizer2->Fit(pnSwissRanger);
598 FlexGridSizer2->SetSizeHints(pnSwissRanger);
599 pnKinect =
new wxPanel(pagesCameras, ID_PANEL8, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"ID_PANEL8"));
600 FlexGridSizer4 =
new wxFlexGridSizer(2, 3, 0, 0);
601 StaticBoxSizer2 =
new wxStaticBoxSizer(wxHORIZONTAL, pnKinect, _(
"Channels to grab: "));
602 FlexGridSizer5 =
new wxFlexGridSizer(4, 1, 0, 0);
603 cbKinect_Int =
new wxCheckBox(pnKinect, ID_CHECKBOX7, _(
"Intensity"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX7"));
604 cbKinect_Int->SetValue(
true);
605 cbKinect_Int->Disable();
606 FlexGridSizer5->Add(cbKinect_Int, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
607 cbKinect_3D =
new wxCheckBox(pnKinect, ID_CHECKBOX8, _(
"3D point cloud"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX8"));
608 cbKinect_3D->SetValue(
false);
609 FlexGridSizer5->Add(cbKinect_3D, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
610 cbKinect_Depth =
new wxCheckBox(pnKinect, ID_CHECKBOX9, _(
"Depth image"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX9"));
611 cbKinect_Depth->SetValue(
false);
612 FlexGridSizer5->Add(cbKinect_Depth, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
613 StaticBoxSizer2->Add(FlexGridSizer5, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 0);
614 FlexGridSizer4->Add(StaticBoxSizer2, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
615 wxString __wxRadioBoxChoices_3[2] =
620 rbKinect_int =
new wxRadioBox(pnKinect, ID_RADIOBOX3, _(
"Intensity channel:"), wxDefaultPosition, wxDefaultSize, 2, __wxRadioBoxChoices_3, 1, 0, wxDefaultValidator, _T(
"ID_RADIOBOX3"));
621 rbKinect_int->SetSelection(0);
622 FlexGridSizer4->Add(rbKinect_int, 1, wxALL|wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 5);
623 pnKinect->SetSizer(FlexGridSizer4);
624 FlexGridSizer4->Fit(pnKinect);
625 FlexGridSizer4->SetSizeHints(pnKinect);
626 pagesCameras->AddPage(Panel2, _(
"Camera (opencv)"),
false);
627 pagesCameras->AddPage(Panel3, _(
"Camera (FFmpeg)"),
false);
628 pagesCameras->AddPage(Panel4, _(
"Camera (custom)"),
false);
629 pagesCameras->AddPage(Panel5, _(
"Video file"),
false);
630 pagesCameras->AddPage(Panel6, _(
"Rawlog file"),
false);
631 pagesCameras->AddPage(Panel1, _(
"Bumblebee"),
false);
632 pagesCameras->AddPage(pnSwissRanger, _(
"SwissRanger ToF"),
false);
633 pagesCameras->AddPage(pnKinect, _(
"Kinect"),
false);
634 FlexGridSizer1->Add(pagesCameras, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
635 cbGrayscale =
new wxCheckBox(
this, ID_CHECKBOX2, _(
"Capture in grayscale"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"ID_CHECKBOX2"));
636 cbGrayscale->SetValue(
true);
637 FlexGridSizer1->Add(cbGrayscale, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 5);
638 SetSizer(FlexGridSizer1);
639 FlexGridSizer1->Fit(
this);
640 FlexGridSizer1->SetSizeHints(
this);
648 cbOpencvResolution->Clear();
649 cbOpencvResolution->SetSelection( cbOpencvResolution->Append(_(
"default")) );
651 cbOpencvResolution->Append(_(
"320x240"));
652 cbOpencvResolution->Append(_(
"640x480"));
653 cbOpencvResolution->Append(_(
"800x600"));
654 cbOpencvResolution->Append(_(
"1024x768"));
655 cbOpencvResolution->Append(_(
"1280x1024"));
664 wxT(
"Choose a video to open"),
667 wxT(
"Video files (*.avi;*.mpg;*.mov)|*.avi;*.mpg;*.mov|All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
669 if (dialog.ShowModal() == wxID_OK)
679 wxT(
"Choose a rawlog to open"),
682 wxT(
"Rawlog files (*.rawlog;*.rawlog.gz)|*.rawlog;*.rawlog.gz|All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
684 if (dialog.ShowModal() == wxID_OK)
690 string fil =
string( dialog.GetPath().mb_str() );
692 fil_path +=
"/Images";
702 wxT(
"Choose the rawlog directory with external images"),
704 wxDD_DEFAULT_STYLE );
706 if (dialog.ShowModal() == wxID_OK)
734 cfg->
write(sect,
"grabber_type",
"opencv");
736 cfg->
write(sect,
"cv_camera_type",
string(this->
cbOpencvCamType->GetStringSelection().mb_str()) );
742 const size_t p = sRes.find(
"x");
743 if (
p!=std::string::npos)
748 cfg->
write(sect,
"cv_frame_width",sW);
749 cfg->
write(sect,
"cv_frame_height",sH);
759 cfg->
write(sect,
"grabber_type",
"ffmpeg");
760 cfg->
write(sect,
"ffmpeg_url",
string(this->
edIPcamURL->GetValue().mb_str()) );
772 for (
size_t idxSect=0;idxSect<allSects.size();idxSect++)
776 for (
size_t i=0;i<keys.size();i++)
777 cfg->
write(allSects[idxSect], keys[i], cfgIn.
read_string(allSects[idxSect], keys[i],
"") );
786 cfg->
write(sect,
"grabber_type",
"ffmpeg");
787 cfg->
write(sect,
"ffmpeg_url",
string(this->
edVideoFile->GetValue().mb_str()) );
795 cfg->
write(sect,
"grabber_type",
"rawlog");
796 cfg->
write(sect,
"rawlog_file",
string(this->
edRawlogFile->GetValue().mb_str()) );
799 if (!rawlog_lb.empty())
800 cfg->
write(sect,
"rawlog_camera_sensor_label", rawlog_lb );
810 cfg->
write(sect,
"grabber_type",
"bumblebee");
814 cfg->
write(sect,
"bumblebee_fps",15);
823 cfg->
write(sect,
"grabber_type",
"swissranger");
826 cfg->
write(sect,
"sr_IP",
string(
edSR_IP->GetValue().mb_str() ) );
839 cfg->
write(sect,
"grabber_type",
"kinect");
851 cerr <<
"[MRPT CPanelCameraSelection] ERROR: Unknown camera selection tab!\n";
875 if (grab_type==
"opencv")
882 const int w = cfg->
read_int(sect,
"cv_frame_width",0);
891 else if (grab_type==
"ffmpeg")
894 const string url = cfg->
read_string(sect,
"ffmpeg_url",
"rtsp://192.168.0.1/live.sdp");
896 if (url.substr(0,5)==
"rtsp:")
907 else if (grab_type==
"rawlog")
913 const string lb = cfg->
read_string(sect,
"rawlog_camera_sensor_label",
"" );
916 else if (grab_type==
"bumblebee")
923 else if (grab_type==
"swissranger")
957 #endif // MRPT_HAS_WXWIDGETS void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
wxTextCtrl * edRawlogFile
A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
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
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
mrpt::utils::CImagePtr GUI_IMPEXP wxImage2MRPTImagePtr(const wxImage &img)
Create a MRPT image from a wxImage.
static const long ID_CHECKBOX5
wxImage GUI_IMPEXP * 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
void getAllSections(vector_string §ions) const MRPT_OVERRIDE
Returns a list with all the section names.
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 GUI_IMPEXP * 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.
mrpt::synch::CCriticalSection m_mouse_cs
static const long ID_CHECKBOX8
mrpt::utils::CImage GUI_IMPEXP * 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 BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
static const long ID_CHOICE2
static const long ID_STATICTEXT6
wxImage GUI_IMPEXP * 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
mrpt::synch::CCriticalSection m_img_cs
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, const data_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
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 getAllKeys(const std::string §ion, vector_string &keys) const MRPT_OVERRIDE
Returs a list with all the keys into a section.
void OnbtnBrowseRawlogClick(wxCommandEvent &event)
bool BASE_IMPEXP directoryExists(const std::string &fileName)
Test if a given directory exists (it fails if the given path refers to an existing file)...
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 BASE_IMPEXP 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. This object has the ownship of the image and will delete it when appropriate...
static const long ID_PANEL6
static const long ID_BUTTON8
static const long ID_STATICTEXT8
wxChoice * cbOpencvCamType