The following procedure has been tested under Sequoia 15.1.1 and Xcode 16.1.
Please, follow these install steps:
- First you need to install homebrew and Xcode CLT (check the section below)
- Download this repo:
$ git clone --recursive https://github.com/luigifreda/pyslam.git $ cd pyslam
- Change your default shell type to
bash
:(if you want to set$ chsh -s /bin/bash
zsh
back then run:$ chsh -s /bin/zsh
) - Launch the macOS install script
$ ./install_all_venv.sh
NOTE: The above install procedure (step 4) installs a virtual python environment pyslam
in your system. That virtual environment can be easily activated by using the command:
$ . pyenv-activate.sh
(do not forget the dot! without '/' ! ) You can find further details about python virtual environments here.
- To test the basic visual odometry run
$ . pyenv-activate.sh # Activate pyslam environment. This is just needed once in a new terminal. $ ./main_vo.py
- To test the full SLAM system run
$ . pyenv-activate.sh # Activate pyslam environment. This is just needed once in a new terminal. $ ./main_slam.py
From https://brew.sh/, run the following command:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You may also need to install gcc by using XCode Command Line Tools. Run
$ xcode-select --install
On my machine, I've noticed that, the first time one of main scripts is run, it takes a while before it actually starts.
When you launch one of the scripts above, you get a warning:
objc[6169]: Class CaptureDelegate is implemented in both /Users/luigi/.python/venvs/pyslam/lib/python3.7/site-packages/cv2/cv2.cpython-37m-darwin.so (0x11923d590) and /usr/local/opt/opencv/lib/libopencv_videoio.4.3.dylib (0x13021d0c8). One of the two will be used. Which one is undefined.
This is an open issue which needs to be solved. In a few words, this is an "interference" between the OpenCV libs of the installed virtual python environment and the OpenCV libs installed by homebrew.
On my mac, boost deserialization is very slow. On the other hand, under linux, it is very fast.