View_Creator_Dialog.cpp
Go to the documentation of this file.
1 
23 #include <wx/sizer.h>
24 #include <asr_halcon_bridge/halcon_image.h>
25 #include <boost/regex.hpp>
26 #include <ros/package.h>
28 #include <boost/thread.hpp>
29 
30 
31 
33 {
34  edit_upper_left_row->Enable(enable);
35  edit_upper_left_column->Enable(enable);
36  edit_lower_right_row->Enable(enable);
37  edit_lower_right_column->Enable(enable);
38  slider_upper_left_row->Enable(enable);
39  slider_upper_left_column->Enable(enable);
40  slider_lower_right_row->Enable(enable);
41  slider_lower_right_column->Enable(enable);
42  edit_orientation_x->Enable(enable);
43  edit_orientation_y->Enable(enable);
44  edit_orientation_z->Enable(enable);
45  edit_score_2D->Enable(enable);
46  edit_vertical_offset->Enable(enable);
47  edit_horizontal_offset->Enable(enable);
48  edit_axis_1_x->Enable(enable);
49  edit_axis_1_y->Enable(enable);
50  edit_axis_1_z->Enable(enable);
51  edit_axis_1_angle->Enable(enable);
52  edit_axis_2_x->Enable(enable);
53  edit_axis_2_y->Enable(enable);
54  edit_axis_2_z->Enable(enable);
55  edit_axis_2_angle->Enable(enable);
56  edit_depth->Enable(enable);
57  edit_fern_number->Enable(enable);
58  edit_patch_size->Enable(enable);
59  edit_min_scale->Enable(enable);
60  edit_max_scale->Enable(enable);
61  check_invertable->Enable(enable);
62  check_use_color->Enable(enable);
63 }
64 
66 {
67 
68  enableGuiElements(enable);
69  choice_image_source->Enable(enable);
70  choice_image->Enable(enable);
71  choice_test_image->Enable(enable);
72  choice_test_image_source->Enable(enable);
73  if ((choice_image_source->GetSelection() == 2) && (choice_image->GetSelection() > 0)) {
74  check_fix_current_image->Enable(enable);
75  }
76  button_save->Enable(enable);
77  button_cancel->Enable(enable);
78 
79 }
80 
81 
83  if ((check_fix_current_image->IsChecked()) && (fixed_image_available)) {
84 
85  int row1 = boost::lexical_cast<int>(trim(std::string(edit_upper_left_row->GetValue().mb_str())));
86  int column1 = boost::lexical_cast<int>(trim(std::string(edit_upper_left_column->GetValue().mb_str())));
87  int row2 = boost::lexical_cast<int>(trim(std::string(edit_lower_right_row->GetValue().mb_str())));
88  int column2 = boost::lexical_cast<int>(trim(std::string(edit_lower_right_column->GetValue().mb_str())));
89 
90  HalconCpp::HRegion region;
91  region.GenRectangle1(row1, column1, row2, column2);
92  HalconCpp::HImage croppedImage = fixedImage.ReduceDomain(region);
93  croppedImage = croppedImage.ChangeFormat(croppedImage.Width(), croppedImage.Height());
94 
95  image_model->setImage(createBitmap(croppedImage, 480, 360));
97 
98  }
99 }
100 
101 void ViewCreatorDialog::paint_test_image(HalconCpp::HImage img)
102 {
103  img = img.ZoomImageSize(480, 360, "bilinear");
104  image_test->setImage(createBitmap(img, 480, 360));
105  image_test->paintNow();
106 
107 }
108 
109 
110 
112  : ViewCreatorDialogBase(parent), params(params), fixed_image_available(false),
115 {
116 
118  label_axis_2->Show(false);
119  label_axis_2_x->Show(false);
120  edit_axis_2_x->Show(false);
121  label_axis_2_y->Show(false);
122  edit_axis_2_y->Show(false);
123  label_axis_2_z->Show(false);
124  edit_axis_2_z->Show(false);
125  label_axis_2_angle->Show(false);
126  edit_axis_2_angle->Show(false);
127 
128  if (params->getRotationType() == ROTATIONTYPE_NO_ROTATION) {
129  label_axis_1->Show(false);
130  label_axis_1_x->Show(false);
131  edit_axis_1_x->Show(false);
132  label_axis_1_y->Show(false);
133  edit_axis_1_y->Show(false);
134  label_axis_1_z->Show(false);
135  edit_axis_1_z->Show(false);
136  label_axis_1_angle->Show(false);
137  edit_axis_1_angle->Show(false);
138  }
139  }
140 
141 
142  update_timer = new wxTimer(this);
143  update_timer->Start(200);
144  Connect(update_timer->GetId(), wxEVT_TIMER, wxTimerEventHandler(ViewCreatorDialog::onUpdate), NULL, this);
145 
146  image_test->setImage(new wxBitmap(wxImage(480, 360)));
147  image_test->paintNow();
148 
149 
150 
151  if (params->getIsValid()) {
152  choice_image_source->AppendString(wxT("edit image"));
153  choice_image_source->SetSelection(3);
154  wxCommandEvent evt;
155  onChoiceImageSource(evt);
156 
157  } else {
158  image_model->setImage(new wxBitmap(wxImage(480, 360)));
160 
161  choice_image->Clear();
162  choice_image->Insert(wxString("<No selection>", wxConvUTF8), 0);
163  choice_image->SetSelection(0);
164 
165  choice_test_image->Clear();
166  choice_test_image->Insert(wxString("<No selection>", wxConvUTF8), 0);
167  choice_test_image->SetSelection(0);
168 
169  edit_upper_left_row->SetValue(wxT("0"));
170  edit_upper_left_column->SetValue(wxT("0"));
171  edit_lower_right_row->SetValue(wxT("359"));
172  edit_lower_right_column->SetValue(wxT("479"));
173  slider_lower_right_row->SetMax(359);
174  slider_lower_right_row->SetValue(359);
175  slider_lower_right_column->SetMax(479);
176  slider_lower_right_column->SetValue(479);
177  edit_score_2D->SetValue(wxT("0.2"));
178  edit_vertical_offset->SetValue(wxT("0"));
179  edit_horizontal_offset->SetValue(wxT("0"));
180  edit_axis_1_angle->SetValue(wxT("1.0"));
181  edit_axis_2_angle->SetValue(wxT("1.0"));
182  edit_depth->SetValue(wxT("8"));
183  edit_fern_number->SetValue(wxT("50"));
184  edit_patch_size->SetValue(wxT("17"));
185  edit_min_scale->SetValue(wxT("0.6"));
186  edit_max_scale->SetValue(wxT("1.3"));
187 
188 
189  enableGuiElements(false);
190 
191  check_fix_current_image->Enable(false);
192 
193  }
194 
195  label_model_points_value->SetLabel(wxT("0"));
196  label_search_points_value->SetLabel(wxT("0"));
197  label_matched_points_value->SetLabel(wxT("0"));
198  label_average_matched_points_value->SetLabel(wxT("0"));
199  label_time_value->SetLabel(wxT("0.0"));
200  label_average_time_value->SetLabel(wxT("0.0"));
201  button_end_test->Enable(false);
202 
203 
204 }
205 
206 void ViewCreatorDialog::onModelCameraImage(const sensor_msgs::Image::ConstPtr& msg) {
207  if (!check_fix_current_image->IsChecked()) {
208  image_model->setImage(createBitmap(msg, 480, 360));
210  } else if (!fixed_image_available){
211  if ((msg->encoding == "bgr8") || (msg->encoding == "rgb8") || (msg->encoding == "mono8")) {
212  image_model->setImage(createBitmap(msg, 480, 360));
214  fixedImage = *halcon_bridge::toHalconCopy(*msg)->image;
215  fixed_image_available = true;
216 
217  slider_upper_left_column->SetValue(0);
218  slider_upper_left_column->SetMax((int)fixedImage.Width() - 1);
219  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), 0));
220 
221  slider_upper_left_row->SetMax((int)fixedImage.Height() - 1);
222  slider_upper_left_row->SetValue(0);
223  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), 0));
224 
225  slider_lower_right_column->SetMax((int)fixedImage.Width() - 1);
226  slider_lower_right_column->SetValue((int)fixedImage.Width() - 1);
227  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"),(int)fixedImage.Width() - 1));
228 
229  slider_lower_right_row->SetMax((int)fixedImage.Height() - 1);
230  slider_lower_right_row->SetValue((int)fixedImage.Height() - 1);
231  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"),(int)fixedImage.Height() - 1));
232 
233  enableGuiElements(true);
234  }
235  }
236 }
237 
238 
239 
240 void ViewCreatorDialog::onTestCameraImage(const sensor_msgs::Image::ConstPtr& msg, bool use_file) {
241  if (test_running ) {
242  HalconCpp::HImage img;
243  std::string enc = "rgb8";
244  if (use_file) {
245  boost::filesystem::path input_path(ros::package::getPath("asr_descriptor_surface_based_recognition") + INPUT_FOLDER + "/");
246  std::string filename_str = input_path.string() + std::string(choice_test_image->GetStringSelection().mb_str());
247  img = HalconCpp::HImage(filename_str.c_str());
248  } else {
249  enc = msg->encoding;
250  img = *halcon_bridge::toHalconCopy(msg)->image;
251  }
252  frame_counter++;
253  HalconCpp::HTuple sc, search_all_row, search_all_column, search_row, search_column, model_row, model_column;
254  HalconCpp::HTuple color(255);
255  if (!(check_use_color->IsChecked())) {
256  img = img.Rgb1ToGray();
257  enc = "mono8";
258  } else {
259  color.Append(255);
260  color.Append(0);
261  }
262 
263  try {
264  ros::Time start_time = ros::Time::now();
265  double set_score = boost::lexical_cast<double>(trim(std::string(edit_score_2D->GetValue().mb_str())));
266  if ((set_score <= 0) || (set_score >= 1)) {
267  set_score = 0.0;
268  }
269  img.FindUncalibDescriptorModel(desc_model, HalconCpp::HTuple(), HalconCpp::HTuple(), HalconCpp::HTuple(), HalconCpp::HTuple(), set_score, 1, "inlier_ratio", &sc);
270  ros::Duration search_duration = ros::Time::now() - start_time;
271  time_sum += search_duration.toSec();
272  label_time_value->SetLabel(wxString::Format(wxT("%f"), search_duration.toSec()));
273  label_average_time_value->SetLabel(wxString::Format(wxT("%f"), time_sum / frame_counter));
274  desc_model.GetDescriptorModelPoints("search", "all", &search_all_row, &search_all_column);
275 
276  label_search_points_value->SetLabel(wxString::Format(wxT("%i"), search_all_row.Length()));
277  desc_model.GetDescriptorModelPoints("search", 0, &search_row, &search_column);
278  label_matched_points_value->SetLabel(wxString::Format(wxT("%i"), search_row.Length()));
279  if (search_row.Length() > 0) {
280  HalconCpp::HRegion points;
281  points.GenRegionPoints(search_row, search_column);
282  HalconCpp::HString type = "fill";
283  img = points.PaintRegion(img, color, type);
284 
285  int vertical_offset = boost::lexical_cast<int>(trim(std::string(edit_vertical_offset->GetValue().mb_str())));
286  int horizontal_offset = boost::lexical_cast<int>(trim(std::string(edit_horizontal_offset->GetValue().mb_str())));
287  HalconCpp::HTuple matrix_tuple = desc_model.GetDescriptorModelResults(0, "homography");
288  HalconCpp::HHomMat2D matrix;
289  matrix.SetFromTuple(matrix_tuple);
290 
291  double trans_x, trans_y, trans_w;
292  trans_x = matrix.ProjectiveTransPoint2d(vertical_offset, horizontal_offset, 1, &trans_y, &trans_w);
293 
294  int tex_point_row = (int) (trans_x / trans_w);
295  int tex_point_column = (int) (trans_y / trans_w);
296 
297  HalconCpp::HXLDCont tex_point;
298  tex_point.GenCircleContourXld(tex_point_row, tex_point_column, 10, 0, 6.28318, "positive", 1);
299  img = tex_point.PaintXld(img, color);
300 
301 
302  }
303  feature_sum += search_row.Length();
304  label_average_matched_points_value->SetLabel(wxString::Format(wxT("%i"), (int)(feature_sum / frame_counter)));
305 
306 
307 
308  }catch (HalconCpp::HException exc) {
309  label_matched_points_value->SetLabel(wxT("0"));
310  }
311  double score = 0;
312  if (sc.Length() > 0) {
313  score = sc[0];
314  }
315 
316  score_sum += score;
317  label_score_value->SetLabel(wxString::Format(wxT("%f"), score));
318  label_frame_number_value->SetLabel(wxString::Format(wxT("%i"), frame_counter));
319  label_average_score_value->SetLabel(wxString::Format(wxT("%f"), score_sum / frame_counter));
320 
321 
322  desc_model.GetDescriptorModelPoints("model", "all", &model_row, &model_column);
323  label_model_points_value->SetLabel(wxString::Format(wxT("%i"), model_row.Length()));
324 
325 
326  paint_thread = boost::thread(boost::bind(&ViewCreatorDialog::paint_test_image, this, img));
327 
328  paint_thread.timed_join(boost::posix_time::millisec(100));
329 
330 
331 
332 
333  } else {
334  paint_thread.join();
335  image_test->setImage(createBitmap(msg, 480, 360));
336  image_test->paintNow();
337  }
338 
339 }
340 
341 
342 void ViewCreatorDialog::onUpdate(wxTimerEvent &evt)
343 {
344  ros::spinOnce();
345  if (!ros::ok())
346  {
347  update_timer->Stop();
348  EndModal(wxID_CANCEL);
349  Destroy();
350  }
351  if ((choice_test_image_source->GetSelection() == 1) && (choice_test_image->GetSelection() > 0) && (test_running) && (desc_model_available)) {
352  if (update_counter == 0) {
353  paint_thread.join();
354  sensor_msgs::ImageConstPtr msg;
355  onTestCameraImage(msg, true);
356  }
357  }
358 
359  update_counter = ((update_counter + 1) % 3);
360 }
361 
362 
363 
364 void ViewCreatorDialog::OnDialogClose(wxCloseEvent &event)
365 {
366  wxMessageDialog *dial = new wxMessageDialog(this,
367  wxT("Are you sure you want to cancel?"), wxT("Cancel"),
368  wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
369  if (dial->ShowModal() == wxID_YES) {
370  update_timer->Stop();
373  EndModal(wxID_CANCEL);
374  Destroy();
375  }
376 }
377 
378 void ViewCreatorDialog::onChoiceImageSource( wxCommandEvent& event )
379 {
381  choice_image->Clear();
382  if (choice_image_source->GetSelection() != 3) {
383  wxBitmap* empty = new wxBitmap(wxImage(480, 360));
384  image_model->setImage(empty);
386  choice_image->Insert(wxString("<No selection>", wxConvUTF8), 0);
387  choice_image->SetSelection(0);
388 
389  check_fix_current_image->Enable(false);
390  check_fix_current_image->SetValue(false);
391  enableGuiElements(false);
392  fixed_image_available = false;
393  }
394 
395  desc_model_available = false;
396  label_model_available_value->SetLabel(wxT("No"));
397 
398  switch (choice_image_source->GetSelection()) {
399  case 1:
400  {
401  std::vector<boost::filesystem::path> files;
402  boost::filesystem::path input_path(ros::package::getPath("asr_descriptor_surface_based_recognition") + INPUT_FOLDER + "/");
403  get_all_files_with_ext(input_path, ".png", files);
404  get_all_files_with_ext(input_path, ".jpg", files);
405  std::sort(files.begin(), files.end());
406  for (unsigned int i = 0; i < files.size(); i++) {
407  choice_image->AppendString(wxString(files[i].string().c_str(), wxConvUTF8));
408  }
409 
410  break;
411  }
412  case 2:
413  {
414  std::vector<std::string> image_topics;
415  ros::master::V_TopicInfo master_topics;
416  ros::master::getTopics(master_topics);
417 
418  for (ros::master::V_TopicInfo::iterator it = master_topics.begin() ; it != master_topics.end(); it++) {
419  const ros::master::TopicInfo& info = *it;
420  if (info.datatype == "sensor_msgs/Image") {
421  image_topics.push_back(info.name);
422  }
423  }
424  std::sort(image_topics.begin(), image_topics.end());
425  for (unsigned int i = 0; i < image_topics.size(); i++) {
426  choice_image->Insert(wxString(image_topics.at(i).c_str(), wxConvUTF8),i + 1);
427  }
428  break;
429  }
430  case 3:
431  {
432  choice_image->AppendString(wxT("editable image"));
433  choice_image->SetSelection(0);
434  wxCommandEvent evt;
435  onChoiceImage(evt);
436  }
437  }
438 }
439 
440 void ViewCreatorDialog::onChoiceImage( wxCommandEvent& event )
441 {
443  desc_model_available = false;
444  label_model_available_value->SetLabel(wxT("No"));
445 
446  //case: edit image
447  if (choice_image_source->GetSelection() == 3) {
448  enableGuiElements(true);
449  check_fix_current_image->SetValue(true);
450  check_fix_current_image->Enable(false);
451  fixed_image_available = true;
452 
453 
455 
456  slider_upper_left_column->SetMax((int)fixedImage.Width() - 1);
458  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), params->getColumn1()));
459 
460  slider_upper_left_row->SetMax((int)fixedImage.Height() - 1);
461  slider_upper_left_row->SetValue(params->getRow1());
462  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), params->getRow1()));
463 
464  slider_lower_right_column->SetMax((int)fixedImage.Width() - 1);
466  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"),params->getColumn2()));
467 
468  slider_lower_right_row->SetMax((int)fixedImage.Height() - 1);
469  slider_lower_right_row->SetValue(params->getRow2());
470  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"),params->getRow2()));
471 
473 
474  edit_orientation_x->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getOrientation()[0])));
475  edit_orientation_y->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getOrientation()[1])));
476  edit_orientation_z->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getOrientation()[2])));
477 
479  edit_axis_1_x->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis1()[0])));
480  edit_axis_1_y->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis1()[1])));
481  edit_axis_1_z->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis1()[2])));
482  edit_axis_1_angle->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis1Angle())));
484  edit_axis_2_x->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis2()[0])));
485  edit_axis_2_y->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis2()[1])));
486  edit_axis_2_z->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis2()[2])));
487  edit_axis_2_angle->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getAxis2Angle())));
488  }
489  }
490 
491  edit_score_2D->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getScore2D())));
492  edit_vertical_offset->SetValue(wxString::Format(wxT("%i"), params->getVerticalOffset()));
493  edit_horizontal_offset->SetValue(wxString::Format(wxT("%i"), params->getHorizontalOffset()));
494 
495  edit_depth->SetValue(wxString::Format(wxT("%i"), params->getDepth()));
496  edit_fern_number->SetValue(wxString::Format(wxT("%i"), params->getNumberFerns()));
497  edit_patch_size->SetValue(wxString::Format(wxT("%i"), params->getPatchSize()));
498  edit_min_scale->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getMinScale())));
499  edit_max_scale->SetValue(trimDoubleString(wxString::Format(wxT("%f"), params->getMaxScale())));
500 
501  if (params->getIsInvertible()) {
502  check_invertable->SetValue(true);
503  }
504  if (params->getUseColor()) {
505  check_use_color->SetValue(true);
506  }
507 
508  //case: no editing
509  } else {
510  enableGuiElements(false);
511  check_fix_current_image->SetValue(false);
512  fixed_image_available = false;
513  if (choice_image->GetSelection() > 0) {
514  if (choice_image_source->GetSelection() == 2) {
515  check_fix_current_image->Enable(true);
516  std::string str = std::string(choice_image->GetStringSelection().mb_str());
517  image_model_sub = nh.subscribe<sensor_msgs::Image>(str, 1, &ViewCreatorDialog::onModelCameraImage, this);
518  } else if (choice_image_source->GetSelection() == 1) {
519  boost::filesystem::path input_path(ros::package::getPath("asr_descriptor_surface_based_recognition") + INPUT_FOLDER + "/");
520  wxString filename = wxString(input_path.string().c_str(), wxConvUTF8) + choice_image->GetStringSelection();
521  wxImage image(filename);
522  image = image.Scale(480, 360);
523  image_model->setImage(new wxBitmap(image));
525 
526  check_fix_current_image->SetValue(true);
527 
528  std::string filename_str = input_path.string() + std::string(choice_image->GetStringSelection().mb_str());
529  fixedImage = HalconCpp::HImage(filename_str.c_str());
530 
531  fixed_image_available = true;
532 
533  slider_upper_left_column->SetValue(0);
534  slider_upper_left_column->SetMax((int)fixedImage.Width() - 1);
535  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), 0));
536 
537  slider_upper_left_row->SetMax((int)fixedImage.Height() - 1);
538  slider_upper_left_row->SetValue(0);
539  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), 0));
540 
541  slider_lower_right_column->SetMax((int)fixedImage.Width() - 1);
542  slider_lower_right_column->SetValue((int)fixedImage.Width() - 1);
543  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"),(int)fixedImage.Width() - 1));
544 
545  slider_lower_right_row->SetMax((int)fixedImage.Height() - 1);
546  slider_lower_right_row->SetValue((int)fixedImage.Height() - 1);
547  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"),(int)fixedImage.Height() - 1));
548 
549  enableGuiElements(true);
550  }
551  } else {
552  check_fix_current_image->Enable(false);
553  wxBitmap* empty = new wxBitmap(wxImage(480, 360));
554  image_model->setImage(empty);
556  }
557  }
558 
559 }
560 
562 {
564  choice_test_image->Clear();
565  image_test->setImage(new wxBitmap(wxImage(480, 360)));
566  image_test->paintNow();
567  choice_test_image->Insert(wxString("<No selection>", wxConvUTF8), 0);
568  choice_test_image->SetSelection(0);
569 
570  switch (choice_test_image_source->GetSelection()) {
571  case 1:
572  {
573  std::vector<boost::filesystem::path> files;
574  boost::filesystem::path input_path(ros::package::getPath("asr_descriptor_surface_based_recognition") + INPUT_FOLDER + "/");
575  get_all_files_with_ext(input_path, ".png", files);
576  get_all_files_with_ext(input_path, ".jpg", files);
577  std::sort(files.begin(), files.end());
578  for (unsigned int i = 0; i < files.size(); i++) {
579  choice_test_image->AppendString(wxString(files[i].string().c_str(), wxConvUTF8));
580  }
581 
582  break;
583  }
584  case 2:
585  {
586  std::vector<std::string> image_topics;
587  ros::master::V_TopicInfo master_topics;
588  ros::master::getTopics(master_topics);
589 
590  for (ros::master::V_TopicInfo::iterator it = master_topics.begin() ; it != master_topics.end(); it++) {
591  const ros::master::TopicInfo& info = *it;
592  if (info.datatype == "sensor_msgs/Image") {
593  image_topics.push_back(info.name);
594  }
595  }
596  std::sort(image_topics.begin(), image_topics.end());
597  for (unsigned int i = 0; i < image_topics.size(); i++) {
598  choice_test_image->Insert(wxString(image_topics.at(i).c_str(), wxConvUTF8),i + 1);
599  }
600  break;
601  }
602  }
603 }
604 
605 void ViewCreatorDialog::onChoiceTestImage( wxCommandEvent& event )
606 {
608  if (choice_test_image->GetSelection() > 0) {
609  if (choice_test_image_source->GetSelection() == 1) {
610  boost::filesystem::path input_path(ros::package::getPath("asr_descriptor_surface_based_recognition") + INPUT_FOLDER + "/");
611  wxString filename = wxString(input_path.string().c_str(), wxConvUTF8) + choice_test_image->GetStringSelection();
612  wxImage image(filename);
613  image = image.Scale(480, 360);
614  image_test->setImage(new wxBitmap(image));
615  image_test->paintNow();
616  } else if (choice_test_image_source->GetSelection() == 2) {
617  std::string str = std::string(choice_test_image->GetStringSelection().mb_str());
618  image_test_sub = nh.subscribe<sensor_msgs::Image>(str, 1, boost::bind(&ViewCreatorDialog::onTestCameraImage, this, _1, false));
619  }
620  } else {
621  image_test->setImage(new wxBitmap(wxImage(480, 360)));
622  image_test->paintNow();
623  }
624 
625 }
626 
627 
628 
630 {
631  if (choice_test_image->GetSelection() > 0) {
632  if (check_fix_current_image->IsChecked() && fixed_image_available) {
633  if (desc_model_available) {
634  test_running = true;
635  label_model_available_value->SetLabel(wxT("Yes"));
636  label_score_value->SetLabel(wxT("0.0"));
637  score_sum = 0;
638  frame_counter = 0;
639  feature_sum = 0;
640  time_sum = 0;
641  label_frame_number_value->SetLabel(wxT("0"));
642  label_average_score_value->SetLabel(wxT("0.0"));
643  label_model_points_value->SetLabel(wxT("0"));
644  label_search_points_value->SetLabel(wxT("0"));
645  label_matched_points_value->SetLabel(wxT("0"));
646  label_average_matched_points_value->SetLabel(wxT("0"));
647  label_time_value->SetLabel(wxT("0.0"));
648  label_average_time_value->SetLabel(wxT("0.0"));
649  button_start_test->Enable(false);
650  button_end_test->Enable(true);
651  enableGuiElementsTest(false);
652 
653  } else {
654  wxMessageDialog *dial = new wxMessageDialog(this,
655  wxT("No descriptor model with current parameters available. Do you want to create one? This can take several minutes!"), wxT("Warning"),
656  wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
657  if (dial->ShowModal() == wxID_YES) {
658  int row1 = boost::lexical_cast<int>(trim(std::string(edit_upper_left_row->GetValue().mb_str())));
659  int column1 = boost::lexical_cast<int>(trim(std::string(edit_upper_left_column->GetValue().mb_str())));
660  int row2 = boost::lexical_cast<int>(trim(std::string(edit_lower_right_row->GetValue().mb_str())));
661  int column2 = boost::lexical_cast<int>(trim(std::string(edit_lower_right_column->GetValue().mb_str())));
662 
663 
664  int depth = boost::lexical_cast<int>(trim(std::string(edit_depth->GetValue().mb_str())));
665  int number_ferns = boost::lexical_cast<int>(trim(std::string(edit_fern_number->GetValue().mb_str())));
666  int patch_size = boost::lexical_cast<int>(trim(std::string(edit_patch_size->GetValue().mb_str())));
667  double min_scale = boost::lexical_cast<double>(trim(std::string(edit_min_scale->GetValue().mb_str())));
668  double max_scale = boost::lexical_cast<double>(trim(std::string(edit_max_scale->GetValue().mb_str())));
669  bool use_color = check_use_color->IsChecked();
670 
671  CreateTestModelDialog *createTestModeldialog = new CreateTestModelDialog(this, &desc_model, fixedImage.CropRectangle1(row1, column1, row2, column2), depth, number_ferns, patch_size, min_scale, max_scale, use_color);
672  if (createTestModeldialog ->ShowModal() == wxID_OK) {
673  desc_model_available = true;
674  test_running = true;
675  label_model_available_value->SetLabel(wxT("Yes"));
676  label_score_value->SetLabel(wxT("0.0"));
677  score_sum = 0;
678  feature_sum = 0;
679  time_sum = 0;
680  frame_counter = 0;
681  label_frame_number_value->SetLabel(wxT("0"));
682  label_average_score_value->SetLabel(wxT("0.0"));
683  label_model_points_value->SetLabel(wxT("0"));
684  label_search_points_value->SetLabel(wxT("0"));
685  label_matched_points_value->SetLabel(wxT("0"));
686  label_average_matched_points_value->SetLabel(wxT("0"));
687  button_start_test->Enable(false);
688  button_end_test->Enable(true);
689  enableGuiElementsTest(false);
690 
691  } else {
692  wxMessageDialog *dial = new wxMessageDialog(this,
693  wxT("Error creating model"), wxT("Error"), wxOK | wxICON_ERROR);
694  dial->ShowModal();
695  }
696  }
697  }
698  } else {
699  wxMessageDialog *dial = new wxMessageDialog(this,
700  wxT("No image selected!"), wxT("Warning"), wxOK | wxICON_WARNING);
701  dial->ShowModal();
702  }
703  } else {
704  wxMessageDialog *dial = new wxMessageDialog(this,
705  wxT("No test image topic selected!"), wxT("Warning"), wxOK | wxICON_WARNING);
706  dial->ShowModal();
707  }
708 }
709 
710 void ViewCreatorDialog::onButtonEndTestClicked(wxCommandEvent &event)
711 {
712  test_running = false;
713  button_start_test->Enable(true);
714  button_end_test->Enable(false);
715  enableGuiElementsTest(true);
716 }
717 
718 void ViewCreatorDialog::onButtonCancelClicked( wxCommandEvent& event )
719 {
720  wxMessageDialog *dial = new wxMessageDialog(this,
721  wxT("Are you sure you want to cancel?"), wxT("Cancel"),
722  wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
723  if (dial->ShowModal() == wxID_YES) {
724  update_timer->Stop();
727  EndModal(wxID_CANCEL);
728  Destroy();
729  }
730 
731 }
732 
733 void ViewCreatorDialog::onButtonSaveClicked( wxCommandEvent& event )
734 {
735  if (check_fix_current_image->IsChecked() && fixed_image_available) {
736 
737  std::string score_2D_string = trim(std::string(edit_score_2D->GetValue().mb_str()));
738  if (check_string_redex(score_2D_string, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
739 
740  std::string vertical_offset_string = trim(std::string(edit_vertical_offset->GetValue().mb_str()));
741  if (check_string_redex(vertical_offset_string, boost::regex("^[-+]?[0-9]+$"))) {
742 
743  std::string horizontal_offset_string = trim(std::string(edit_horizontal_offset->GetValue().mb_str()));
744  if (check_string_redex(horizontal_offset_string, boost::regex("^[-+]?[0-9]+$"))) {
745 
746  std::string depth_string = trim(std::string(edit_depth->GetValue().mb_str()));
747  if (check_string_redex(depth_string, boost::regex("^[0-9]+$"))) {
748 
749  std::string number_ferns_string = trim(std::string(edit_fern_number->GetValue().mb_str()));
750  if (check_string_redex(number_ferns_string, boost::regex("^[0-9]+$"))) {
751 
752  std::string patch_size_string = trim(std::string(edit_patch_size->GetValue().mb_str()));
753  if (check_string_redex(patch_size_string, boost::regex("^[0-9]+$"))) {
754 
755  std::string min_scale_string = trim(std::string(edit_min_scale->GetValue().mb_str()));
756  if (check_string_redex(min_scale_string, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
757 
758  std::string max_scale_string = trim(std::string(edit_max_scale->GetValue().mb_str()));
759  if (check_string_redex(max_scale_string, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
760 
761  std::string orientation_x_string = trim(std::string(edit_orientation_x->GetValue().mb_str()));
762  if (check_string_redex(orientation_x_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
763 
764  std::string orientation_y_string = trim(std::string(edit_orientation_y->GetValue().mb_str()));
765  if (check_string_redex(orientation_y_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
766 
767  std::string orientation_z_string = trim(std::string(edit_orientation_z->GetValue().mb_str()));
768  if (check_string_redex(orientation_z_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
769 
770  bool axes_valid = true;
772 
773  std::string axis_1_x_string = trim(std::string(edit_axis_1_x->GetValue().mb_str()));
774  if (check_string_redex(axis_1_x_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
775 
776  std::string axis_1_y_string = trim(std::string(edit_axis_1_y->GetValue().mb_str()));
777  if (check_string_redex(axis_1_y_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
778 
779  std::string axis_1_z_string = trim(std::string(edit_axis_1_z->GetValue().mb_str()));
780  if (check_string_redex(axis_1_z_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
781  axes_valid = true;
782 
783  double axis_1_x = boost::lexical_cast<double>(trim(std::string(edit_axis_1_x->GetValue().mb_str())));
784  double axis_1_y = boost::lexical_cast<double>(trim(std::string(edit_axis_1_y->GetValue().mb_str())));
785  double axis_1_z = boost::lexical_cast<double>(trim(std::string(edit_axis_1_z->GetValue().mb_str())));
786  double axis_1_angle = boost::lexical_cast<double>(trim(std::string(edit_axis_1_angle->GetValue().mb_str())));
787  Eigen::Vector3d axis_1(axis_1_x, axis_1_y, axis_1_z);
788  params->setAxis1(axis_1);
789  params->setAxis1Angle(axis_1_angle);
790 
792 
793  std::string axis_2_x_string = trim(std::string(edit_axis_2_x->GetValue().mb_str()));
794  if (check_string_redex(axis_2_x_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
795 
796  std::string axis_2_y_string = trim(std::string(edit_axis_2_y->GetValue().mb_str()));
797  if (check_string_redex(axis_2_y_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
798 
799  std::string axis_2_z_string = trim(std::string(edit_axis_2_z->GetValue().mb_str()));
800  if (check_string_redex(axis_2_z_string, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
801  axes_valid = true;
802 
803  double axis_2_x = boost::lexical_cast<double>(trim(std::string(edit_axis_2_x->GetValue().mb_str())));
804  double axis_2_y = boost::lexical_cast<double>(trim(std::string(edit_axis_2_y->GetValue().mb_str())));
805  double axis_2_z = boost::lexical_cast<double>(trim(std::string(edit_axis_2_z->GetValue().mb_str())));
806  double axis_2_angle = boost::lexical_cast<double>(trim(std::string(edit_axis_2_angle->GetValue().mb_str())));
807  Eigen::Vector3d axis_2(axis_2_x, axis_2_y, axis_2_z);
808  params->setAxis2(axis_2);
809  params->setAxis2Angle(axis_2_angle);
810 
811 
812  } else {
813  wxMessageDialog *dial = new wxMessageDialog(this,
814  wxT("Axis 2 (z) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
815  dial->ShowModal();
816  axes_valid = false;
817  }
818  } else {
819  wxMessageDialog *dial = new wxMessageDialog(this,
820  wxT("Axis 2 (y) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
821  dial->ShowModal();
822  axes_valid = false;
823  }
824  } else {
825  wxMessageDialog *dial = new wxMessageDialog(this,
826  wxT("Axis 2 (x) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
827  dial->ShowModal();
828  axes_valid = false;
829  }
830  }
831 
832 
833  } else {
834  wxMessageDialog *dial = new wxMessageDialog(this,
835  wxT("Axis 1 (z) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
836  dial->ShowModal();
837  axes_valid = false;
838  }
839  } else {
840  wxMessageDialog *dial = new wxMessageDialog(this,
841  wxT("Axis 1 (y) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
842  dial->ShowModal();
843  axes_valid = false;
844  }
845  } else {
846  wxMessageDialog *dial = new wxMessageDialog(this,
847  wxT("Axis 1 (x) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
848  dial->ShowModal();
849  axes_valid = false;
850  }
851  }
852  if (axes_valid) {
853  //all strings are valid!
854  int row1 = boost::lexical_cast<int>(trim(std::string(edit_upper_left_row->GetValue().mb_str())));
855  int column1 = boost::lexical_cast<int>(trim(std::string(edit_upper_left_column->GetValue().mb_str())));
856  int row2 = boost::lexical_cast<int>(trim(std::string(edit_lower_right_row->GetValue().mb_str())));
857  int column2 = boost::lexical_cast<int>(trim(std::string(edit_lower_right_column->GetValue().mb_str())));
858  params->setImage(fixedImage.CropRectangle1(row1, column1, row2, column2));
860  params->setImageBounds(row1, column1, row2, column2);
862  params->setUserColor(check_use_color->GetValue());
863  double orientation_x = boost::lexical_cast<double>(trim(std::string(edit_orientation_x->GetValue().mb_str())));
864  double orientation_y = boost::lexical_cast<double>(trim(std::string(edit_orientation_y->GetValue().mb_str())));
865  double orientation_z = boost::lexical_cast<double>(trim(std::string(edit_orientation_z->GetValue().mb_str())));
866  Eigen::Vector3d orientation(orientation_x, orientation_y, orientation_z);
867  params->setOrientation(orientation);
868  double score_2D = boost::lexical_cast<double>(trim(std::string(edit_score_2D->GetValue().mb_str())));
869  params->setScore2D(score_2D);
870  int vertical_offset = boost::lexical_cast<int>(trim(std::string(edit_vertical_offset->GetValue().mb_str())));
871  params->setVerticalOffset(vertical_offset);
872  int horizontal_offset = boost::lexical_cast<int>(trim(std::string(edit_horizontal_offset->GetValue().mb_str())));
873  params->setHorizontalOffset(horizontal_offset);
874  int depth = boost::lexical_cast<int>(trim(std::string(edit_depth->GetValue().mb_str())));
875  params->setDepth(depth);
876  int number_ferns = boost::lexical_cast<int>(trim(std::string(edit_fern_number->GetValue().mb_str())));
877  params->setNumberFerns(number_ferns);
878  int patch_size = boost::lexical_cast<int>(trim(std::string(edit_patch_size->GetValue().mb_str())));
879  params->setPatchSize(patch_size);
880  double min_scale = boost::lexical_cast<double>(trim(std::string(edit_min_scale->GetValue().mb_str())));
881  params->setMinScale(min_scale);
882  double max_scale = boost::lexical_cast<double>(trim(std::string(edit_max_scale->GetValue().mb_str())));
883  params->setMaxScale(max_scale);
884 
885 
886  params->setIsValid(true);
887 
888  update_timer->Stop();
891  EndModal(wxID_SAVE);
892  Destroy();
893 
894 
895 
896 
897  }
898  } else {
899  wxMessageDialog *dial = new wxMessageDialog(this,
900  wxT("Orientation (z) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
901  dial->ShowModal();
902  }
903  } else {
904  wxMessageDialog *dial = new wxMessageDialog(this,
905  wxT("Orientation (y) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
906  dial->ShowModal();
907  }
908  } else {
909  wxMessageDialog *dial = new wxMessageDialog(this,
910  wxT("Orientation (x) is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
911  dial->ShowModal();
912  }
913  } else {
914  wxMessageDialog *dial = new wxMessageDialog(this,
915  wxT("Max. scale is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
916  dial->ShowModal();
917  }
918  } else {
919  wxMessageDialog *dial = new wxMessageDialog(this,
920  wxT("Min. scale is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
921  dial->ShowModal();
922  }
923  } else {
924  wxMessageDialog *dial = new wxMessageDialog(this,
925  wxT("Patch size is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
926  dial->ShowModal();
927  }
928  } else {
929  wxMessageDialog *dial = new wxMessageDialog(this,
930  wxT("Fern number is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
931  dial->ShowModal();
932  }
933  } else {
934  wxMessageDialog *dial = new wxMessageDialog(this,
935  wxT("Depth is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
936  dial->ShowModal();
937  }
938  } else {
939  wxMessageDialog *dial = new wxMessageDialog(this,
940  wxT("Horizontal offset is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
941  dial->ShowModal();
942  }
943  } else {
944  wxMessageDialog *dial = new wxMessageDialog(this,
945  wxT("Vertical offset is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
946  dial->ShowModal();
947  }
948  } else {
949  wxMessageDialog *dial = new wxMessageDialog(this,
950  wxT("Score is not valid!"), wxT("Error"), wxOK | wxICON_ERROR);
951  dial->ShowModal();
952  }
953  } else {
954  wxMessageDialog *dial = new wxMessageDialog(this,
955  wxT("No image selected!"), wxT("Error"), wxOK | wxICON_ERROR);
956  dial->ShowModal();
957  }
958 }
959 
960 void ViewCreatorDialog::onCheckUseCurrentImage(wxCommandEvent &event)
961 {
962  desc_model_available = false;
963  label_model_available_value->SetLabel(wxT("No"));
964  if (check_fix_current_image->IsChecked()) {
965 
966  } else {
967 
968  fixed_image_available = false;
969  enableGuiElements(false);
970  }
971 }
972 
974 {
975 
976  std::string upperLeftRowString = trim(std::string(edit_upper_left_row->GetValue().mb_str()));
977  std::string lowerRightRowString = trim(std::string(edit_lower_right_row->GetValue().mb_str()));
978 
979  if (check_string_redex(upperLeftRowString, boost::regex("^[0-9]+$"))) {
980  if (check_string_redex(lowerRightRowString, boost::regex("^[0-9]+$"))) {
981  int upperLeftRow = boost::lexical_cast<int>(upperLeftRowString);
982  int lowerRightRow = boost::lexical_cast<int>(lowerRightRowString);
983  if ((upperLeftRow >= 0) && (upperLeftRow <= slider_lower_right_row->GetMax() - 2)) {
984  slider_upper_left_row->SetValue(upperLeftRow);
985  if (lowerRightRow <= upperLeftRow) {
986  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"), upperLeftRow + 1));
987  slider_lower_right_row->SetValue(upperLeftRow + 1);
988  }
989  } else {
990  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), 0));
991  slider_upper_left_row->SetValue(0);
992  }
993  }
994  } else {
995  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), 0));
996  slider_upper_left_row->SetValue(0);
997  }
998 
1000  desc_model_available = false;
1001  label_model_available_value->SetLabel(wxT("No"));
1002 }
1003 
1005 {
1006  std::string upperLeftColumnString = trim(std::string(edit_upper_left_column->GetValue().mb_str()));
1007  std::string lowerRightColumnString = trim(std::string(edit_lower_right_column->GetValue().mb_str()));
1008 
1009  if (check_string_redex(upperLeftColumnString, boost::regex("^[0-9]+$"))) {
1010  if (check_string_redex(lowerRightColumnString, boost::regex("^[0-9]+$"))) {
1011  int upperLeftColumn = boost::lexical_cast<int>(upperLeftColumnString);
1012  int lowerRightColumn = boost::lexical_cast<int>(lowerRightColumnString);
1013  if ((upperLeftColumn >= 0) && (upperLeftColumn <= slider_lower_right_column->GetMax() - 2)) {
1014  slider_upper_left_column->SetValue(upperLeftColumn);
1015  if (lowerRightColumn <= upperLeftColumn) {
1016  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"), upperLeftColumn + 1));
1017  slider_lower_right_column->SetValue(upperLeftColumn + 1);
1018  }
1019  } else {
1020  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), 0));
1021  slider_upper_left_column->SetValue(0);
1022  }
1023  }
1024  } else {
1025  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), 0));
1026  slider_upper_left_column->SetValue(0);
1027  }
1028 
1030  desc_model_available = false;
1031  label_model_available_value->SetLabel(wxT("No"));
1032 }
1033 
1034 
1035 
1037 {
1038  std::string lowerRightRowString = trim(std::string(edit_lower_right_row->GetValue().mb_str()));
1039  std::string upperLeftRowString = trim(std::string(edit_upper_left_row->GetValue().mb_str()));
1040 
1041  if (check_string_redex(lowerRightRowString, boost::regex("^[0-9]+$"))) {
1042  if (check_string_redex(upperLeftRowString, boost::regex("^[0-9]+$"))) {
1043  int lowerRightRow = boost::lexical_cast<int>(lowerRightRowString);
1044  int upperLeftRow = boost::lexical_cast<int>(upperLeftRowString);
1045  if ((lowerRightRow <= slider_lower_right_row->GetMax()) && (lowerRightRow >= 2)) {
1046  slider_lower_right_row->SetValue(lowerRightRow);
1047  if (upperLeftRow >= lowerRightRow) {
1048  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), lowerRightRow - 1));
1049  slider_upper_left_row->SetValue(lowerRightRow - 1);
1050  }
1051  } else {
1052  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"), slider_lower_right_row->GetMax()));
1053  slider_lower_right_row->SetValue(slider_lower_right_row->GetMax());
1054  }
1055  }
1056  } else {
1057  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"), slider_lower_right_row->GetMax()));
1058  slider_lower_right_row->SetValue(slider_lower_right_row->GetMax());
1059  }
1060 
1062  desc_model_available = false;
1063  label_model_available_value->SetLabel(wxT("No"));
1064 }
1065 
1066 
1068 {
1069  std::string lowerRightColumnString = trim(std::string(edit_lower_right_column->GetValue().mb_str()));
1070  std::string upperLeftColumnString = trim(std::string(edit_upper_left_column->GetValue().mb_str()));
1071 
1072  if (check_string_redex(lowerRightColumnString, boost::regex("^[0-9]+$"))) {
1073  if (check_string_redex(upperLeftColumnString, boost::regex("^[0-9]+$"))) {
1074  int lowerRightColumn = boost::lexical_cast<int>(lowerRightColumnString);
1075  int upperLeftColumn = boost::lexical_cast<int>(upperLeftColumnString);
1076  if ((lowerRightColumn <= slider_lower_right_column->GetMax()) && (lowerRightColumn >= 2)) {
1077  slider_lower_right_column->SetValue(lowerRightColumn);
1078  if (upperLeftColumn >= lowerRightColumn) {
1079  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), lowerRightColumn - 1));
1080  slider_upper_left_column->SetValue(lowerRightColumn - 1);
1081  }
1082  } else {
1083  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"), slider_lower_right_column->GetMax()));
1085  }
1086  }
1087  } else {
1088  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"), slider_lower_right_column->GetMax()));
1090  }
1091 
1093  desc_model_available = false;
1094  label_model_available_value->SetLabel(wxT("No"));
1095 }
1096 
1097 void ViewCreatorDialog::onSlideUpperLeftRow(wxScrollEvent &event)
1098 {
1099  int upperLeftRowValue = slider_upper_left_row->GetValue();
1100  if (upperLeftRowValue <= slider_upper_left_row->GetMax() - 2) {
1101  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), upperLeftRowValue));
1102  slider_upper_left_row->SetValue(upperLeftRowValue);
1103  } else {
1104  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), slider_upper_left_row->GetMax() - 2));
1105  slider_upper_left_row->SetValue(slider_upper_left_row->GetMax() - 2);
1106  }
1107 
1108  upperLeftRowValue = boost::lexical_cast<int>(trim(std::string(edit_upper_left_row->GetValue().mb_str())));
1109  if (slider_lower_right_row->GetValue() <= upperLeftRowValue) {
1110  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"), upperLeftRowValue + 1));
1111  slider_lower_right_row->SetValue(upperLeftRowValue + 1);
1112  }
1113 
1115  desc_model_available = false;
1116  label_model_available_value->SetLabel(wxT("No"));
1117 }
1118 
1120 {
1121  int upperLeftColumnValue = slider_upper_left_column->GetValue();
1122  if (upperLeftColumnValue <= slider_upper_left_column->GetMax() - 2) {
1123  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), upperLeftColumnValue));
1124  slider_upper_left_column->SetValue(upperLeftColumnValue);
1125  } else {
1126  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), slider_upper_left_column->GetMax() - 2));
1127  slider_upper_left_column->SetValue(slider_upper_left_column->GetMax() - 2);
1128  }
1129 
1130  upperLeftColumnValue = boost::lexical_cast<int>(trim(std::string(edit_upper_left_column->GetValue().mb_str())));
1131  if (slider_lower_right_column->GetValue() <= upperLeftColumnValue) {
1132  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"), upperLeftColumnValue + 1));
1133  slider_lower_right_column->SetValue(upperLeftColumnValue + 1);
1134  }
1135 
1137  desc_model_available = false;
1138  label_model_available_value->SetLabel(wxT("No"));
1139 }
1140 
1142 {
1143  int lowerRightRowValue = slider_lower_right_row->GetValue();
1144  if (lowerRightRowValue >= 2) {
1145  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"), lowerRightRowValue));
1146  slider_lower_right_row->SetValue(lowerRightRowValue);
1147  } else {
1148  edit_lower_right_row->SetValue(wxString::Format(wxT("%i"), 2));
1149  slider_lower_right_row->SetValue(2);
1150  }
1151 
1152  lowerRightRowValue = boost::lexical_cast<int>(trim(std::string(edit_lower_right_row->GetValue().mb_str())));
1153  if (slider_upper_left_row->GetValue() >= lowerRightRowValue) {
1154  edit_upper_left_row->SetValue(wxString::Format(wxT("%i"), lowerRightRowValue - 1));
1155  slider_upper_left_row->SetValue(lowerRightRowValue - 1);
1156  }
1157 
1159  desc_model_available = false;
1160  label_model_available_value->SetLabel(wxT("No"));
1161 }
1162 
1164 {
1165  int lowerRightColumnValue = slider_lower_right_column->GetValue();
1166  if (lowerRightColumnValue >= 2) {
1167  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"), lowerRightColumnValue));
1168  slider_lower_right_column->SetValue(lowerRightColumnValue);
1169  } else {
1170  edit_lower_right_column->SetValue(wxString::Format(wxT("%i"), 2));
1171  slider_lower_right_column->SetValue(2);
1172  }
1173 
1174  lowerRightColumnValue = boost::lexical_cast<int>(trim(std::string(edit_lower_right_column->GetValue().mb_str())));
1175  if (slider_upper_left_column->GetValue() >= lowerRightColumnValue) {
1176  edit_upper_left_column->SetValue(wxString::Format(wxT("%i"), lowerRightColumnValue - 1));
1177  slider_upper_left_column->SetValue(lowerRightColumnValue - 1);
1178  }
1179 
1181  desc_model_available = false;
1182  label_model_available_value->SetLabel(wxT("No"));
1183 }
1184 
1186  wxFocusEvent evt;
1188 }
1189 
1191  wxFocusEvent evt;
1193 }
1194 
1196  wxFocusEvent evt;
1198 }
1199 
1201  wxFocusEvent evt;
1203 }
1204 
1206 {
1207  std::string orientation_x = trim(std::string(edit_orientation_x->GetValue().mb_str()));
1208  if (!check_string_redex(orientation_x, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1209  edit_orientation_x->SetValue(wxT("1.0"));
1210  }
1211 }
1212 
1214 {
1215  std::string orientation_y = trim(std::string(edit_orientation_y->GetValue().mb_str()));
1216  if (!check_string_redex(orientation_y, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1217  edit_orientation_y->SetValue(wxT("0.0"));
1218  }
1219 }
1220 
1222 {
1223  std::string orientation_z = trim(std::string(edit_orientation_z->GetValue().mb_str()));
1224  if (!check_string_redex(orientation_z, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1225  edit_orientation_z->SetValue(wxT("0.0"));
1226  }
1227 }
1228 
1229 void ViewCreatorDialog::onEditTextScore(wxFocusEvent &event)
1230 {
1231  std::string score = trim(std::string(edit_score_2D->GetValue().mb_str()));
1232  if (!check_string_redex(score, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
1233  edit_score_2D->SetValue(wxT("0.2"));
1234  }
1235 }
1236 
1238 {
1239  std::string vertical_offset = trim(std::string(edit_vertical_offset->GetValue().mb_str()));
1240  if (!check_string_redex(vertical_offset, boost::regex("^[-+]?[0-9]+$$"))) {
1241  edit_vertical_offset->SetValue(wxT("0"));
1242  }
1243 }
1244 
1246 {
1247  std::string horizontal_offset = trim(std::string(edit_horizontal_offset->GetValue().mb_str()));
1248  if (!check_string_redex(horizontal_offset, boost::regex("^[-+]?[0-9]+$"))) {
1249  edit_horizontal_offset->SetValue(wxT("0"));
1250  }
1251 }
1252 
1253 void ViewCreatorDialog::onEditTextDepth(wxFocusEvent &event)
1254 {
1255  std::string depth_string = trim(std::string(edit_depth->GetValue().mb_str()));
1256  if (check_string_redex(depth_string, boost::regex("^[0-9]+$"))) {
1257  int depth = boost::lexical_cast<int>(trim(std::string(edit_depth->GetValue().mb_str())));
1258  if ((depth <= 0) || (depth > 15)) {
1259  edit_depth->SetValue(wxT("8"));
1260  }
1261  } else {
1262  edit_depth->SetValue(wxT("8"));
1263  }
1264 
1265  if (desc_model_available) {
1266  HalconCpp::HTuple detName, detValue, descName, descParam;
1267  desc_model.GetDescriptorModelParams(&detName, &detValue, &descName, &descParam);
1268  int curr_depth = boost::lexical_cast<int>(trim(std::string(edit_depth->GetValue().mb_str())));
1269  if (curr_depth != (int)descParam[0]) {
1270  desc_model_available = false;
1271  label_model_available_value->SetLabel(wxT("No"));
1272  }
1273  }
1274 }
1275 
1277 {
1278  std::string fern_number_string = trim(std::string(edit_fern_number->GetValue().mb_str()));
1279  if (check_string_redex(fern_number_string, boost::regex("^[0-9]+$"))) {
1280  int fern_number = boost::lexical_cast<int>(trim(std::string(edit_fern_number->GetValue().mb_str())));
1281  if ((fern_number <= 0) || (fern_number > 500)) {
1282  edit_fern_number->SetValue(wxT("50"));
1283  }
1284  } else {
1285  edit_fern_number->SetValue(wxT("50"));
1286  }
1287 
1288  if (desc_model_available) {
1289  HalconCpp::HTuple detName, detValue, descName, descParam;
1290  desc_model.GetDescriptorModelParams(&detName, &detValue, &descName, &descParam);
1291  int curr_ferns = boost::lexical_cast<int>(trim(std::string(edit_fern_number->GetValue().mb_str())));
1292  if (curr_ferns != (int)descParam[1]) {
1293  desc_model_available = false;
1294  label_model_available_value->SetLabel(wxT("No"));
1295  }
1296  }
1297 }
1298 
1300 {
1301  std::string patch_size_string = trim(std::string(edit_patch_size->GetValue().mb_str()));
1302  if (check_string_redex(patch_size_string, boost::regex("^[0-9]+$"))) {
1303  int patch_size = boost::lexical_cast<int>(trim(std::string(edit_patch_size->GetValue().mb_str())));
1304  if ((patch_size <= 10) || (patch_size > 40) || (patch_size % 2 == 0)) {
1305  edit_patch_size->SetValue(wxT("17"));
1306  }
1307  } else {
1308  edit_patch_size->SetValue(wxT("17"));
1309  }
1310 
1311  if (desc_model_available) {
1312  HalconCpp::HTuple detName, detValue, descName, descParam;
1313  desc_model.GetDescriptorModelParams(&detName, &detValue, &descName, &descParam);
1314  int curr_patches = boost::lexical_cast<int>(trim(std::string(edit_patch_size->GetValue().mb_str())));
1315  if (curr_patches != (int)descParam[2]) {
1316  desc_model_available = false;
1317  label_model_available_value->SetLabel(wxT("No"));
1318  }
1319  }
1320 }
1321 
1322 void ViewCreatorDialog::onEditTextMinScale(wxFocusEvent &event)
1323 {
1324  std::string min_scale_string = trim(std::string(edit_min_scale->GetValue().mb_str()));
1325  if (check_string_redex(min_scale_string, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
1326  double min_scale = boost::lexical_cast<double>(trim(std::string(edit_min_scale->GetValue().mb_str())));
1327  if ((min_scale < 0.2) || (min_scale > 1.2)) {
1328  edit_min_scale->SetValue(wxT("0.6"));
1329  }
1330  } else {
1331  edit_min_scale->SetValue(wxT("0.6"));
1332  }
1333 
1334  if (desc_model_available) {
1335  HalconCpp::HTuple detName, detValue, descName, descParam;
1336  desc_model.GetDescriptorModelParams(&detName, &detValue, &descName, &descParam);
1337  double curr_min_scale = boost::lexical_cast<double>(trim(std::string(edit_min_scale->GetValue().mb_str())));
1338  if (curr_min_scale != (double)descParam[8]) {
1339  desc_model_available = false;
1340  label_model_available_value->SetLabel(wxT("No"));
1341  }
1342  }
1343 }
1344 
1345 void ViewCreatorDialog::onEditTextMaxScale(wxFocusEvent &event)
1346 {
1347  std::string max_scale_string = trim(std::string(edit_max_scale->GetValue().mb_str()));
1348  if (check_string_redex(max_scale_string, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
1349  double max_scale = boost::lexical_cast<double>(trim(std::string(edit_max_scale->GetValue().mb_str())));
1350  if ((max_scale < 0.8) || (max_scale > 1.8)) {
1351  edit_max_scale->SetValue(wxT("1.1"));
1352  }
1353  } else {
1354  edit_max_scale->SetValue(wxT("1.1"));
1355  }
1356 
1357  if (desc_model_available) {
1358  HalconCpp::HTuple detName, detValue, descName, descParam;
1359  desc_model.GetDescriptorModelParams(&detName, &detValue, &descName, &descParam);
1360  double curr_max_scale = boost::lexical_cast<double>(trim(std::string(edit_max_scale->GetValue().mb_str())));
1361  if (curr_max_scale != (double)descParam[9]) {
1362  desc_model_available = false;
1363  label_model_available_value->SetLabel(wxT("No"));
1364  }
1365  }
1366 }
1367 
1368 void ViewCreatorDialog::onCheckUpsideDown(wxCommandEvent &event)
1369 {
1370  //Do nothing
1371 }
1372 
1373 void ViewCreatorDialog::onCheckUseColor(wxCommandEvent &event)
1374 {
1375  desc_model_available = false;
1376  label_model_available_value->SetLabel(wxT("No"));
1377 }
1378 
1379 void ViewCreatorDialog::onEditTextAxis1X(wxFocusEvent &event)
1380 {
1381  std::string axis_1_x = trim(std::string(edit_axis_1_x->GetValue().mb_str()));
1382  if (!check_string_redex(axis_1_x, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1383  edit_axis_1_x->SetValue(wxT("0.0"));
1384  }
1385 }
1386 
1387 void ViewCreatorDialog::onEditTextAxis1Y(wxFocusEvent &event)
1388 {
1389  std::string axis_1_y = trim(std::string(edit_axis_1_y->GetValue().mb_str()));
1390  if (!check_string_redex(axis_1_y, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1391  edit_axis_1_y->SetValue(wxT("1.0"));
1392  }
1393 }
1394 
1395 void ViewCreatorDialog::onEditTextAxis1Z(wxFocusEvent &event)
1396 {
1397  std::string axis_1_z = trim(std::string(edit_axis_1_z->GetValue().mb_str()));
1398  if (!check_string_redex(axis_1_z, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1399  edit_axis_1_z->SetValue(wxT("0.0"));
1400  }
1401 }
1402 
1404 {
1405  std::string axis_1_angle = trim(std::string(edit_axis_1_angle->GetValue().mb_str()));
1406  if (check_string_redex(axis_1_angle, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
1407  double angle = boost::lexical_cast<double>(trim(std::string(edit_axis_1_angle->GetValue().mb_str())));
1408  if ((angle <= 0) || (angle >= 360)) {
1409  edit_axis_1_angle->SetValue(wxT("1.0"));
1410  }
1411  } else {
1412  edit_axis_1_angle->SetValue(wxT("1.0"));
1413  }
1414 }
1415 
1416 void ViewCreatorDialog::onEditTextAxis2X(wxFocusEvent &event)
1417 {
1418  std::string axis_2_x = trim(std::string(edit_axis_2_x->GetValue().mb_str()));
1419  if (!check_string_redex(axis_2_x, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1420  edit_axis_2_x->SetValue(wxT("0.0"));
1421  }
1422 }
1423 
1424 void ViewCreatorDialog::onEditTextAxis2Y(wxFocusEvent &event)
1425 {
1426  std::string axis_2_y = trim(std::string(edit_axis_2_y->GetValue().mb_str()));
1427  if (!check_string_redex(axis_2_y, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1428  edit_axis_2_y->SetValue(wxT("0.0"));
1429  }
1430 }
1431 
1432 void ViewCreatorDialog::onEditTextAxis2Z(wxFocusEvent &event)
1433 {
1434  std::string axis_2_z = trim(std::string(edit_axis_2_z->GetValue().mb_str()));
1435  if (!check_string_redex(axis_2_z, boost::regex("^[-+]?[0-9]+(\\.[0-9]+)?$"))) {
1436  edit_axis_2_z->SetValue(wxT("-1.0"));
1437  }
1438 }
1439 
1441 {
1442  std::string axis_2_angle = trim(std::string(edit_axis_2_angle->GetValue().mb_str()));
1443  if (check_string_redex(axis_2_angle, boost::regex("^[0-9]+(\\.[0-9]+)?$"))) {
1444  double angle = boost::lexical_cast<double>(trim(std::string(edit_axis_2_angle->GetValue().mb_str())));
1445  if ((angle <= 0) || (angle >= 360)) {
1446  edit_axis_2_angle->SetValue(wxT("1.0"));
1447  }
1448  } else {
1449  edit_axis_2_angle->SetValue(wxT("1.0"));
1450  }
1451 }
1452 
1453 
1454 
1456 {
1457  wxFocusEvent evt;
1459 }
1460 
1462 {
1463  wxFocusEvent evt;
1465 }
1466 
1468 {
1469  wxFocusEvent evt;
1471 }
1472 
1473 void ViewCreatorDialog::onEditTextScoreEnter(wxCommandEvent &event)
1474 {
1475  wxFocusEvent evt;
1476  onEditTextScore(evt);
1477 }
1478 
1480 {
1481  wxFocusEvent evt;
1483 }
1484 
1486 {
1487  wxFocusEvent evt;
1489 }
1490 
1491 void ViewCreatorDialog::onEditTextDepthEnter(wxCommandEvent &event)
1492 {
1493  wxFocusEvent evt;
1494  onEditTextDepth(evt);
1495 }
1496 
1498 {
1499  wxFocusEvent evt;
1500  onEditTextFernNumber(evt);
1501 }
1502 
1504 {
1505  wxFocusEvent evt;
1506  onEditTextPatchSize(evt);
1507 }
1508 
1510 {
1511  wxFocusEvent evt;
1512  onEditTextMinScale(evt);
1513 }
1514 
1516 {
1517  wxFocusEvent evt;
1518  onEditTextMaxScale(evt);
1519 }
1520 
1521 void ViewCreatorDialog::onEditTextAxis1XEnter(wxCommandEvent &event)
1522 {
1523  wxFocusEvent evt;
1524  onEditTextAxis1X(evt);
1525 }
1526 
1527 void ViewCreatorDialog::onEditTextAxis1YEnter(wxCommandEvent &event)
1528 {
1529  wxFocusEvent evt;
1530  onEditTextAxis1Y(evt);
1531 }
1532 
1533 void ViewCreatorDialog::onEditTextAxis1ZEnter(wxCommandEvent &event)
1534 {
1535  wxFocusEvent evt;
1536  onEditTextAxis1Z(evt);
1537 }
1538 
1540 {
1541  wxFocusEvent evt;
1542  onEditTextAxis1Angle(evt);
1543 }
1544 
1545 void ViewCreatorDialog::onEditTextAxis2XEnter(wxCommandEvent &event)
1546 {
1547  wxFocusEvent evt;
1548  onEditTextAxis2X(evt);
1549 }
1550 
1551 void ViewCreatorDialog::onEditTextAxis2YEnter(wxCommandEvent &event)
1552 {
1553  wxFocusEvent evt;
1554  onEditTextAxis2Y(evt);
1555 }
1556 
1557 void ViewCreatorDialog::onEditTextAxis2ZEnter(wxCommandEvent &event)
1558 {
1559  wxFocusEvent evt;
1560  onEditTextAxis2Z(evt);
1561 }
1562 
1564 {
1565  wxFocusEvent evt;
1566  onEditTextAxis2Angle(evt);
1567 }
void onEditTextOrientationZ(wxFocusEvent &event)
void onEditTextMaxScaleEnter(wxCommandEvent &event)
#define NULL
Eigen::Vector3d getOrientation()
void onModelCameraImage(const sensor_msgs::Image::ConstPtr &msg)
The callback function for the image-topic-subscriber.
void setScore2D(double score_2D)
filename
void enableGuiElementsTest(bool enable=true)
Enables/Disables all Gui-elements which are not used during testing.
void onEditTextAxis2AngleEnter(wxCommandEvent &event)
void onEditTextAxis1ZEnter(wxCommandEvent &event)
void onEditTextScoreEnter(wxCommandEvent &event)
void onEditTextAxis2YEnter(wxCommandEvent &event)
void onEditTextOrientationXEnter(wxCommandEvent &event)
void onEditTextOrientationYEnter(wxCommandEvent &event)
void onEditTextAxis1Angle(wxFocusEvent &event)
void onCheckUseColor(wxCommandEvent &event)
void onEditTextPatchSizeEnter(wxCommandEvent &event)
wxStaticText * label_matched_points_value
wxStaticText * label_search_points_value
void onEditTextLowerRightRowEnter(wxCommandEvent &event)
void onButtonStartTestClicked(wxCommandEvent &event)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
wxString trimDoubleString(wxString input)
Formats the given string by removing fractional zeros at the end of it.
Definition: Utils.cpp:86
ros::NodeHandle nh
void onEditTextUpperLeftRow(wxFocusEvent &event)
Eigen::Vector3d getAxis2()
void onEditTextVerticalOffset(wxFocusEvent &event)
void onSlideUpperLeftRow(wxScrollEvent &event)
wxStaticText * label_average_matched_points_value
void onChoiceImage(wxCommandEvent &event)
void setImage(HalconCpp::HImage image)
HalconCpp::HImage getOriginalImage()
void onEditTextDepth(wxFocusEvent &event)
ROSCPP_DECL bool getTopics(V_TopicInfo &topics)
wxStaticText * label_average_score_value
void onEditTextAxis2ZEnter(wxCommandEvent &event)
void setPatchSize(int patch_size)
void setAxis2Angle(double axis2_angle)
void onChoiceTestImage(wxCommandEvent &event)
void setAxis2(Eigen::Vector3d axis2)
void onEditTextScore(wxFocusEvent &event)
void setOriginalImage(HalconCpp::HImage original_image)
std::vector< TopicInfo > V_TopicInfo
void onCheckUseCurrentImage(wxCommandEvent &event)
void setMinScale(double min_scale)
void onEditTextAxis2Z(wxFocusEvent &event)
void onEditTextHorizontalOffsetEnter(wxCommandEvent &event)
void onEditTextAxis1Y(wxFocusEvent &event)
HalconCpp::HDescriptorModel desc_model
Eigen::Vector3d getAxis1()
std::string trim(std::string input)
Removes spaces from the beginning and end of the given string.
Definition: Utils.cpp:34
void onUpdate(wxTimerEvent &evt)
The callback function for the update-timer.
HalconCpp::HImage fixedImage
void onEditTextUpperLeftColumnEnter(wxCommandEvent &event)
boost::thread paint_thread
void setOrientation(Eigen::Vector3d orientation)
void setHorizontalOffset(int horizontal_offset)
void onEditTextHorizontalOffset(wxFocusEvent &event)
const std::string ROTATIONTYPE_CYLINDER
Definition: Utils.h:40
void onChoiceImageSource(wxCommandEvent &event)
void onTestCameraImage(const sensor_msgs::Image::ConstPtr &msg, bool use_file)
The callback function for the test-image-topic-subscriber.
void onEditTextLowerRightColumn(wxFocusEvent &event)
void OnDialogClose(wxCloseEvent &event)
const std::string ROTATIONTYPE_SPHERE
Definition: Utils.h:43
void onEditTextAxis1AngleEnter(wxCommandEvent &event)
void setNumberFerns(int number_ferns)
ViewParamsWrapper * params
void onEditTextPatchSize(wxFocusEvent &event)
void onEditTextAxis2Y(wxFocusEvent &event)
ROSCPP_DECL bool ok()
void onEditTextOrientationX(wxFocusEvent &event)
void setMaxScale(double max_scale)
const std::string ROTATIONTYPE_NO_ROTATION
Definition: Utils.h:37
void enableGuiElements(bool enable=true)
Enables/Disables the Gui-elements used for setting the parameters.
void onCheckUpsideDown(wxCommandEvent &event)
void setUserColor(bool use_color)
ros::Subscriber image_model_sub
void onEditTextAxis1YEnter(wxCommandEvent &event)
void onEditTextMaxScale(wxFocusEvent &event)
void onEditTextLowerRightColumnEnter(wxCommandEvent &event)
void onEditTextFernNumber(wxFocusEvent &event)
void onButtonEndTestClicked(wxCommandEvent &event)
void onEditTextAxis1X(wxFocusEvent &event)
void setAxis1(Eigen::Vector3d axis1)
bool check_string_redex(std::string to_check, boost::regex regex)
Checks a string with the given regex.
Definition: Utils.cpp:27
ROSLIB_DECL std::string getPath(const std::string &package_name)
void onButtonSaveClicked(wxCommandEvent &event)
void onEditTextAxis1Z(wxFocusEvent &event)
void onEditTextMinScaleEnter(wxCommandEvent &event)
void get_all_files_with_ext(const boost::filesystem::path &root, const std::string &ext, std::vector< boost::filesystem::path > &ret)
Gets all files in a directory with a specific extension.
Definition: Utils.cpp:103
ros::Subscriber image_test_sub
void onEditTextDepthEnter(wxCommandEvent &event)
std::string getRotationType()
void onEditTextAxis2XEnter(wxCommandEvent &event)
void setImage(wxBitmap *image)
wxBitmap * createBitmap(const sensor_msgs::Image::ConstPtr &msg, int width, int height)
Converts a ros-image-message to a bitmap-file used by wxwidgets.
Definition: Utils.cpp:40
void onEditTextOrientationZEnter(wxCommandEvent &event)
void setIsValid(bool is_valid)
void onEditTextUpperLeftColumn(wxFocusEvent &event)
void setDepth(int depth)
void onEditTextUpperLeftRowEnter(wxCommandEvent &event)
void onEditTextVerticalOffsetEnter(wxCommandEvent &event)
static Time now()
void onEditTextFernNumberEnter(wxCommandEvent &event)
void paint_test_image(HalconCpp::HImage img)
Shows the given image on the right image panel.
void updateImageOnCrop()
Updates the shown image (left panel) after it was cropped with the sliders.
void onEditTextOrientationY(wxFocusEvent &event)
void onEditTextAxis2X(wxFocusEvent &event)
void onButtonCancelClicked(wxCommandEvent &event)
ViewCreatorDialog(wxWindow *parent, ViewParamsWrapper *params)
The constructor of this class.
void onSlideLowerRightColumn(wxScrollEvent &event)
void onChoiceTestImageSource(wxCommandEvent &event)
void onSlideUpperLeftColumn(wxScrollEvent &event)
void onEditTextMinScale(wxFocusEvent &event)
ROSCPP_DECL void spinOnce()
void setAxis1Angle(double axis1_angle)
const std::string INPUT_FOLDER
Definition: Utils.h:46
void onEditTextAxis1XEnter(wxCommandEvent &event)
wxStaticText * label_model_available_value
void onSlideLowerRightRow(wxScrollEvent &event)
void setVerticalOffset(int vertical_offset)
wxStaticText * label_frame_number_value
void onEditTextLowerRightRow(wxFocusEvent &event)
void setImageBounds(int row1, int column1, int row2, int column2)
void onEditTextAxis2Angle(wxFocusEvent &event)
void setIsInvertible(bool is_invertible)


asr_descriptor_surface_based_recognition
Author(s): Allgeyer Tobias, Hutmacher Robin, Meißner Pascal
autogenerated on Mon Dec 16 2019 03:31:15