Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Introduction

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.

Getting Started

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.

Building AliceVision

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).

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.

Building/Installing Meshroom

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

Installing Qt and PySide

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

Wait for several hours and if you're lucky you'll have installed PySide and be ready.

Install meshroom

cd ~/meshroom pip install wheel pip install -r requirements.txt

Dependencies You MIGHT Need

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

Running Meshroom

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

The Results

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)

@olliwa-git

This comment has been minimized.

Copy link

@olliwa-git olliwa-git commented Apr 7, 2021

"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.

@duwke

This comment has been minimized.

Copy link

@duwke duwke commented Apr 7, 2021

Regarding the nvidia forum post - https://github.com/duwke/jetson-ros-alicevision
This is a dockerfile based on the instructions above. I'm running now. I'll check it in the morning and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment