MRPT  1.9.9
WxUtils.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "gui-precomp.h" // Precompiled headers
11 
12 #include <mrpt/gui/WxUtils.h>
13 #include <mrpt/img/CImage.h>
14 #include <mrpt/system/filesystem.h>
15 
16 #if MRPT_HAS_WXWIDGETS
17 
18 #include <mrpt/otherlibs/do_opencv_includes.h>
19 
20 using namespace mrpt;
21 using namespace mrpt::gui;
22 using namespace std;
23 
25 {
26 #if MRPT_HAS_OPENCV
27  using namespace std::string_literals;
28 
30 
31  // If the image is GRAYSCALE, we need to convert it into RGB, so do it
32  // manually:
33  if (!new_image.isColor())
34  {
35  new_image = new_image.colorImage();
36  }
37 
38  if (new_image.getChannelsOrder() == "BGR"s)
39  {
40  auto im = new_image.makeDeepCopy();
41  im.swapRB();
42  new_image = im;
43  }
44 
45  const int row_in_bytes =
46  new_image.getWidth() *
47  (new_image.getChannelCount() == mrpt::img::CH_RGB ? 3 : 1);
48  uint8_t* data =
49  static_cast<uint8_t*>(malloc(row_in_bytes * new_image.getHeight()));
50 
51  const int w = new_image.getWidth(), h = new_image.getHeight(),
52  rs = new_image.getRowStride();
53 
54  // Copy row by row only if necesary:
55  if (row_in_bytes != rs)
56  {
57  auto* trg = data;
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);
61  }
62  else
63  {
64  memcpy(data, new_image.ptrLine<uint8_t>(0), row_in_bytes * h);
65  }
66 
67  // create and return the object
68  return new wxImage(w, h, data, false /* false=transfer mem ownership */);
69 #else
70  THROW_EXCEPTION("MRPT compiled without OpenCV");
71 #endif
72 }
73 
75 {
76 #if MRPT_HAS_OPENCV
77  auto* i = MRPTImage2wxImage(img);
78  auto ret = new wxBitmap(*i);
79  delete i;
80  return ret;
81 #else
82  THROW_EXCEPTION("MRPT compiled without OpenCV");
83 #endif
84 }
85 
86 //------------------------------------------------------------------------
87 // Convert wxImage -> MRPTImage
88 //------------------------------------------------------------------------
90 {
91  auto* newImg = new mrpt::img::CImage();
92 
93  const size_t lx = img.GetWidth();
94  const size_t ly = img.GetHeight();
95 
96  newImg->loadFromMemoryBuffer(
97  lx, ly, true, img.GetData(), true /* swap RB */);
98 
99  return newImg;
100 }
101 
102 //------------------------------------------------------------------------
103 // Convert wxImage -> MRPTImagePtr
104 //------------------------------------------------------------------------
106 {
108 }
109 
110 //------------------------------------------------------------------------
111 // wxMRPTImageControl
112 //------------------------------------------------------------------------
114  wxWindow* parent, wxWindowID winID, int x, int y, int width, int height)
115  : m_img(nullptr)
116 {
117  this->Create(parent, winID, wxPoint(x, y), wxSize(width, height));
118 
119  Connect(wxEVT_PAINT, wxPaintEventHandler(wxMRPTImageControl::OnPaint));
120  Connect(wxEVT_MOTION, wxMouseEventHandler(wxMRPTImageControl::OnMouseMove));
121  Connect(
122  wxID_ANY, wxEVT_LEFT_DOWN,
123  wxMouseEventHandler(wxMRPTImageControl::OnMouseClick));
124 
125  // Connect(wxID_ANY,wxEVT_CHAR,(wxObjectEventFunction)&wxMRPTImageControl::OnChar);
126 }
127 
129 {
130  std::lock_guard<std::mutex> lock(m_img_cs);
131  if (m_img)
132  {
133  delete m_img;
134  m_img = nullptr;
135  }
136 }
137 
138 void wxMRPTImageControl::OnMouseMove(wxMouseEvent& ev)
139 {
140  std::lock_guard<std::mutex> lock(m_mouse_cs);
141  m_last_mouse_point = ev.GetPosition();
142 }
143 
144 void wxMRPTImageControl::OnMouseClick(wxMouseEvent& ev)
145 {
146  std::lock_guard<std::mutex> lock(m_mouse_cs);
147  m_last_mouse_click = ev.GetPosition();
148 }
149 
151 {
152  std::lock_guard<std::mutex> lock(m_img_cs);
153  if (m_img)
154  {
155  delete m_img;
156  m_img = nullptr;
157  }
158 
159  m_img = img;
160 }
161 
163 {
164  wxBitmap* wxImg = MRPTImage2wxBitmap(img);
165 
166  std::lock_guard<std::mutex> lock(m_img_cs);
167  if (m_img)
168  {
169  delete m_img;
170  m_img = nullptr;
171  }
172 
173  m_img = wxImg;
174 }
175 
176 void wxMRPTImageControl::OnPaint(wxPaintEvent& ev)
177 {
178  wxPaintDC dc(this);
179 
180  std::lock_guard<std::mutex> lock(m_img_cs);
181  if (!m_img)
182  {
183  // Erase background:
184  return;
185  }
186 
187  dc.DrawBitmap(*m_img, 0, 0);
188 }
189 
190 void wxMRPTImageControl::GetBitmap(wxBitmap& bmp)
191 {
192  std::lock_guard<std::mutex> lock(m_img_cs);
193  if (!m_img) return;
194  bmp = *m_img;
195 }
196 
197 // *********************************************************************
198 // CPanelCameraSelection
199 // *********************************************************************
200 
201 //(*IdInit(CPanelCameraSelection)
202 const long CPanelCameraSelection::ID_STATICTEXT1 = wxNewId();
203 const long CPanelCameraSelection::ID_SPINCTRL1 = wxNewId();
204 const long CPanelCameraSelection::ID_STATICTEXT3 = wxNewId();
205 const long CPanelCameraSelection::ID_CHOICE1 = wxNewId();
206 const long CPanelCameraSelection::ID_STATICTEXT6 = wxNewId();
207 const long CPanelCameraSelection::ID_CHOICE2 = wxNewId();
208 const long CPanelCameraSelection::ID_PANEL2 = wxNewId();
209 const long CPanelCameraSelection::ID_STATICTEXT7 = wxNewId();
210 const long CPanelCameraSelection::ID_TEXTCTRL1 = wxNewId();
211 const long CPanelCameraSelection::ID_PANEL3 = wxNewId();
212 const long CPanelCameraSelection::ID_TEXTCTRL6 = wxNewId();
213 const long CPanelCameraSelection::ID_PANEL4 = wxNewId();
214 const long CPanelCameraSelection::ID_STATICTEXT8 = wxNewId();
215 const long CPanelCameraSelection::ID_TEXTCTRL2 = wxNewId();
216 const long CPanelCameraSelection::ID_BUTTON7 = wxNewId();
217 const long CPanelCameraSelection::ID_PANEL5 = wxNewId();
218 const long CPanelCameraSelection::ID_STATICTEXT9 = wxNewId();
219 const long CPanelCameraSelection::ID_TEXTCTRL3 = wxNewId();
220 const long CPanelCameraSelection::ID_BUTTON8 = wxNewId();
221 const long CPanelCameraSelection::ID_STATICTEXT5 = wxNewId();
222 const long CPanelCameraSelection::ID_TEXTCTRL7 = wxNewId();
223 const long CPanelCameraSelection::ID_BUTTON9 = wxNewId();
224 const long CPanelCameraSelection::ID_STATICTEXT10 = wxNewId();
225 const long CPanelCameraSelection::ID_TEXTCTRL8 = wxNewId();
226 const long CPanelCameraSelection::ID_STATICTEXT11 = wxNewId();
227 const long CPanelCameraSelection::ID_PANEL6 = wxNewId();
228 const long CPanelCameraSelection::ID_RADIOBOX1 = wxNewId();
229 const long CPanelCameraSelection::ID_CHECKBOX1 = wxNewId();
230 const long CPanelCameraSelection::ID_STATICTEXT2 = wxNewId();
231 const long CPanelCameraSelection::ID_PANEL7 = wxNewId();
232 const long CPanelCameraSelection::ID_RADIOBOX2 = wxNewId();
233 const long CPanelCameraSelection::ID_STATICTEXT4 = wxNewId();
234 const long CPanelCameraSelection::ID_TEXTCTRL4 = wxNewId();
235 const long CPanelCameraSelection::ID_CHECKBOX3 = wxNewId();
236 const long CPanelCameraSelection::ID_CHECKBOX4 = wxNewId();
237 const long CPanelCameraSelection::ID_CHECKBOX5 = wxNewId();
238 const long CPanelCameraSelection::ID_CHECKBOX6 = wxNewId();
239 const long CPanelCameraSelection::ID_PANEL1 = wxNewId();
240 const long CPanelCameraSelection::ID_CHECKBOX7 = wxNewId();
241 const long CPanelCameraSelection::ID_CHECKBOX8 = wxNewId();
242 const long CPanelCameraSelection::ID_CHECKBOX9 = wxNewId();
243 const long CPanelCameraSelection::ID_RADIOBOX3 = wxNewId();
244 const long CPanelCameraSelection::ID_PANEL8 = wxNewId();
245 const long CPanelCameraSelection::ID_NOTEBOOK1 = wxNewId();
246 const long CPanelCameraSelection::ID_CHECKBOX2 = wxNewId();
247 //*)
248 
249 BEGIN_EVENT_TABLE(CPanelCameraSelection, wxPanel)
250 //(*EventTable(CPanelCameraSelection)
251 //*)
252 END_EVENT_TABLE()
253 
254 CPanelCameraSelection::CPanelCameraSelection(wxWindow* parent, wxWindowID id)
255 {
256  //(*Initialize(CPanelCameraSelection)
257  wxStaticBoxSizer* StaticBoxSizer2;
258  wxFlexGridSizer* FlexGridSizer4;
259  wxFlexGridSizer* FlexGridSizer16;
260  wxFlexGridSizer* FlexGridSizer10;
261  wxFlexGridSizer* FlexGridSizer3;
262  wxFlexGridSizer* FlexGridSizer5;
263  wxFlexGridSizer* FlexGridSizer2;
264  wxFlexGridSizer* FlexGridSizer18;
265  wxFlexGridSizer* FlexGridSizer13;
266  wxFlexGridSizer* FlexGridSizer12;
267  wxStaticBoxSizer* StaticBoxSizer1;
268  wxFlexGridSizer* FlexGridSizer1;
269  wxFlexGridSizer* FlexGridSizer11;
270 
271  Create(
272  parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
273  _T("id"));
274  FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
275  FlexGridSizer1->AddGrowableCol(0);
276  FlexGridSizer1->AddGrowableRow(0);
277  pagesCameras = new wxNotebook(
278  this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0,
279  _T("ID_NOTEBOOK1"));
280  Panel2 = new wxPanel(
281  pagesCameras, ID_PANEL2, wxDefaultPosition, wxDefaultSize,
282  wxTAB_TRAVERSAL, _T("ID_PANEL2"));
283  FlexGridSizer10 = new wxFlexGridSizer(0, 2, 0, 0);
284  FlexGridSizer10->AddGrowableCol(1);
285  StaticText1 = new wxStaticText(
286  Panel2, ID_STATICTEXT1, _("Camera index:"), wxDefaultPosition,
287  wxDefaultSize, 0, _T("ID_STATICTEXT1"));
288  FlexGridSizer10->Add(
289  StaticText1, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
290  opencvCamIndex = new wxSpinCtrl(
291  Panel2, ID_SPINCTRL1, _T("0"), wxDefaultPosition, wxDefaultSize, 0, 0,
292  100, 0, _T("ID_SPINCTRL1"));
293  opencvCamIndex->SetValue(_T("0"));
294  FlexGridSizer10->Add(
295  opencvCamIndex, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
296  StaticText3 = new wxStaticText(
297  Panel2, ID_STATICTEXT3, _("Camera type:"), wxDefaultPosition,
298  wxDefaultSize, 0, _T("ID_STATICTEXT3"));
299  FlexGridSizer10->Add(
300  StaticText3, 1,
301  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
302  cbOpencvCamType = new wxChoice(
303  Panel2, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, nullptr, 0,
304  wxDefaultValidator, _T("ID_CHOICE1"));
305  cbOpencvCamType->SetSelection(
306  cbOpencvCamType->Append(_("CAMERA_CV_AUTODETECT")));
307  cbOpencvCamType->Append(_("CAMERA_CV_DC1394"));
308  cbOpencvCamType->Append(_("CAMERA_CV_VFL"));
309  cbOpencvCamType->Append(_("CAMERA_CV_VFW"));
310  cbOpencvCamType->Append(_("CAMERA_CV_MIL"));
311  cbOpencvCamType->Append(_("CAMERA_CV_DSHOW"));
312  FlexGridSizer10->Add(
313  cbOpencvCamType, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
314  StaticText6 = new wxStaticText(
315  Panel2, ID_STATICTEXT6, _("Resolution:"), wxDefaultPosition,
316  wxDefaultSize, 0, _T("ID_STATICTEXT6"));
317  FlexGridSizer10->Add(
318  StaticText6, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
319  cbOpencvResolution = new wxChoice(
320  Panel2, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 0, nullptr, 0,
321  wxDefaultValidator, _T("ID_CHOICE2"));
322  cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_("default")));
323  cbOpencvResolution->Append(_("320x240"));
324  cbOpencvResolution->Append(_("640x480"));
325  FlexGridSizer10->Add(
326  cbOpencvResolution, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
327  5);
328  FlexGridSizer10->Add(
329  -1, -1, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
330  0);
331  Panel2->SetSizer(FlexGridSizer10);
332  FlexGridSizer10->Fit(Panel2);
333  FlexGridSizer10->SetSizeHints(Panel2);
334  Panel3 = new wxPanel(
335  pagesCameras, ID_PANEL3, wxDefaultPosition, wxDefaultSize,
336  wxTAB_TRAVERSAL, _T("ID_PANEL3"));
337  FlexGridSizer11 = new wxFlexGridSizer(0, 1, 0, 0);
338  FlexGridSizer11->AddGrowableCol(0);
339  StaticText7 = new wxStaticText(
340  Panel3, ID_STATICTEXT7, _("IP Camera URL:"), wxDefaultPosition,
341  wxDefaultSize, 0, _T("ID_STATICTEXT7"));
342  FlexGridSizer11->Add(
343  StaticText7, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
344  edIPcamURL = new wxTextCtrl(
345  Panel3, ID_TEXTCTRL1, _("rtsp://192.168.0.1/live.sdp"),
346  wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
347  _T("ID_TEXTCTRL1"));
348  FlexGridSizer11->Add(
349  edIPcamURL, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
350  Panel3->SetSizer(FlexGridSizer11);
351  FlexGridSizer11->Fit(Panel3);
352  FlexGridSizer11->SetSizeHints(Panel3);
353  Panel4 = new wxPanel(
354  pagesCameras, ID_PANEL4, wxDefaultPosition, wxDefaultSize,
355  wxTAB_TRAVERSAL, _T("ID_PANEL4"));
356  FlexGridSizer16 = new wxFlexGridSizer(0, 1, 0, 0);
357  FlexGridSizer16->AddGrowableCol(0);
358  FlexGridSizer16->AddGrowableRow(0);
359  edCustomCamConfig = new wxTextCtrl(
360  Panel4, ID_TEXTCTRL6,
361  _("// Configuration block for the CCameraSensor object.\n// Check out "
362  "its documentation at:\n// "
363  "http://reference.mrpt.org/devel/"
364  "classmrpt_1_1hwdrivers_1_1_c_camera_sensor.html\n\n[CONFIG]"
365  "\ngrabber_type = opencv \ncv_camera_index = 0\ncv_camera_type = "
366  "CAMERA_CV_AUTODETECT\n\n"),
367  wxDefaultPosition, wxDefaultSize,
368  wxTE_MULTILINE | wxHSCROLL | wxTE_DONTWRAP | wxVSCROLL |
369  wxALWAYS_SHOW_SB,
370  wxDefaultValidator, _T("ID_TEXTCTRL6"));
371  wxFont edCustomCamConfigFont =
372  wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT);
373  if (!edCustomCamConfigFont.Ok())
374  edCustomCamConfigFont =
375  wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
376  edCustomCamConfigFont.SetPointSize(7);
377  edCustomCamConfig->SetFont(edCustomCamConfigFont);
378  FlexGridSizer16->Add(
379  edCustomCamConfig, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
380  Panel4->SetSizer(FlexGridSizer16);
381  FlexGridSizer16->Fit(Panel4);
382  FlexGridSizer16->SetSizeHints(Panel4);
383  Panel5 = new wxPanel(
384  pagesCameras, ID_PANEL5, wxDefaultPosition, wxDefaultSize,
385  wxTAB_TRAVERSAL, _T("ID_PANEL5"));
386  FlexGridSizer12 = new wxFlexGridSizer(0, 1, 0, 0);
387  FlexGridSizer12->AddGrowableCol(0);
388  StaticText8 = new wxStaticText(
389  Panel5, ID_STATICTEXT8, _("Video file to open:"), wxDefaultPosition,
390  wxDefaultSize, 0, _T("ID_STATICTEXT8"));
391  FlexGridSizer12->Add(
392  StaticText8, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
393  edVideoFile = new wxTextCtrl(
394  Panel5, ID_TEXTCTRL2, _("test.avi"), wxDefaultPosition, wxDefaultSize,
395  0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
396  FlexGridSizer12->Add(
397  edVideoFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
398  btnBrowseVideo = new wxButton(
399  Panel5, ID_BUTTON7, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0,
400  wxDefaultValidator, _T("ID_BUTTON7"));
401  FlexGridSizer12->Add(
402  btnBrowseVideo, 1,
403  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
404  Panel5->SetSizer(FlexGridSizer12);
405  FlexGridSizer12->Fit(Panel5);
406  FlexGridSizer12->SetSizeHints(Panel5);
407  Panel6 = new wxPanel(
408  pagesCameras, ID_PANEL6, wxDefaultPosition, wxDefaultSize,
409  wxTAB_TRAVERSAL, _T("ID_PANEL6"));
410  FlexGridSizer13 = new wxFlexGridSizer(0, 3, 0, 0);
411  FlexGridSizer13->AddGrowableCol(1);
412  StaticText9 = new wxStaticText(
413  Panel6, ID_STATICTEXT9, _("Rawlog \nfile:"), wxDefaultPosition,
414  wxDefaultSize, 0, _T("ID_STATICTEXT9"));
415  FlexGridSizer13->Add(
416  StaticText9, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
417  edRawlogFile = new wxTextCtrl(
418  Panel6, ID_TEXTCTRL3, _("test.rawlog"), wxDefaultPosition,
419  wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
420  FlexGridSizer13->Add(
421  edRawlogFile, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
422  btnBrowseRawlog = new wxButton(
423  Panel6, ID_BUTTON8, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0,
424  wxDefaultValidator, _T("ID_BUTTON8"));
425  FlexGridSizer13->Add(
426  btnBrowseRawlog, 1,
427  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
428  StaticText5 = new wxStaticText(
429  Panel6, ID_STATICTEXT5, _("External \nimages:"), wxDefaultPosition,
430  wxDefaultSize, 0, _T("ID_STATICTEXT5"));
431  FlexGridSizer13->Add(
432  StaticText5, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
433  edRawlogImgDir = new wxTextCtrl(
434  Panel6, ID_TEXTCTRL7, _("./Images"), wxDefaultPosition, wxDefaultSize,
435  0, wxDefaultValidator, _T("ID_TEXTCTRL7"));
436  FlexGridSizer13->Add(
437  edRawlogImgDir, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
438  btnBrowseRawlogDir = new wxButton(
439  Panel6, ID_BUTTON9, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0,
440  wxDefaultValidator, _T("ID_BUTTON9"));
441  FlexGridSizer13->Add(
442  btnBrowseRawlogDir, 1,
443  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
444  StaticText10 = new wxStaticText(
445  Panel6, ID_STATICTEXT10, _("Sensor\nlabel:"), wxDefaultPosition,
446  wxDefaultSize, 0, _T("ID_STATICTEXT10"));
447  FlexGridSizer13->Add(
448  StaticText10, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
449  edRawlogLabel = new wxTextCtrl(
450  Panel6, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize,
451  0, wxDefaultValidator, _T("ID_TEXTCTRL8"));
452  FlexGridSizer13->Add(
453  edRawlogLabel, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
454  StaticText11 = new wxStaticText(
455  Panel6, ID_STATICTEXT11, _("(empty=any)"), wxDefaultPosition,
456  wxDefaultSize, 0, _T("ID_STATICTEXT11"));
457  FlexGridSizer13->Add(
458  StaticText11, 1,
459  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
460  Panel6->SetSizer(FlexGridSizer13);
461  FlexGridSizer13->Fit(Panel6);
462  FlexGridSizer13->SetSizeHints(Panel6);
463  Panel1 = new wxPanel(
464  pagesCameras, ID_PANEL7, wxDefaultPosition, wxDefaultSize,
465  wxTAB_TRAVERSAL, _T("ID_PANEL7"));
466  FlexGridSizer18 = new wxFlexGridSizer(2, 2, 0, 0);
467  wxString __wxRadioBoxChoices_1[2] = {_("Left"), _("Right")};
468  rbBumblebeeSel = new wxRadioBox(
469  Panel1, ID_RADIOBOX1, _("Select monocular input"), wxDefaultPosition,
470  wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator,
471  _T("ID_RADIOBOX1"));
472  rbBumblebeeSel->SetSelection(0);
473  FlexGridSizer18->Add(
474  rbBumblebeeSel, 1,
475  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
476  cbBumblebeeRectif = new wxCheckBox(
477  Panel1, ID_CHECKBOX1, _("Use vendor\'s rectify"), wxDefaultPosition,
478  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
479  cbBumblebeeRectif->SetValue(false);
480  FlexGridSizer18->Add(
481  cbBumblebeeRectif, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL,
482  10);
483  FlexGridSizer18->Add(-1, -1, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
484  StaticText2 = new wxStaticText(
485  Panel1, ID_STATICTEXT2, _("(Unchecked = raw images)"),
486  wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
487  FlexGridSizer18->Add(
488  StaticText2, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
489  Panel1->SetSizer(FlexGridSizer18);
490  FlexGridSizer18->Fit(Panel1);
491  FlexGridSizer18->SetSizeHints(Panel1);
492  pnSwissRanger = new wxPanel(
493  pagesCameras, ID_PANEL1, wxDefaultPosition, wxDefaultSize,
494  wxTAB_TRAVERSAL, _T("ID_PANEL1"));
495  FlexGridSizer2 = new wxFlexGridSizer(2, 3, 0, 0);
496  wxString __wxRadioBoxChoices_2[2] = {_("USB"), _("Ethernet")};
497  rbSR_usb = new wxRadioBox(
498  pnSwissRanger, ID_RADIOBOX2, _("Connection"), wxDefaultPosition,
499  wxDefaultSize, 2, __wxRadioBoxChoices_2, 1, 0, wxDefaultValidator,
500  _T("ID_RADIOBOX2"));
501  FlexGridSizer2->Add(
502  rbSR_usb, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
503  StaticText4 = new wxStaticText(
504  pnSwissRanger, ID_STATICTEXT4, _("IP:"), wxDefaultPosition,
505  wxDefaultSize, 0, _T("ID_STATICTEXT4"));
506  FlexGridSizer2->Add(
507  StaticText4, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
508  edSR_IP = new wxTextCtrl(
509  pnSwissRanger, ID_TEXTCTRL4, _("192.168.2.14"), wxDefaultPosition,
510  wxSize(120, -1), 0, wxDefaultValidator, _T("ID_TEXTCTRL4"));
511  FlexGridSizer2->Add(
512  edSR_IP, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
513  StaticBoxSizer1 = new wxStaticBoxSizer(
514  wxHORIZONTAL, pnSwissRanger, _("Channels to grab: "));
515  FlexGridSizer3 = new wxFlexGridSizer(4, 1, 0, 0);
516  cbSR_chIntensity = new wxCheckBox(
517  pnSwissRanger, ID_CHECKBOX3, _("Grayscale intensity"),
518  wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
519  _T("ID_CHECKBOX3"));
520  cbSR_chIntensity->SetValue(true);
521  cbSR_chIntensity->Disable();
522  FlexGridSizer3->Add(
523  cbSR_chIntensity, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
524  cbSR_ch3D = new wxCheckBox(
525  pnSwissRanger, ID_CHECKBOX4, _("3D point cloud"), wxDefaultPosition,
526  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX4"));
527  cbSR_ch3D->SetValue(false);
528  FlexGridSizer3->Add(cbSR_ch3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
529  cbSR_chRange = new wxCheckBox(
530  pnSwissRanger, ID_CHECKBOX5, _("Depth image"), wxDefaultPosition,
531  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX5"));
532  cbSR_chRange->SetValue(false);
533  FlexGridSizer3->Add(
534  cbSR_chRange, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
535  cbSR_chConf = new wxCheckBox(
536  pnSwissRanger, ID_CHECKBOX6, _("Confidence"), wxDefaultPosition,
537  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX6"));
538  cbSR_chConf->SetValue(false);
539  FlexGridSizer3->Add(
540  cbSR_chConf, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
541  StaticBoxSizer1->Add(
542  FlexGridSizer3, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
543  FlexGridSizer2->Add(
544  StaticBoxSizer1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
545  5);
546  pnSwissRanger->SetSizer(FlexGridSizer2);
547  FlexGridSizer2->Fit(pnSwissRanger);
548  FlexGridSizer2->SetSizeHints(pnSwissRanger);
549  pnKinect = new wxPanel(
550  pagesCameras, ID_PANEL8, wxDefaultPosition, wxDefaultSize,
551  wxTAB_TRAVERSAL, _T("ID_PANEL8"));
552  FlexGridSizer4 = new wxFlexGridSizer(2, 3, 0, 0);
553  StaticBoxSizer2 =
554  new wxStaticBoxSizer(wxHORIZONTAL, pnKinect, _("Channels to grab: "));
555  FlexGridSizer5 = new wxFlexGridSizer(4, 1, 0, 0);
556  cbKinect_Int = new wxCheckBox(
557  pnKinect, ID_CHECKBOX7, _("Intensity"), wxDefaultPosition,
558  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX7"));
559  cbKinect_Int->SetValue(true);
560  cbKinect_Int->Disable();
561  FlexGridSizer5->Add(
562  cbKinect_Int, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
563  cbKinect_3D = new wxCheckBox(
564  pnKinect, ID_CHECKBOX8, _("3D point cloud"), wxDefaultPosition,
565  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX8"));
566  cbKinect_3D->SetValue(false);
567  FlexGridSizer5->Add(
568  cbKinect_3D, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
569  cbKinect_Depth = new wxCheckBox(
570  pnKinect, ID_CHECKBOX9, _("Depth image"), wxDefaultPosition,
571  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX9"));
572  cbKinect_Depth->SetValue(false);
573  FlexGridSizer5->Add(
574  cbKinect_Depth, 1, wxALL | wxALIGN_LEFT | wxALIGN_BOTTOM, 5);
575  StaticBoxSizer2->Add(
576  FlexGridSizer5, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM, 0);
577  FlexGridSizer4->Add(
578  StaticBoxSizer2, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM,
579  5);
580  wxString __wxRadioBoxChoices_3[2] = {_("RGB camera"), _("IR camera")};
581  rbKinect_int = new wxRadioBox(
582  pnKinect, ID_RADIOBOX3, _("Intensity channel:"), wxDefaultPosition,
583  wxDefaultSize, 2, __wxRadioBoxChoices_3, 1, 0, wxDefaultValidator,
584  _T("ID_RADIOBOX3"));
585  rbKinect_int->SetSelection(0);
586  FlexGridSizer4->Add(
587  rbKinect_int, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL, 5);
588  pnKinect->SetSizer(FlexGridSizer4);
589  FlexGridSizer4->Fit(pnKinect);
590  FlexGridSizer4->SetSizeHints(pnKinect);
591  pagesCameras->AddPage(Panel2, _("Camera (opencv)"), false);
592  pagesCameras->AddPage(Panel3, _("Camera (FFmpeg)"), false);
593  pagesCameras->AddPage(Panel4, _("Camera (custom)"), false);
594  pagesCameras->AddPage(Panel5, _("Video file"), false);
595  pagesCameras->AddPage(Panel6, _("Rawlog file"), false);
596  pagesCameras->AddPage(Panel1, _("Bumblebee"), false);
597  pagesCameras->AddPage(pnSwissRanger, _("SwissRanger ToF"), false);
598  pagesCameras->AddPage(pnKinect, _("Kinect"), false);
599  FlexGridSizer1->Add(
600  pagesCameras, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
601  cbGrayscale = new wxCheckBox(
602  this, ID_CHECKBOX2, _("Capture in grayscale"), wxDefaultPosition,
603  wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2"));
604  cbGrayscale->SetValue(true);
605  FlexGridSizer1->Add(
606  cbGrayscale, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
607  SetSizer(FlexGridSizer1);
608  FlexGridSizer1->Fit(this);
609  FlexGridSizer1->SetSizeHints(this);
610 
611  Connect(
612  ID_BUTTON7, wxEVT_COMMAND_BUTTON_CLICKED,
613  (wxObjectEventFunction)&CPanelCameraSelection::OnbtnBrowseVideoClick);
614  Connect(
615  ID_BUTTON8, wxEVT_COMMAND_BUTTON_CLICKED,
616  (wxObjectEventFunction)&CPanelCameraSelection::OnbtnBrowseRawlogClick);
617  Connect(
618  ID_BUTTON9, wxEVT_COMMAND_BUTTON_CLICKED,
619  (wxObjectEventFunction)&CPanelCameraSelection::
620  OnbtnBrowseRawlogDirClick);
621  //*)
622 
623  // end of automatically-generated code above:
624  cbOpencvResolution->Clear();
625  cbOpencvResolution->SetSelection(cbOpencvResolution->Append(_("default")));
626 
627  cbOpencvResolution->Append(_("320x240"));
628  cbOpencvResolution->Append(_("640x480"));
629  cbOpencvResolution->Append(_("800x600"));
630  cbOpencvResolution->Append(_("1024x768"));
631  cbOpencvResolution->Append(_("1280x1024"));
632 }
633 
635 {
636  wxFileDialog dialog(
637  this, wxT("Choose a video to open"), wxT("."), wxT(""),
638  wxT("Video files (*.avi;*.mpg;*.mov)|*.avi;*.mpg;*.mov|All files "
639  "(*.*)|*.*"),
640  wxFD_OPEN | wxFD_FILE_MUST_EXIST);
641 
642  if (dialog.ShowModal() == wxID_OK) edVideoFile->SetValue(dialog.GetPath());
643 }
644 
646 {
647  wxFileDialog dialog(
648  this, wxT("Choose a rawlog to open"), wxT("."), wxT(""),
649  wxT("Rawlog files (*.rawlog;*.rawlog.gz)|*.rawlog;*.rawlog.gz|All "
650  "files (*.*)|*.*"),
651  wxFD_OPEN | wxFD_FILE_MUST_EXIST);
652 
653  if (dialog.ShowModal() == wxID_OK)
654  {
655  edRawlogFile->SetValue(dialog.GetPath());
656 
658  string(edRawlogImgDir->GetValue().mb_str())))
659  {
660  string fil = string(dialog.GetPath().mb_str());
661  string fil_path = mrpt::system::extractFileDirectory(fil);
662  fil_path += "/Images";
663  edRawlogImgDir->SetValue(fil_path.c_str());
664  }
665  }
666 }
667 
669 {
670  wxDirDialog dialog(
671  this, wxT("Choose the rawlog directory with external images"),
672  edRawlogImgDir->GetValue(), wxDD_DEFAULT_STYLE);
673 
674  if (dialog.ShowModal() == wxID_OK)
675  edRawlogImgDir->SetValue(dialog.GetPath());
676 }
677 
679 {
680  //(*Destroy(CPanelCameraSelection)
681  //*)
682 }
683 
684 /* ------------------------------------------------------------------------
685  writeConfigFromVideoSourcePanel
686  ------------------------------------------------------------------------ */
689 {
690  MRPT_START
691 
692  switch (this->pagesCameras->GetSelection())
693  {
694  // OpenCV:
695  // -----------------------------------
696  case 0:
697  {
698  cfg->write(sect, "grabber_type", "opencv");
699  cfg->write(
700  sect, "cv_camera_index",
701  format("%i", this->opencvCamIndex->GetValue()));
702  cfg->write(
703  sect, "cv_camera_type",
704  string(this->cbOpencvCamType->GetStringSelection().mb_str()));
705 
706  const std::string sRes =
707  std::string(cbOpencvResolution->GetStringSelection().mb_str());
708 
709  if (!sRes.empty())
710  {
711  const size_t p = sRes.find("x");
712  if (p != std::string::npos)
713  {
714  const std::string sW = sRes.substr(0, p);
715  const std::string sH = sRes.substr(p + 1);
716 
717  cfg->write(sect, "cv_frame_width", sW);
718  cfg->write(sect, "cv_frame_height", sH);
719  }
720  }
721  }
722  break;
723 
724  // Camera FFmpeg
725  // -----------------------------------
726  case 1:
727  {
728  cfg->write(sect, "grabber_type", "ffmpeg");
729  cfg->write(
730  sect, "ffmpeg_url",
731  string(this->edIPcamURL->GetValue().mb_str()));
732  }
733  break;
734 
735  // Camera custom
736  // -----------------------------------
737  case 2:
738  {
739  // Replicate the config sections in "edCustomCamConfig" into "cfg":
741  string(edCustomCamConfig->GetValue().mb_str()));
742  std::vector<std::string> allSects;
743  cfgIn.getAllSections(allSects);
744  for (const auto& allSect : allSects)
745  {
746  std::vector<std::string> keys;
747  cfgIn.getAllKeys(allSect, keys);
748  for (const auto& key : keys)
749  cfg->write(
750  allSect, key, cfgIn.read_string(allSect, key, ""));
751  }
752  }
753  break;
754 
755  // Video file
756  // -----------------------------------
757  case 3:
758  {
759  cfg->write(sect, "grabber_type", "ffmpeg");
760  cfg->write(
761  sect, "ffmpeg_url",
762  string(this->edVideoFile->GetValue().mb_str()));
763  }
764  break;
765 
766  // Rawlog
767  // -----------------------------------
768  case 4:
769  {
770  cfg->write(sect, "grabber_type", "rawlog");
771  cfg->write(
772  sect, "rawlog_file",
773  string(this->edRawlogFile->GetValue().mb_str()));
774 
775  const string rawlog_lb =
776  string(this->edRawlogLabel->GetValue().mb_str());
777  if (!rawlog_lb.empty())
778  cfg->write(sect, "rawlog_camera_sensor_label", rawlog_lb);
779 
781  string(this->edRawlogImgDir->GetValue().mb_str()));
782  }
783  break;
784 
785  // Bumblebee
786  // -----------------------------------
787  case 5:
788  {
789  cfg->write(sect, "grabber_type", "bumblebee");
790  if (this->rbBumblebeeSel->GetSelection() < 2)
791  cfg->write(
792  sect, "bumblebee_mono",
793  format("%i\n", (int)this->rbBumblebeeSel->GetSelection()));
794  else
795  { /* Use stereo capture */
796  }
797  cfg->write(sect, "bumblebee_fps", 15);
798  cfg->write(
799  sect, "bumblebee_get_rectified",
800  this->cbBumblebeeRectif->GetValue());
801  }
802  break;
803 
804  // Swissranger
805  // -----------------------------------
806  case 6:
807  {
808  cfg->write(sect, "grabber_type", "swissranger");
809 
810  cfg->write(sect, "sr_use_usb", rbSR_usb->GetSelection() == 0);
811  cfg->write(sect, "sr_IP", string(edSR_IP->GetValue().mb_str()));
812 
813  cfg->write(sect, "sr_grab_grayscale", cbSR_chIntensity->GetValue());
814  cfg->write(sect, "sr_grab_3d", cbSR_ch3D->GetValue());
815  cfg->write(sect, "sr_grab_range", cbSR_chRange->GetValue());
816  cfg->write(sect, "sr_grab_confidence", cbSR_chConf->GetValue());
817  }
818  break;
819 
820  // Kinect
821  // -----------------------------------
822  case 7:
823  {
824  cfg->write(sect, "grabber_type", "kinect");
825 
826  cfg->write(sect, "kinect_grab_intensity", cbKinect_Int->GetValue());
827  cfg->write(sect, "kinect_grab_3d", cbKinect_3D->GetValue());
828  cfg->write(sect, "kinect_grab_range", cbKinect_Depth->GetValue());
829 
830  cfg->write(
831  sect, "kinect_video_rgb",
832  rbKinect_int->GetSelection() == 0 ? 1 : 0);
833  }
834  break;
835 
836  default:
837  {
838  cerr << "[MRPT CPanelCameraSelection] ERROR: Unknown camera "
839  "selection tab!\n";
840  THROW_EXCEPTION("Unknown camera selection tab!");
841  }
842  }
843 
844  // Add grayscale option:
845  cfg->write(sect, "capture_grayscale", this->cbGrayscale->GetValue());
846 
847  MRPT_END
848 }
849 
850 /* ------------------------------------------------------------------------
851  readConfigIntoVideoSourcePanel
852  ------------------------------------------------------------------------ */
854  const std::string& sect, const mrpt::config::CConfigFileBase* cfg) const
855 {
856  MRPT_START
857 
858  const std::string grab_type =
859  cfg->read_string(sect, "grabber_type", "opencv");
860 
861  if (grab_type == "opencv")
862  {
863  this->pagesCameras->SetSelection(0);
864 
865  this->opencvCamIndex->SetValue(
866  cfg->read_int(sect, "cv_camera_index", 0));
867  this->cbOpencvCamType->SetStringSelection(
868  cfg->read_string(sect, "cv_camera_type", "").c_str());
869 
870  const int w = cfg->read_int(sect, "cv_frame_width", 0);
871 
872  if (w == 320)
873  this->cbOpencvResolution->SetSelection(1);
874  else if (w == 640)
875  this->cbOpencvResolution->SetSelection(2);
876  else
877  this->cbOpencvResolution->SetSelection(0);
878  }
879  else if (grab_type == "ffmpeg")
880  {
881  // Page: 1 (IP), 3 (file)
882  const string url =
883  cfg->read_string(sect, "ffmpeg_url", "rtsp://192.168.0.1/live.sdp");
884 
885  if (url.substr(0, 5) == "rtsp:")
886  {
887  this->pagesCameras->SetSelection(1);
888  this->edIPcamURL->SetValue(url.c_str());
889  }
890  else
891  {
892  this->pagesCameras->SetSelection(3);
893  this->edVideoFile->SetValue(url.c_str());
894  }
895  }
896  else if (grab_type == "rawlog")
897  {
898  this->pagesCameras->SetSelection(4);
899 
900  this->edRawlogFile->SetValue(
901  cfg->read_string(sect, "rawlog_file", "").c_str());
902 
903  const string lb =
904  cfg->read_string(sect, "rawlog_camera_sensor_label", "");
905  this->edRawlogLabel->SetValue(lb.c_str());
906  }
907  else if (grab_type == "bumblebee")
908  {
909  this->pagesCameras->SetSelection(5);
910 
911  this->rbBumblebeeSel->SetSelection(
912  cfg->read_int(sect, "bumblebee_mono", 0));
913  this->cbBumblebeeRectif->SetValue(
914  cfg->read_bool(sect, "bumblebee_get_rectified", false));
915  }
916  else if (grab_type == "swissranger")
917  {
918  this->pagesCameras->SetSelection(6);
919 
920  this->rbSR_usb->SetSelection(
921  cfg->read_bool(sect, "sr_use_usb", true) ? 0 : 1);
922  this->edSR_IP->SetValue(
923  cfg->read_string(sect, "sr_IP", "192.168.0.1").c_str());
924 
925  this->cbSR_chIntensity->SetValue(
926  cfg->read_bool(sect, "sr_grab_grayscale", true));
927  this->cbSR_ch3D->SetValue(cfg->read_bool(sect, "sr_grab_3d", false));
928  this->cbSR_chRange->SetValue(
929  cfg->read_bool(sect, "sr_grab_range", false));
930  this->cbSR_chConf->SetValue(
931  cfg->read_bool(sect, "sr_grab_confidence", false));
932  }
933  else
935  "Error: Unknown choice in 'grabber_type': '%s'", grab_type.c_str());
936 
937  // Grayscale option:
938  this->cbGrayscale->SetValue(
939  cfg->read_bool(sect, "capture_grayscale", false));
940 
941  MRPT_END
942 }
943 
945 {
946  int mod = MRPTKMOD_NONE;
947  if (ev.AltDown()) mod |= MRPTKMOD_ALT;
948  if (ev.CmdDown()) mod |= MRPTKMOD_CMD;
949  if (ev.ControlDown()) mod |= MRPTKMOD_CONTROL;
950  if (ev.MetaDown()) mod |= MRPTKMOD_META;
951  if (ev.ShiftDown()) mod |= MRPTKMOD_SHIFT;
952  return mrptKeyModifier(mod);
953 }
954 
955 #endif // MRPT_HAS_WXWIDGETS
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.
Definition: img/CImage.h:74
static const long ID_BUTTON9
Definition: WxUtils.h:238
static const long ID_CHOICE1
Definition: WxUtils.h:220
#define MRPT_START
Definition: exceptions.h:241
static const long ID_PANEL3
Definition: WxUtils.h:226
std::string read_string(const std::string &section, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
void GetBitmap(wxBitmap &bmp)
Definition: WxUtils.cpp:190
#define THROW_EXCEPTION(msg)
Definition: exceptions.h:67
std::string std::string format(std::string_view fmt, ARGS &&... args)
Definition: format.h:26
void OnbtnBrowseRawlogDirClick(wxCommandEvent &event)
Definition: WxUtils.cpp:668
const T * ptrLine(unsigned int row) const
Returns a pointer to the first pixel of the given line.
Definition: img/CImage.h:596
static const long ID_SPINCTRL1
Definition: WxUtils.h:218
static const long ID_STATICTEXT9
Definition: WxUtils.h:233
static const long ID_STATICTEXT1
Definition: WxUtils.h:217
static const long ID_CHECKBOX4
Definition: WxUtils.h:251
static const long ID_RADIOBOX3
Definition: WxUtils.h:258
static const long ID_RADIOBOX2
Definition: WxUtils.h:247
void OnMouseMove(wxMouseEvent &ev)
Definition: WxUtils.cpp:138
static const long ID_PANEL1
Definition: WxUtils.h:254
static const long ID_CHECKBOX1
Definition: WxUtils.h:244
static const long ID_TEXTCTRL6
Definition: WxUtils.h:227
mrptKeyModifier
Definition: keycodes.h:156
TImageChannels getChannelCount() const
Returns the number of channels, typically 1 (GRAY) or 3 (RGB)
Definition: CImage.cpp:907
size_t getHeight() const override
Returns the height of the image in pixels.
Definition: CImage.cpp:878
std::string getChannelsOrder() const
As of mrpt 2.0.0, this returns either "GRAY" or "BGR".
Definition: CImage.cpp:857
static const long ID_NOTEBOOK1
Definition: WxUtils.h:260
STL namespace.
wxMRPTImageControl(wxWindow *parent, wxWindowID winID, int x, int y, int width, int height)
Definition: WxUtils.cpp:113
static const long ID_CHECKBOX6
Definition: WxUtils.h:253
static const long ID_CHECKBOX5
Definition: WxUtils.h:252
GLdouble s
Definition: glext.h:3682
GLuint src
Definition: glext.h:7397
wxImage * MRPTImage2wxImage(const mrpt::img::CImage &img)
Create a wxImage from a MRPT image.
Definition: WxUtils.cpp:24
void getAllKeys(const std::string &section, 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.
Definition: WxUtils.cpp:89
GLenum GLsizei width
Definition: glext.h:3535
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4199
static const long ID_CHECKBOX3
Definition: WxUtils.h:250
static const long ID_TEXTCTRL8
Definition: WxUtils.h:240
int read_int(const std::string &section, const std::string &name, int defaultValue, bool failIfNotFound=false) const
static const long ID_TEXTCTRL3
Definition: WxUtils.h:234
void swapRB()
Swaps red and blue channels.
Definition: CImage.cpp:1609
CImage colorImage() const
Returns a color (RGB) version of the grayscale image, or a shallow copy of itself if it is already a ...
Definition: CImage.cpp:1814
mrpt::img::CImage CImage
Definition: utils/CImage.h:5
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.
Definition: CImage.cpp:847
static const long ID_TEXTCTRL1
Definition: WxUtils.h:225
void OnMouseClick(wxMouseEvent &ev)
Definition: WxUtils.cpp:144
static const long ID_CHECKBOX8
Definition: WxUtils.h:256
static const long ID_CHECKBOX7
Definition: WxUtils.h:255
GLint GLvoid * img
Definition: glext.h:3769
void OnbtnBrowseVideoClick(wxCommandEvent &event)
Definition: WxUtils.cpp:634
void readConfigIntoVideoSourcePanel(const std::string &sect, const mrpt::config::CConfigFileBase *cfg) const
Definition: WxUtils.cpp:853
static const long ID_CHOICE2
Definition: WxUtils.h:222
constexpr auto sect
wxBitmap * MRPTImage2wxBitmap(const mrpt::img::CImage &img)
Create a wxBitmap from a MRPT image.
Definition: WxUtils.cpp:74
static const long ID_STATICTEXT6
Definition: WxUtils.h:221
static const long ID_TEXTCTRL2
Definition: WxUtils.h:230
static const long ID_CHECKBOX2
Definition: WxUtils.h:261
static const long ID_PANEL2
Definition: WxUtils.h:223
static const long ID_STATICTEXT3
Definition: WxUtils.h:219
void writeConfigFromVideoSourcePanel(const std::string &sect, mrpt::config::CConfigFileBase *cfg) const
Definition: WxUtils.cpp:687
static const long ID_PANEL5
Definition: WxUtils.h:232
GLsizei const GLchar ** string
Definition: glext.h:4116
mrptKeyModifier keyEventToMrptKeyModifier(const wxKeyEvent &ev)
Extracts the key modifiers from a wxKeyEvent.
Definition: WxUtils.cpp:944
static const long ID_STATICTEXT2
Definition: WxUtils.h:245
void getAllSections(std::vector< std::string > &sections) const override
Returns a list with all the section names.
void write(const std::string &section, 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
Definition: WxUtils.h:241
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::shared_ptr< mrpt::img ::CImage > Ptr
Definition: img/CImage.h:149
CImage makeDeepCopy() const
Returns a deep copy of this image.
Definition: CImage.cpp:213
bool isColor() const
Returns true if the image is RGB, false if it is grayscale.
Definition: CImage.cpp:888
static const long ID_STATICTEXT10
Definition: WxUtils.h:239
bool read_bool(const std::string &section, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
static const long ID_TEXTCTRL7
Definition: WxUtils.h:237
#define MRPT_END
Definition: exceptions.h:245
size_t getRowStride() const
Returns the row stride of the image: this is the number of bytes between two consecutive rows...
Definition: CImage.cpp:868
static const long ID_TEXTCTRL4
Definition: WxUtils.h:249
static const long ID_STATICTEXT5
Definition: WxUtils.h:236
A panel to select the camera input from all the formats supported by MRPT.
Definition: WxUtils.h:154
void OnPaint(wxPaintEvent &ev)
Definition: WxUtils.cpp:176
static const long ID_CHECKBOX9
Definition: WxUtils.h:257
GLenum GLint GLint y
Definition: glext.h:3542
static const long ID_PANEL8
Definition: WxUtils.h:259
static const long ID_RADIOBOX1
Definition: WxUtils.h:243
static const long ID_PANEL4
Definition: WxUtils.h:228
GLenum GLsizei GLenum format
Definition: glext.h:3535
Classes for creating GUI windows for 2D and 3D visualization.
Definition: about_box.h:14
static const long ID_PANEL7
Definition: WxUtils.h:246
void OnbtnBrowseRawlogClick(wxCommandEvent &event)
Definition: WxUtils.cpp:645
bool directoryExists(const std::string &fileName)
Test if a given directory exists (it fails if the given path refers to an existing file)...
Definition: filesystem.cpp:137
mrpt::img::CImage::Ptr wxImage2MRPTImagePtr(const wxImage &img)
Create a MRPT image from a wxImage.
Definition: WxUtils.cpp:105
GLenum GLint x
Definition: glext.h:3542
GLenum GLsizei GLsizei height
Definition: glext.h:3558
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
Definition: exceptions.h:69
static const long ID_BUTTON7
Definition: WxUtils.h:231
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3550
GLfloat GLfloat p
Definition: glext.h:6398
static void setImagesPathBase(const std::string &path)
Definition: CImage.cpp:84
static const long ID_STATICTEXT4
Definition: WxUtils.h:248
static const long ID_STATICTEXT7
Definition: WxUtils.h:224
std::string extractFileDirectory(const std::string &filePath)
Extract the whole path (the directory) of a filename from a complete path plus name plus extension...
Definition: filesystem.cpp:78
void AssignImage(wxBitmap *img)
Assigns this image.
Definition: WxUtils.cpp:150
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:147
static const long ID_PANEL6
Definition: WxUtils.h:242
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".
Definition: os.cpp:358
static const long ID_BUTTON8
Definition: WxUtils.h:235
static const long ID_STATICTEXT8
Definition: WxUtils.h:229



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c1796881b Sat Nov 16 19:04:34 2019 +0100 at sáb nov 16 19:15:10 CET 2019