Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing all in python virtual env on ubuntu 20.04 #36

Closed
kevkid opened this issue Oct 16, 2020 · 2 comments
Closed

Installing all in python virtual env on ubuntu 20.04 #36

kevkid opened this issue Oct 16, 2020 · 2 comments

Comments

@kevkid
Copy link

kevkid commented Oct 16, 2020

If you get this error using opencv 4.x as found here:

pyslam/thirdparty/orbslam2_features/ORBextractor.h:26:10: fatal error: opencv/cv.h: No such file or directory
   26 | #include <opencv/cv.h>

just go to the file ORBextractor.h and comment out the include using //#include <opencv.h>

If you run into this error:
Building CXX object python/CMakeFiles/g2o.dir/g2o.cpp.o
........
make[2]: *** [python/CMakeFiles/g2o.dir/build.make:63:python/CMakeFiles/g2o.dir/g2o.cpp.o] error 1
make[1]: *** [CMakeFiles/Makefile2:1345:python/CMakeFiles/g2o.dir/all] error 2
make: *** [Makefile:130:all] error 2

The fix is found here by doing this:

        .def("x", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::x)
        .def("y", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::y)
        .def("z", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::z)
        .def("w", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::w)

in g2opy/python/core/eigen_types.h to:

        .def("x", [](const Eigen::Quaterniond& q) { return q.x(); })
        .def("y", [](const Eigen::Quaterniond& q) { return q.y(); })
        .def("z", [](const Eigen::Quaterniond& q) { return q.z(); })
        .def("w", [](const Eigen::Quaterniond& q) { return q.w(); })

Also you may have issues installing opencv-contrib so you also need to install some stuff via pip manually:
pip3 install scipy opencv-contrib-python termcolor ordered_set matplotlib pygame pyopengl

This got it to build and run except for this error:

(pyslam) ~/pyslam$ python3 -O main_slam.py
 WARNING: cannot import SuperPointFeature2D from feature_superpoint, check the file TROUBLESHOOTING.md
 WARNING: cannot import TfeatFeature2D from feature_tfeat, check the file TROUBLESHOOTING.md
 WARNING: cannot import HardnetFeature2D from feature_hardnet, check the file TROUBLESHOOTING.md
 WARNING: cannot import GeodescFeature2D from feature_geodesc, check the file TROUBLESHOOTING.md
 WARNING: cannot import SosnetFeature2D from feature_sosnet, check the file TROUBLESHOOTING.md
 WARNING: cannot import L2NetFeature2D from feature_l2net, check the file TROUBLESHOOTING.md
 WARNING: cannot import LogpolarFeature2D from feature_logpolar, check the file TROUBLESHOOTING.md
 WARNING: cannot import D2NetFeature2D from feature_d2net, check the file TROUBLESHOOTING.md
 WARNING: cannot import DelfFeature2D from feature_delf, check the file TROUBLESHOOTING.md
 WARNING: cannot import ContextDescFeature2D from feature_contextdesc, check the file TROUBLESHOOTING.md
 WARNING: cannot import LfNetFeature2D from feature_lfnet, check the file TROUBLESHOOTING.md
 WARNING: cannot import R2d2Feature2D from feature_r2d2, check the file TROUBLESHOOTING.md
 WARNING: cannot import KeyNetDescFeature2D from feature_keynet, check the file TROUBLESHOOTING.md
importing pygame
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
initialising pygame
Processing Video Input
num frames:  1206
fps:  29.836205991321275
tracker_config:  {'num_features': 2000, 'num_levels': 8, 'scale_factor': 1.2, 'detector_type': <FeatureDetectorTypes.ORB2: 7>, 'descriptor_type': <FeatureDescriptorTypes.ORB2: 5>, 'match_ratio_test': 0.7, 'tracker_type': <FeatureTrackerTypes.DES_BF: 1>}
num_levels:  8
using opencv  4.4.0
Using Orbslam2Feature2D
 using same detector and descriptor object:  ORB2
num_levels:  8
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/pyslam/viewer3D.py", line 84, in viewer_thread
    self.viewer_init(kViewportWidth, kViewportHeight)
  File "/home/user/pyslam/viewer3D.py", line 92, in viewer_init
    pangolin.CreateWindowAndBind('Map Viewer', w, h)
AttributeError: module 'pangolin' has no attribute 'CreateWindowAndBind'

looks like the pangolin didn't build:

make[2]: *** [src/CMakeFiles/_pangolin.dir/build.make:999: src/CMakeFiles/_pangolin.dir/video/drivers/ffmpeg.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:516: src/CMakeFiles/_pangolin.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
@luigifreda
Copy link
Owner

I added an install procedure that is specific for Ubuntu 20.04. Check here. Let me know if it works for you.

In particular, move into the experimental branch ubuntu20

$ git checkout ubuntu20  

and then follow the instructions for creating a new virtual environment pyslam described here.

@alexriedel1
Copy link

alexriedel1 commented Feb 17, 2021

Anyone else having problem building pangolin, this helped me:

stevenlovegrove/Pangolin#27 (comment)

additionally, the name of pangolin is pypangolin in the ubuntu checkout,. this should be renamed to panoglin..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants