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