Пример #1
0
int main(int argc, char *argv[])
{
	Egg egg;
	EggPlugin plugin(&egg);


	if (argc > 2)
	{
		printf("Loading '%s' saving '%s'...\n", argv[1], argv[3]);

		if (!import_model(argv[1]))
			plugin.exportModel(argv[3], argv[2]);
	}
	else if (argc > 1)
	{
		printf("Loading '%s'...\n", argv[1]);

		if (!import_model(argv[1]))
			printf("Success!\n");
	}
	else
	{
		printf("%s import_model [format export_model]\n", argv[0]);
	}

	return 0;
}
Пример #2
0
DLLExport_ int importar_modelo(char *fichero,void **model_tag){

        struct LTriangle2 tri_3ds;
        int n,j,z;
        cara *tri;
        modelo *modelo_1;

/*      struct LTriangle2
            {
            LVector4 vertices[3];
            LVector3 vertexNormals[3];
            LVector2 textureCoords[3];
            LVector3 faceNormal;
            uint materialId;
            };
*/
        n=import_model(fichero,&tri_3ds);
        printf("Importando %d triangulos\n",n);

        modelo_1 = (modelo *) malloc(sizeof(modelo));
        if (modelo_1==NULL)
      	{
        	printf("Error alojando memoria\n");
      	return -1;
	      }
        memset(modelo_1->base, 0, (sizeof(vertice) * 3));
        modelo_1->x = 0.0;
        modelo_1->y = 0.0;
        modelo_1->z = 0.0;
        modelo_1->n_caras=n;
        modelo_1->triangulos = (cara *) malloc(sizeof(cara) * modelo_1->n_caras);


        fflush(stdout);
        j=0;
        while (import_model(fichero,&tri_3ds)!=-1) {
          for (z=0;z<3;z++) {
            modelo_1->triangulos[j].vertices[z].x=tri_3ds.vertices[z].x/100.0f;
            modelo_1->triangulos[j].vertices[z].y=tri_3ds.vertices[z].y/100.0f;
            modelo_1->triangulos[j].vertices[z].z=tri_3ds.vertices[z].z/100.0f;
            modelo_1->triangulos[j].vertices[z].u=tri_3ds.textureCoords[z].x;
            modelo_1->triangulos[j].vertices[z].v=tri_3ds.textureCoords[z].y;
            modelo_1->triangulos[j].vertices[z].Nx=tri_3ds.vertexNormals[z].x;
            modelo_1->triangulos[j].vertices[z].Ny=tri_3ds.vertexNormals[z].y;
            modelo_1->triangulos[j].vertices[z].Nz=tri_3ds.vertexNormals[z].z;
          }
        j++;
        }


        *model_tag=modelo_1;
        return 1;


}
Пример #3
0
std::list<model>
importer::import(const std::list<input_descriptor>& descriptors) {
    BOOST_LOG_SEV(lg, debug) << "Started executing importer. "
                             << "Descriptors: " << descriptors;

    std::list<tack::model> r;
    for (const auto& d : descriptors)
        r.push_back(import_model(d));

    BOOST_LOG_SEV(lg, debug) << "Finished executing importer.";
    return r;
}
Пример #4
0
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;
	}
}
Пример #5
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;
}