void BaseFrame::keyPressEvent(QKeyEvent * event) { switch (event->key()) { case Qt::Key_Return: case Qt::Key_Enter: case Qt::Key_Backspace: qDebug() << "Enter"; if(!base_frame_graphics_view->get_bb()->rect().isEmpty()) { tld_msgs::Target msg; msg.bb.x = (int)base_frame_graphics_view->get_bb()->rect().x(); msg.bb.y = (int)base_frame_graphics_view->get_bb()->rect().y(); msg.bb.width = (int)base_frame_graphics_view->get_bb()->rect().width(); msg.bb.height = (int)base_frame_graphics_view->get_bb()->rect().height(); msg.bb.confidence = 1.0; cv_ptr->toImageMsg(msg.img); pub1.publish(msg); } break; case Qt::Key_Q: qDebug() << "Quitting"; close(); break; case Qt::Key_B: clear_background(); break; case Qt::Key_C: clear_and_stop_tracking(); break; case Qt::Key_L: toggle_learning(); break; case Qt::Key_A: alternating_mode(); break; case Qt::Key_E: export_model(); break; case Qt::Key_I: import_model(); break; case Qt::Key_R: reset(); break; case Qt::Key_F5: first_image = true; default: event->ignore(); break; } }
int main (int argc, char*argv[]) { am_model_t*model = NULL; if (argc <= 1){ printf ("Please specify a file.\n"); return 0; } model = load_model (argv[1]); export_model (model, argv[2]); return 0; }
BaseFrame::BaseFrame() { setupUi(this); QObject::connect(this,SIGNAL(sig_image_received(const QImage &)),base_frame_graphics_view,SLOT(image_received(const QImage &))); QObject::connect(this,SIGNAL(sig_tracked_object_changed(const QRectF &)),base_frame_graphics_view,SLOT(tracked_objet_changed(const QRectF &))); QObject::connect(this,SIGNAL(sig_fps_tracker_changed(int)),lcd_fps_tracker,SLOT(display(int))); QObject::connect(this,SIGNAL(sig_confidence_changed(int)),confidence_bar,SLOT(setValue(int))); QObject::connect(background_reset_button,SIGNAL(clicked()),this,SLOT(clear_background())); QObject::connect(learning_button,SIGNAL(clicked()),this,SLOT(toggle_learning())); QObject::connect(alternating_button,SIGNAL(clicked()),this,SLOT(alternating_mode())); QObject::connect(stop_tracking_button,SIGNAL(clicked()),this,SLOT(clear_and_stop_tracking())); QObject::connect(importing_button,SIGNAL(clicked()),this,SLOT(import_model())); QObject::connect(exporting_button,SIGNAL(clicked()),this,SLOT(export_model())); QObject::connect(reset_button,SIGNAL(clicked()),this,SLOT(reset())); sub1 = n.subscribe("image", 1000, &BaseFrame::image_receivedCB, this); sub2 = n.subscribe("tracked_object", 1000, &BaseFrame::tracked_objectCB, this); sub3 = n.subscribe("fps_tracker", 1000, &BaseFrame::fps_trackerCB, this); pub1 = n.advertise<tld_msgs::Target>("tld_gui_bb", 1000, true); pub2 = n.advertise<std_msgs::Char>("tld_gui_cmds", 1000, true); first_image = true; }