Apero-Micmac, denser point clouds

0
964

Apero-Micmac is a collection of open-source tools, released in 2007, aimed at tasks related to photogrammetry, developed from the MATIS laboratory of IGN France.

The collection of tools in this environment is extensive; however, in recent years it has been simplified with tools that, as an interface, streamline workflows.

Although Apero-Micmac has a certain common link with the usual tools in the world of photogrammetry and Structure from Motion, as we will see below, it somewhat differentiates itself from many of these tools by basing its use on depth maps instead of the usual multi-view clusters (Multi-view Stereo, CMVS). And it is at this point where perhaps Apero-Micmac’s ability to generate point clouds with much greater density and detail than its competitors lies.

Installation of Apero-Micmac

One of the advantages to keep in mind is that although it is a command-line tool, it is relatively easy to install, as well as being cross-platform.

The Apero-Micmac environment can be downloaded already compiled or the source code from the IGN France website.

But we can also download it from the repository using Mercurial:

hg clone https://geoportail.forge.ign.fr/hg/culture3d micmac

Using username: culture3d and password: culture3d

Compilation in Linux and Mac environments is straightforward, as it will only require as dependencies the prior installation of Exiftools, proj4; exiv2 and ImageMagick.

After downloading either from the repository or the source code, enter the micmac or culture3d directory and execute the following sequence:

  mkdir build
  cd build
  cmake ../
  make install -jn

Where n is the number of processors of our machine.

After these commands, a “bin” directory will be created with the Apero-Micmac executables.

At the time of writing this article, the official Apero-Micmac website (http://www.micmac.ign.fr/) was offline, so some documentation was not available and therefore I could not reference it.

Introduction to the use of Apero-Micmac

Next, we will describe some characteristic tools of a minimal workflow to model dense point clouds:

The Apero-Micmac workflow is similar to any other workflow:

Tapioca is essentially an interface of Pastis (Program using Autopano Sift for the Tie-points in the images) which is dedicated to the search and matching of points between images. Among its algorithms, it incorporates the well-known SIFT (Scale-invariant feature transform) algorithm by David Lowe. The Tapioca tool operates in different modes (MulScale, All, Line, File, and Graph) where matching methods can be optimized; for example, MulScale works with image banks of different sizes, or Line with image banks taken sequentially.

It should be noted that Tapioca supports images in Tiff, JPG, and RAW since it internally contains the raw development engine DCRAW.

Tapioca All "DSC[0-5].JPG" 1000
Tapioca MulScale "DSC[0-5].JPG" 500 1000

Where 1000 is the maximum image width and 500 the minimum.

Tapas is an interface of Apero (Relatively Operational Experimental Photogrammetric Aerotriangulation); it is the tool responsible for the relative orientation of the cameras, their calibrations, and as its name indicates, triangulation.

The use of Tapas could be:

Tapas works with different distortion models such as RadialExtended, RadialBasic, Fraser, FraserBasic, and even two fisheye models like FishEyeEqui and HemiEqui.

Tapas FraserBasic .*.JPG Out=Ground

Where we can see the distortion mode, the collection of images to be processed, and the output. “Ground” can be any indicative name of our project.

Tapas performs the calibration of our images based on the EXIF data of focal length, sensor width, etc., so these data must exist in the metadata of our images.
After running Tapas, we can then proceed to AperiCloud, which will be responsible for graphically representing our cameras along with our sparse cloud.

AperiCloud .*.JPG Ground Out=apericloud.ply

Note that the output parameter (“Ground”) from Tapas is indicated, as well as the name of our .ply file.

depth mapsThe next tool of interest is Malt, which is an interface of Micmac (Multi Image Matches for Auto Correlation Methods). Micmac is a tool developed by Marc Pierrot-Desseilligny responsible, among other tasks, for designing “depth maps” from a set of images and with reference to a “master” image. A “depth map” is an image where each pixel represents the depth corresponding to a particular viewpoint, relative to a master image or scene.

Micmac, like many other tools in the field of photogrammetry, is based on epipolar geometry (geometry of stereoscopic vision), but it does not support multi-stereoscopy, which implies a certain specialization in quasi-planar scenarios, such as terrain images, facades, walls, reliefs, etc., excluding objects or artifacts of the round lump type.

The use of Malt would be as follows:

Malt GeomImage .*.JPG Ground Master=P1110068.JPG ZoomF=2

camerasWhere, in addition to indicating the collection of images with which we will work, as mentioned in the previous paragraph, we will add the “master” image, which will be used as a reference to orient the entire project. “Ground” are the calibration data calculated by Tapas.

And the last necessary phase to have a dense point cloud is to invoke Nuage2Ply, which performs the conversion from depth maps to a dense point cloud.

The use of Nuage2Ply is:

Nuage2Ply "MM-Malt-Img-P1110071/NuageImProf_STD-MALT_Etape_7.xml"  Out= P1110071.ply RatioAttrCarte=2

Where the directory “MM-Malt-Img-P1110071” is automatically generated by Malt using the name of the master image.

For a deeper understanding, the manual “MicMac, Apero, Pastis and Other Beverages in a Nutshell!” is recommended.

Workflow design

Working with Apero-Micmac, although it may seem tedious, can be easily automated with bash-type scripts. For example, the described workflow can be summarized in this script:

#!/bin/sh
  BIN_DIR="/opt/micmac/bin/"
  CHANT_DIR=$3
  GEOMIMG=$1
  EXT=$2
"${BIN_DIR}Tapioca" MulScale "${CHANT_DIR}.*.${EXT}" 500 1500
"${BIN_DIR}Tapas" FraserBasic "${CHANT_DIR}.*.${EXT}" Out=Ground
"${BIN_DIR}AperiCloud" "${CHANT_DIR}.*.${EXT}" Ground Out=Apericloud.ply
"${BIN_DIR}Malt" GeomImage "${CHANT_DIR}.*.${EXT}" Ground Master=${GEOMIMG}.JPG ZoomF=2
"${BIN_DIR}Nuage2Ply" "${CHANT_DIR}MM-Malt-Img-${GEOMIMG}/NuageImProf_STD-MALT_Etape_7.xml" \
"Attr=${CHANT_DIR}${GEOMIMG}.${EXT}" "Out=${CHANT_DIR}${GEOMIMG}.ply" RatioAttrCarte=2

Thus, this script would be passed as the first parameter the name of the master image (without extension), as the second the extension of the images with which we will work, and finally optionally, if we are not invoking this script from the directory containing our image collection, the path to that directory.

The path to this script can be saved in the path to be invoked from anywhere in the system, for example:

vim ~/.profile

and we add

export PATH=$PATH:/opt/micmac/scripts/

As we can see, although the command line may reduce ergonomics, scripting work adds more speed and efficiency to our workflows, allowing relatively complex processes to be automated with just a few parameters.