コード例 #1
0
ファイル: base_frame.cpp プロジェクト: Aerobota/ros_opentld
void BaseFrame::tracked_objectCB(const tld_msgs::BoundingBoxConstPtr & msg)
{
    if(msg->width && msg->height)
        first_image = true;
    else
        first_image = false;

	QRectF rect(msg->x,msg->y,msg->width,msg->height);
	emit sig_tracked_object_changed(rect);
	emit sig_confidence_changed((int)(msg->confidence*100));
}
コード例 #2
0
ファイル: base_frame.cpp プロジェクト: Ardillo/ros_opentld
void BaseFrame::tracked_object_callback(const tld_msgs::BoundingBoxConstPtr & msg)
{
	//The tld node sent a bounding box
	if(msg->width && msg->height && !baseFrameGraphicsView->get_correct_bb())
	{
		baseFrameGraphicsView->set_correct_bb(true);
		first_image = false;
	}
	//The tld node sent a bad bouding box
	else if((!msg->width || !msg->height) && baseFrameGraphicsView->get_correct_bb())
	{
		baseFrameGraphicsView->set_correct_bb(false);
		first_image = true;   
	}

	QRectF rect(msg->x,msg->y,msg->width,msg->height);
	emit sig_tracked_object_changed(rect);
	emit sig_confidence_changed((int)(msg->confidence*100));
}
コード例 #3
0
ファイル: base_frame.cpp プロジェクト: Ardillo/ros_opentld
BaseFrame::BaseFrame()
{   
	setupUi(this);

	QObject::connect(this,SIGNAL(sig_image_received(const QImage &)),baseFrameGraphicsView,SLOT(image_received(const QImage &)));    
	QObject::connect(this,SIGNAL(sig_tracked_object_changed(QRectF)),baseFrameGraphicsView,SLOT(tracked_objet_changed(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_rgb", 1000, &BaseFrame::image_received_callback, this);
	sub2 = n.subscribe("tracked_object", 1000, &BaseFrame::tracked_object_callback, this);
	sub3 = n.subscribe("fps_tracker", 1000, &BaseFrame::fps_tracker_callback, 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;
}