Code Monkey home page Code Monkey logo

Comments (4)

jj-gomez avatar jj-gomez commented on July 17, 2024

Hola @RafaelAgular.

Los ejemplos que damos junto con la libreria muestran el funcionamiento de las clases y metodos de la misma y de como se usan. Si quieres usar ORB-SLAM3 con tu propia camara en tiempo real, deberias crear tu propio programa el cual, en primer lugar crea todas las clases necesarias (como por ejemplo, el system de ORB-SLAM3) y posteriormente, un bucle en el que coges la imagen de la camara (el codigo de esta parte depende integramente de la camara que utilices y de como lees sus imagenes) y se la pasas al ORB-SLAM3 para que la procese (de manera identica a como se hace en los ejemplos con datasets).

Un saludo.

from orb_slam3.

varunns avatar varunns commented on July 17, 2024

Hi @jjgr3496 , @RafaelAgular, I tried to add the code for reading images from a live cam stream , but the system get stuck at initialiazation. Following is the code:

  // Create SLAM system. It initializes all system threads and gets ready to process frames.
  ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR,true);

  cv::VideoCapture cap(id); //id if 4 for my laptop
  if (!cap.isOpened()) 
  {
    std::cerr << "ERROR: Could not open camera" << std::endl;
    return 1;
  }

  int count = 0;
  for(;;)
  {
  	Mat im;
  	cap >> im;


  	//return if frame is not valid
  	if(im.empty())
    {
        cerr << endl << "Failed to load image at: "
             << count << endl;
        return 1;
    }

//    imshow("im", im);
//  	cv::waitKey(20);

    std::chrono::steady_clock::time_point t1 = std::chrono::steady_clock::now();
    double tframe = t1.time_since_epoch().count();

    // Pass the image to the SLAM system
    SLAM.TrackMonocular(im,tframe);

    std::chrono::steady_clock::time_point t2 = std::chrono::steady_clock::now();

    double ttrack= std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count();

    vTimesTrack.push_back(ttrack);

     // Wait to load the next frame
    double T=0;
    if(count>0)
            T = tframe-vTimesTrack[count];

		if(ttrack<T)
            usleep((T-ttrack)*1e6);

    count++;
  	
  }

Please let me know if you have any idea or should I wait longer for initialization?

from orb_slam3.

jj-gomez avatar jj-gomez commented on July 17, 2024

@varunns Your code looks fine, however without seeing your images I can not tell whether is problem of ORB-SLAM3 or an issue with your images. Please, note that we are aware of some issues related with monocular initialization and we are currently working on it!

Also please check this related issue #85

from orb_slam3.

jdtardos avatar jdtardos commented on July 17, 2024

Version 1.0 now includes examples to run ORB-SLAM3 with Intel Realsense cameras

from orb_slam3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.