The Openscan project https://openscan.eu is a really cool 3D printing and scanning project. It systematically takes a series of photos that can be stitched together into a 3D model using photogrammetry. Thomas Megel the creator of OpenScan has a really cool cloud-based service that can take the raw photos and turn them an STL model for you. You can read more about it here: https://github.com/OpenScanEu/OpenScan/blob/master/temp/README.md
Another way to take advantage of photogrammetry is using AliceVision's Meshroom. Prusa Research did a nice explainer/tutorial in this blog post: https://blog.prusaprinters.org/photogrammetry-2-3d-scanning-simpler-better-than-ever_29393/
The main "catch" with Meshroom is that it requires CUDA and hence an NVIDIA graphics card. It didn't have an NVIDIA card (and didn't want to figure out how to run in the cloud) but I did have a Jetson Nano 2GB https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/education-projects/
The documentation for Meshroom says that it requires 8GB of RAM https://meshroom-manual.readthedocs.io/en/latest/install/requirements/requirements.html but I was curious to see if I could build, run, and use Meshroom to complete a photogrammetry project.
Start by following the Getting Started guide from NVIDIA: https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-2gb-devkit
Then I did some system-level update/installing for some core dependencies.
- sudo apt-get update
- upgrade cmake as here: https://graspingtech.com/upgrade-cmake/
- sudo apt-get install gfortran
- sudo apt-get install clang-6.0
You can successfully build/install Meshroom and even run it. But in order for it to be able to do anything you need AliceVision. The install instructions here (and lots of time on google/stackoverflow) were ultimately sufficient for me to successfully build AliceVision: https://github.com/alicevision/AliceVision/blob/develop/INSTALL.md
I tried both the "external dependencies" and "embedded dependencies" approach but ultimately landed on the "embedded" approach. The full build from beggining to end takes quite a long time, but it has all of the versions, configuration, etc. to get the dependencies right (for example I got a complete build of AliceVision with external dependencies running but the photogrammetry process died because I hadn't enabled some feature in one of the tools).
- mkdir ~/deps && cd ~/deps
- git clone https://github.com/aharbick/AliceVision.git --recursive
- cd AliceVision && mkdir build && cmake -DALICEVISION_BUILD_DEPENDENCIES=ON -DCMAKE_INSTALL_PREFIX=~/aliceVision ..
- make -j2
- NOTE only -j2 despite having 4 cores because some parts of the build swap hard and 4 didn't seem to help
- mkdir ~/aliceVision/share/voctree && cd ~/aliceVision/share/voctree && wget https://gitlab.com/alicevision/trainedVocabularyTreeData/raw/master/vlfeat_K80L3.SIFT.tree
If you're lucky that'll finish in 10+ hours (I forgot to actually time it). If it doesn't compile it's probably because I installed a dependency with apt-get install
and forgot to write it down.
Hypothetically Meshroom is just a python app and you should be able to check it out and then pip install -r requirements.txt
however it tries to install some dependencies that require code that isn't on the Jetson by default.
Start by checking out Meshroom and creating a venv for python
- cd ~ && git clone https://github.com/aharbick/meshroom
- sudo apt-get install python3 python3-venv
- cd meshroom && python3 -m venv venv
- . venv/bin/activate
- mkdir ~/deps && cd ~/deps
- wget http://master.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz
- tar xpf qt-everywhere-src-5.15.2.tar.xz && cd qt-everywhere-src-5.15.2
- sudo apt-get install xcb libxkbcommon-x11-0
- ./configure -xcb && make -j4 && sudo make install
Install some fonts
- Download the font pack from here: https://dejavu-fonts.github.io/
- sudo mkdir /usr/local/Qt-5.15.2/lib/fonts
- Unzip dejavu-fonts-ttf-2.37.zip
- sudo cp dejavu-fonts-ttf-2.37/ttf/*.ttf /usr/local/Qt-5.15.2/lib/fonts
PySide
- git clone http://code.qt.io/pyside/pyside-setup.git
- cd pyside-setup && git checkout 5.14.1
- python setup.py install --qmake=/usr/local/Qt-5.15.2/bin/qmake --parallel=4
Wait for several hours and if you're lucky you'll have installed PySide and be ready.
cd ~/meshroom pip install wheel pip install -r requirements.txt
Through the process of getting this to work I tried a lot of different things. The following packages were installed, uninstalled, and possibly still around. So if you get stuck following the instructions above consider the packages below. NOTE that almost all of them are included when you build with "embedded dependencies" so you shouldn't need them.
- libboost-all-dev
- libopenjp2-7-dev
- libturbo-jpeg
- libbz2-dev
- libraw-dev
- libwebp-dev
- ptex-base
- libsquish-dev
- libheif-dev
- libopenvdb-tools
- libdcmtk-dev
- libptexenc-dev
- libgif-dev
- libfreetype6-dev
- libopencolorio-dev
- libffms2-dev
- libopenvdb-dev
- libturbojpeg0-dev
- libeigen3-dev
- libceres-dev
- graphviz
- doxygen
- python3-sphinx
If you used my fork and installed things in the same places as above then it should be possible to run meshroom by
~/meshroom/bin/meshroom_ui
Given the above I ran through images that I scanned using my OpenScan build of a carved apple that I had made. It completed most of the steps but ulimately failed with a message that "No valid mesh was generated." I'm not an expert in meshroom so I don't know if it was image quality or something broken in my build/install. You can try yourself with the same images in my fork (https://github.com/aharbick/meshroom/tree/develop/docs/scans/apple)
"No valid mesh was generated." May be due to photos used. Try with a most contrasted objet. Or with 3 photos of building facade or building gate in order to check that meshroom fully works.