CloudCompare, point cloud analysis for photogrammetry

0
2259

cloudCompare fotogrametria arqueologia

Among the free tools for applications related to photogrammetry in heritage digitization that I have been reviewing these days, I came across CloudCompare, which has proven to be a good complement to the lack of analysis tools in MeshLab.

CloudCompare is a tool designed by the French engineer Daniel Girardeau-Montaut, and as its name indicates, it is used to compare and conduct studies on point clouds. One of the main objectives of these comparisons is to estimate the differences between two measurements of the same object or group of objects; in this way, it is possible to determine, for example, deformations, etc. This situation is very common in laser scanner measurements and perhaps not as precise in photogrammetry due to the small margins of error; nevertheless, it can undoubtedly be useful for making certain geometric estimations.

cloudCompare photogrammetry color management colorchecker 3DHowever, this tool has been very useful to me for retrieving the RGB values of a specific point, in order to perform evaluations related to quality control in color capture thanks to the aid of color charts or scales with known colorimetry. With the “Point Picking” tool, in addition to calculating distances between points, we can instantly know the coordinates of a point and its RGB values.

As I mentioned in the previous article “Photogrammetry and colorimetry in heritage digitization“, photogrammetry can provide not only geometric information but also colorimetric information due to the ability of dense point clouds to store this data. Moreover, this colorimetric information is constructed from multiple images, so errors are averaged and minimized to some extent.

3D color managementGiven this situation, when working with photogrammetry aimed at heritage digitization, whether archaeological, architectural, or for the conservation of cultural assets, we must adhere to the usual color management protocols related to camera profiles and ICC characterization profiles.

To perform a colorimetric evaluation of a dense point cloud derived from a 3D reconstruction, we must consider certain characteristics:

  1. Point clouds are described in an RGB model; however, we need LAB values to perform the usual delta-e calculations for evaluating the quality of our process. Therefore, we need to represent the RGB values of the cloud in a CIELAB space; this process is done by describing the RGB values through an ICC color profile, which leads us to the second point.
  2. If we perform the appropriate color management tasks on the images used for the 3D reconstruction, we must not forget to convert our images to a working or display color space (sRGB, Adobe, Prophoto, etc.) because during the creation of the dense point cloud, RGB data is taken discarding the characterization information of our characterization profile. Therefore, it is necessary to perform a “conversion” to a working or display space to apply the characterization aspects of our input profile to the RGB values of the image.
  3. Starting from the idea that, for example, our images have been converted to a sufficiently wide destination space such as Adobe RGB, we then know that to obtain CIELAB values from RGB values, we must describe these RGB values in that space through the Adobe RGB ICC color profile. For this task, we can use the transicc tool from LittleCMS; the necessary command line would be as follows:
    transicc -i AdobeRGB1998.icc -o *Lab

    In this way, the tool will prompt us to enter the R, G, and B values and will return the CIELAB values.
    If we have problems with the terminal, we can use a small trick with our Photoshop: we create an image with the RGB color space and then enter the RGB values in the color palette; instantly, in the same panel, we can know the corresponding CIELAB values.

With these small concepts, we are now able to perform the typical delta evaluations, whether CIEDE00 or CIE76, from the CIELAB values deduced from our point cloud and the CIELAB values of our color chart; in this way, we can obtain tables like the following:

ake confclean

Point cloud RGB->Adobe RGB->LAB Colorchecker Deltas
R G B L a b L a b CIEDE00 CIE76
A01 109 82 69 38,95 14,41 14,77 34,84 11,45 12,37 4,09 5,39
A02 189 148 132 67,07 19,35 17,35 60,01 17,25 16,20 6,00 7,35
A03 98 122 155 50,17 -6,12 -22,97 45,34 -3,46 -21,55 5,66 5,92
A04 100 109 69 44,60 -11,00 22,00 39,69 -12,45 20,99 4,75 5,48
A05 135 134 177 58,01 7,98 -23,37 50,05 8,68 -23,33 7,74 8,06
A06 130 191 174 71,65 -33,81 -0,53 64,45 -31,37 -0,93 5,64 7,28
B01 205 123 50 63,55 37,52 59,82 63,68 36,00 58,10 0,86 2,24
B02 74 91 171 40,36 10,99 -48,47 40,63 12,61 -46,06 2,25 2,83
B03 179 82 96 52,36 50,31 17,78 52,33 48,83 17,75 0,68 2,00
B04 89 60 105 31,56 24,29 -21,02 31,30 22,86 -20,19 1,00 2,24
B05 170 190 74 73,62 -23,17 58,45 72,69 -24,28 56,65 1,24 2,45
B06 215 161 51 72,57 19,83 69,31 72,64 17,42 68,03 1,10 2,24
C01 46 66 149 29,88 14,23 -52,31 29,39 13,73 -50,17 0,44 2,24
C02 104 154 79 57,76 -39,39 34,53 56,36 -39,73 32,31 1,25 2,24
C03 161 56 58 44,36 53,20 30,74 43,79 52,47 29,90 1,02 1,73
C04 235 206 48 84,69 2,76 83,33 82,16 1,91 80,76 1,58 3,74
C05 174 86 150 53,38 50,88 -14,32 52,51 50,97 -13,21 1,08 1,41
C06 54 136 167 51,27 -31,40 -28,54 50,00 -27,77 -28,06 2,06 4,12
D01 251 251 242 98,48 -1,17 4,36 96,25 -0,50 2,72 2,52 3,00
D02 215 216 213 86,59 -0,89 1,34 80,34 -0,05 0,11 4,14 6,08
D03 168 167 164 69,25 0,08 1,80 66,17 -0,50 -0,31 2,58 3,16
D04 126 125 124 53,18 0,40 0,77 50,05 -0,31 -0,15 2,98 3,00
D05 84 84 86 36,07 0,36 -1,26 35,89 -0,48 -0,71 1,28 1,41
D06 46 47 48 18,96 -0,45 -0,93 20,81 0,44 -0,17 1,37 2,00
Average 2,63 3,65
Max 7,74 8,06

In the previous article “Photogrammetry and colorimetry in heritage digitization” I detail the processes of creating dense point clouds with free software and their implications in the preservation and documentation of cultural heritage.

As can be seen in the results of the previous table, color management plays a quite relevant role in photogrammetry work, in circumstances where color constitutes a relevant attribute of our object, building, or scene to be modeled.

CloudCompare installation on Ubuntu 12

CloudCompare installation is quite oriented towards its use on Windows, so the installation might be somewhat easier; however, it is possible to install it on Linux, and even on its forum, we can find a proposal to do so on Mac OS X.

On the program’s website, we have access to a wiki where the installation requirements and dependencies are indicated, as well as a forum where we can raise questions.

Depending on the libraries installed on our system, the installation can be more or less tedious; below I will indicate the steps I had to perform, which of course may vary:

First, the source code must be downloaded from:

https://github.com/cloudcompare/trunk

Or use Git to download the trunk directly to our machine

git clone https://github.com/cloudcompare/trunk.git

A username and password will be requested, which are: invite_cc/invite_cc
To compile, we can use

cmake CMakeLists.txt

Although it might be more convenient to use the cmake GUI because some configurations must be made. First, it must be indicated that we will use CodeBlocks as the compiler; then various paths must be configured, including PCL or LIBLAS. For example, the use of LIBE57, LIBLAS, and XIOT is optional. At the time of trying to obtain XIOT, its website was not operational, so it was impossible for me; the rest of the libraries I was able to obtain. Regarding plugins, although I marked their installation and did not get errors, they do not appear in the application; in fact, some of them are only operational on Windows.

The libraries I had to install were:

Before starting, make sure QT4 is installed:

sudo apt-get install libqt4-dev

First LIBLAS, which is done with the following procedure:

  wget http://download.osgeo.org/liblas/libLAS-1.7.0.tar.gz
  tar xf libLAS-1.7.0.tar.gz
  cd libLAS-1.7.0/
  mkdir makefiles
  cd makefiles
  cmake -G "Unix Makefiles" ../
  make
  sudo make install

Then I installed XERCES since LIBE57 depends on it; for this, we do:

  wget http://apache.rediris.es//xerces/c/3/sources/xerces-c-3.1.1.zip
  cd xerces-c-3.1.1/
  ./configure
  make
  sudo make install

Now we can install E57 as follows:

wget http://netcologne.dl.sourceforge.net/project/e57-3d-imgfmt/E57Refimpl-src/E57RefImpl_src-1.1.312.zip
  unzip E57RefImpl_src-1.1.312
  cd ../E57RefImpl_src-1.1.312
  cmake CMakeLists.txt
  make

Perhaps before installing E57, it is necessary to run an “updatedb” to update the “locate” tool of our Ubuntu; otherwise, E57 may not correctly locate XERCES.

Finally, it is necessary to install PCL. Point Cloud Library is a well-known framework for working with point clouds.

On its website, there is abundant documentation for installing the libraries, although the most convenient method I found is through the repositories; for this, we do:

  sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
  sudo apt-get update
  sudo apt-get install libpcl-1.6-all-dev

Now we are ready to compile CloudCompare, either with the Cmake GUI or with the usual make.