Closed apoorvkh closed 2 years ago
Modifications:
ORB_SLAM2/python
System(..., init_pose)
System.cpp
ORB_SLAM2/Vocabulary/ORBvoc.bin
<uninstd.h>
Compilation instructions: Add ORB_SLAM2/lib to PYTHONPATH and LD_LIBRARY_PATH environment variables Run ./build.sh && ./build_python.sh
ORB_SLAM2/lib
PYTHONPATH
LD_LIBRARY_PATH
./build.sh && ./build_python.sh
To use in Python:
import orbslam2 vocab_file = 'ORB_SLAM2/Vocabulary/ORBvoc.bin' settings_file = 'ORB_SLAM2/Examples/RGB-D/TUM3.yaml' mode = 'rgbd' # or 'monocular' or 'stereo' init_pose = np.eye(4, dtype=np.float32) # specify camera intrinsics for initial view use_viewer = True slam_system = orbslam2.SLAM(vocab_file, settings_file, mode, init_pose, use_viewer) # For each SLAM step # frame : np.array(shape : [w, h, c], dtype : np.uint8) # depth_frame : np.array(shape : [w, h], dtype : np.float32) pose, tracked_map_points = self.slam_system.track(frame, depth_frame) # when finished slam_system.shutdown()
See cdef class SLAM in ORB_SLAM2/python/orbslam2.pyx for other Python functions.
cdef class SLAM
ORB_SLAM2/python/orbslam2.pyx
Modifications:
ORB_SLAM2/python
)System(..., init_pose)
)System.cpp
ORB_SLAM2/Vocabulary/ORBvoc.bin
)<uninstd.h>
)Compilation instructions: Add
ORB_SLAM2/lib
toPYTHONPATH
andLD_LIBRARY_PATH
environment variables Run./build.sh && ./build_python.sh
To use in Python:
See
cdef class SLAM
inORB_SLAM2/python/orbslam2.pyx
for other Python functions.