Showing posts with label PPT-GUI. Show all posts
Showing posts with label PPT-GUI. Show all posts

Wednesday, 7 December 2016

Comparing 7 photogrammetry systems. Which is the best one?


by Cicero Moraes
3D Designer of Arc-Team.

When I explain to people that photogrammetry is a 3D scanning process from photographs, I always get a look of mistrust, as it seems too fantastic to be true. Just imagine, take several pictures of an object, send them to an algorithm and it returns a textured 3D model. Wow!

After presenting the model, the second question of the interested parties always orbits around the precision. What is the accuracy of a 3D scan per photo? The answer is: submillimetric. And again I am surprised by a look of mistrust. Fortunately, our team wrote a scientific paper about an experiment that showed an average deviation of 0.78 mm, that is, less than one millimeter compared to scans done with a laser scanner.

Just like the market for laser scanners, in photogrammetry we have numerous software options to proceed with the scans. They range from proprietary and closed solutions, to open and free. And precisely, in the face of this sort of programs and solutions, comes the third question, hitherto unanswered, at least officially:

Which photogrammetry software is the best?

This is more difficult to answer, because it depends a lot on the situation. But thinking about it and in the face of a lot of approaches I have taken over time, I decided to respond in the way I thought was broader and more just.


The skull of the Lord of Sipan


In July of 2016 I traveled to Lambayeque, Peru, where I stood face to face with the skull of the Lord of Sipan. In analyzing it I realized that it would be possible to reconstruct his face using the forensic facial reconstruction technique. The skull, however, was broken and deformed by the years of pressure it had suffered in its tomb, found complete in 1987, one of the greatest deeds of archeology led by Dr. Walter Alva.


To reconstruct a skull I took 120 photos with an Asus Zenphone 2 smartphone and with these photos I proceeded with the reconstruction works. Parallel to this process, professional photographer Raúl Martin, from the Marketing Department of Inca University Garcilaso de la Vega (sponsor of my trip) took 96 photos with a Canon EOS 60D camera. Of these, I selected 46 images to proceed with the experiment.

Specialist of the Ministry of Culture of Peru initiating the process of digitalization of the skull (in the center)


A day after the photographic survey, the Peruvian Ministry of Culture sent specialists in laser scanning to scan the skull of the Lord of Sipan, carrying a Leica ScanStation C10 equipment. The final cloud of points was sent 15 days later, that is, when I received the data from the laser scanner, all models surveyed by photogrammetry were ready.

We had to wait for this time, since the model raised by the equipment is the gold standard, that is, all the meshes raised by photogrammetry would be compared, one by one, with it.

Full points cloud imported into MeshLab after conversion done in CloudCompare
The cloud of points resulting from the scan were .LAS and .E57 files ... and I had never heard of them. I had to do a lot of research to find out how to open them on Linux using free software. The solution was to do it in CloudCompare, which offers the possibility of importing .E57 files. Then I exported the model as .PLY to be able to open in MeshLah and reconstruct the 3D mesh through the Poisson algorithm.

3D mesh reconstructed from a points cloud. Vertex Color (above) and surface with only one color (below).

As you noted above, the jaw and surface of the table where the pieces were placed were also scanned. The part related to the skull was isolated and cleaned for the experiment to be performed. I will not deal with these details here, since the scope is different. I have already written other materials explaining how to delete unimportant parts of a cloud of points / mesh.

For the scanning via photogrammetry, the chosen systems were:

1) OpenMVG (Open Multiple View Geometry library) + OpenMVS (Open Multi-View Stereo reconstruction library): The sparse cloud of points is calculated in OpenMVG and the dense cloud of points in OpenMVS.

2) OpenMVG + PMVS (Patch-based Multi-view Stereo Software): The sparse cloud of points is calculated in the OpenMVG and later the PMVS calculates the dense cloud of points.

3) MVE (Multi-View Environment): A complete photogrammetry system.

4) Agisoft® Photoscan: A complete and closed photogrammetry system.

5) Autodesk® Recap 360: A complete online photogrammetry system.

6) Autodesk ® 123D Catch: A complete online photogrammetry system.

7) PPT-GUI (Python Photogrammetry Toolbox with graphical user interface): The sparse cloud of points is generated by the Bundler and later the PMVS generates the dense cloud.

* Run on Linux under Wine (PlayOnLinux).

Above we have a table concentrating important aspects of each of the systems. In general, at least apparently there is not one system that stands out much more than the others.


Sparse cloud generation + dense cloud generation + 3D mesh + texture, inconsiderate time to upload photos and 3D mesh download (in the cases of 360 Recap and 123D Catch).

Alignment based on compatible points

Aligner skulls
All meshes were imported to Blender and aligned with laser scanning.


Above we see all the meshes side by side. We can see that some surfaces are so dense that we notice only the edges, as in the case of 3D scanning and OpenMVG + PMVS. Initially a very important information... the texture in the scanned meshes tend to deceive us in relation to the quality of the scan, so, in this experiment I decided to ignore the texture results and focus on the 3D surface. Therefore, I have exported all the original models in .STL format, which is known to have no texture information.


Looking closely, we will see that the result is consistent with the less dense result of subdivisions in the mesh. The ultimate goal of the scan, at least in my work, is to get a mesh that is consistent with the original object. If this mesh is simplified, since it is in harmony with the real volumetric aspect, it is even better, because, when fewer faces have a 3D mesh, the faster it will be to process it in the edition.


If we look at the file sizes (.STL exported without texture), which is a good comparison parameter, we will see that the mesh created in OpenMVG + OpenMVS, already clean, has 38.4 MB and Recap 360 only 5.1 MB!

After years of working with photogrammetry, I realized that the best thing to do when we come across a very dense mesh is to simplify it, so we can handle it quietly in real time. It is difficult to know if this is indeed the case, as it is a proprietary and closed solution, but I suppose both the Recap 360 and the 123D Catch generate complex meshes, but at the end of the process they simplify it considerably so they run on any hardware (PC and smartphones), preferably with WebGL support (interactive 3D in the internet browser).

Soon, we will return to discuss this situation involving the simplification of meshes, let us now compare them.

How 3D Mesh Comparison Works


Once all the skulls have been cleaned and aligned to the gold standard (laser scan) it is time to compare the meshes in the CloudCompare. But how does this 3D mesh comparison technology work?

To illustrate this, I created some didactic elements. Let's go to them.


This didactic element deals with two planes with surfaces of thickness 0 (this is possible in 3D digital modeling) forming an X.


Then we have object A and object B. In the final portion of both sides the ends of the planes are distant in millimeters. Where there is an intersection the distance is, of course, zero mm.


When we compare the two meshes in the CloudCompare. They are pigmented with a color spectrum that goes from blue to red. The image above shows the two plans already pigmented, but we must remember that they are two distinct elements and the comparison is made in two moments, one in relation to the other.

Now we have a clearer idea of how it works. Basically what happens is the following, we set a distance limit, in this case 5mm. What is "out" try to be pigmented red, what is "in" tends to be pigmented with blue and what is at the intersection, ie on the same line, tends to be pigmented with green.


Now I will explain the approach taken in this experiment. See above we have an element with the central region that tends to zero and the ends that are set at +1 and -1mm. In the image does not appear, but the element we use to compare is a simple plane positioned at the center of the scene, right in the region of the base of the 3D bells, or those that are "facing upwards" when those that are "facing down" .


As I mentioned earlier, we have set the limit of comparison. Initially it was set at +2 and -2mm. What if we change this limit to +1 and -1mm? See that this was done in the image above, and the part that is out of bounds.


In order for these off-limits parts not to interfere with visualization, we can erase them.


Thus resulting in a mesh comprising only the interest part of the structure.

For those who understand a little more 3D digital modeling, it is clear that the comparison is made at the vertices rather than the faces. Because of this, we have a serrated edge.

Comparing Skulls


The comparison was made by FOTOGRAMETRIA vs. LASER SCANNING with limits of +1 and -1 mm. Everything outside that spectrum was erased.


OpenMVG+OpenMVS


OpenMVG+PMVS


Photoscan


MVE


Recap 360


123D Catch


PPT-GUI


By putting all the comparisons side by side, we see that there is a strong tendency towards zero, the seven photogrammetry systems are effectively compatible with laser scanning!


Let's now turn to the issue of file sizes. One thing that has always bothered me in the comparisons involving photogrammetry results was the accounting for the subdivisions generated by the algorithms that reconstruct the meshes. As I mentioned above, this does not make much sense, since in the case of the skull we can simplify the surface and yet it maintains the information necessary for the work of anthropological survey and forensic facial reconstruction.

In the face of this, I decided to level all the files, leaving them compatible in size and subdivision. To do this, I took as a base the smaller file that is generated by 123D Catch and used the MeshLab Quadratic Edge Collapse Detection filter set to 25000. This resulted in 7 STLs with 1.3 MB each.

With this leveling we now have a fair comparison between photogrammetry systems.


Above we can visualize the work steps. In the Original field are outlined the skulls initially aligned. Then in Compared we observe the skulls only with the areas of interest kept and finally, in Decimated we have the skulls leveled in size. For an unsuspecting reader it seems to be a single image placed side by side.


When we visualize the comparisons in "solid" we realize better how compatible they all are. Now, let's go to the conclusions.


Conclusion


The most obvious conclusion is that, overall, with the exception of MVE that showed less definition in the mesh, all photogrammetry systems had very similar visual results.

Does this mean that the MVE is inferior to the others?

No, quite the opposite. The MVE is a very robust and practical system. In another opportunity I will present its use in a case of making prosthesis with millimeter quality. In addition to this case he was also used in other projects of making prosthetics, a field that demands a lot of precision and it was successful. The case was even published on the official website of Darmstadt University, the institution that develops it.

What is the best system at all?

It is very difficult to answer this question, because it depends a lot on the user style.

What is the best system for beginners?

Undoubtedly, it's the Autodesk® Recap 360. This is an online platform that can be accessed from any operating system that has an Internet browser with WebGL support. I already tested directly on my smartphone and it worked. In the courses that I ministering about photogrammetry, I have used this solution more and more, because students tend to understand the process much faster than other options.

What is the best system for modeling and animation professionals?

I would indicate the Agisoft® Photoscan. It has a graphical interface that makes it possible, among other things, to create a mask in the region of interest of the photogrammetry, as well as allows to limit the area of calculation drastically reducing the processing time of the machine. In addition, it exports in the most varied formats, offering the possibility to show where the cameras were at the time they photographed the scene.

Which system do you like the most?

Well, personally I appreciate everyone in certain situations. My favorite today is the mixed OpenMVG + OpenMVS solution. Both are open source and can be accessed via the command line, allowing me to control a series of properties, adjusting the scanning to the present need, be it to reconstruct a face, a skull or any other piece. Although I really like this solution, it has some problems, such as the misalignment of the cameras in relation to the models when the sparse cloud scene is imported into Blender. To solve this I use the PPT-GUI, which generates the sparse cloud from the Bundler and the match, that is, the alignment of the cameras in relation to the cloud is perfect. Another problem with the OpenMVG + OpenMVS is that it eventually does not generate a full dense cloud, even if sparse displays all the cameras aligned. To solve this I use the PMVS which, although generating a mesh less dense than OpenMVS, ends up being very robust and works in almost all cases. Another problem with open source options is the need to compile programs. Everything works very well on my computers, but when I have to pass on the solutions to the students or those interested it becomes a big headache. For the end user what matters is to have a software in which on one side enter images and on the other leave a 3D model and this is offered by the proprietary solutions of objective mode. In addition, the licenses of the resulting models are clearer in these applications, I feel safer in the professional modeling field, using templates generated in Photoscan, for example. Technically, you pay the license and can generate templates at will, using them in your works. What looks more or less the same with Autodesk® solutions.

Acknowledgements


To the Inca University Garsilazo de la Vega for coordinating and sponsoring the project of facial reconstruction of the Lord of Sipán, responsible for taking me to Lima and Lambayeque in Peru. Many thanks to Dr. Eduardo Ugaz Burga and to Msc. Santiago Gonzáles for all the strength and support. I thank Dr. Walter Alva for his confidence in opening the doors of the Tumbas Reales de Sipán museum so that we could photograph the skull of the historical figure that bears his name. This thanks goes to the technical staff of the museum: Edgar Bracamonte Levano, Cesar Carrasco Benites, Rosendo Dominguez Ruíz, Julio Gutierrez Chapoñan, Jhonny Aldana Gonzáles, Armando Gil Castillo. I thank Dr. Everton da Rosa for supporting research, not only acquiring a license of Photoscan for it, but using the technology of photogrammetry in his orthognathic surgery plans. Dr. Paulo Miamoto for presenting brilliantly the results of this research during the XIII Brazilian Congress of Legal Dentistry and the II National Congress of Forensic Anthropology in Bahia. To Dr. Rodrigo Salazar for accepting me in his research group related to facial reconstruction of cancer victims, which caused me to open my eyes to many possibilities related to photogrammetry in the treatment of humans. To members of the Animal Avengers group, Roberto Fecchio, Rodrigo Rabello, Sergio Camargo and Matheus Rabello, for allowing solutions based on photogrammetry in their research. Dr. Marcos Paulo Salles Machado (IML RJ) and members of IGP-RS (SEPAI) Rosane Baldasso, Maiquel Santos and Coordinator Cleber Müller, for adopting the use of photogrammetry in Official Expertise. To you all, thank you!

Friday, 27 May 2016

ArcheOS Hypatia, a new tool for 3D documentation: opnMVG-GUI

In these days we are working very hard to package new software for ArcheOS v. 6 (codename Hypatia). This time we just finished to work on the new GUI +Martin Greca developed for +Pierre Moulon software, openMVG, setting up all the requested dependencies. The result is a new tool for 3D photogrammetry in +ArcheOS: openMVG-GUI. This software can be considered as the evolution of the old Python Photogrammetry ToolBox, but we are currently working to fix some bugs of this application to keep providing it in ArcheOS, since it gave the best results in underground environment documentation.
Here below you an see a fast videotutorial I did for our brand new YouTube channel:



To speed up ArcheOS Hypatia development, we set up an unofficial new repository, which we will use (by now) just internally our society, to be sure that everything works fine before to release it publicly to all the users. Anyway we will share this repository also during the university courses in which we should teach this years, like the one in Evora (Portugal) or the one in Venice, since in this conditions it is possible to work under strict control, avoiding problems in unresolved package dependencies. As soon as the new repository will be hardly tested, we will open it, adding the coordinates to the ArcheOS main branch.

The new GUI (by +Martin Greca) for openMVG (by +Pierre Moulon)
 

PS

If you are interested, there are still available places for the course in Evora (regarding open source technologies and cultural heritage). Here more infos.

Have a nice day!

Tuesday, 16 June 2015

OpenMVG VS PPT

Hi all,
as I promised, we are back with new post in ATOR. We start today with an experiment we wanted to do since long: a comparison between two Structure from Motion - Muti View Stereoreconstruction (SfM - MVS) suite. The first is Python Photogrammetry Toolbox, developed by +Pierre Moulon some years ago and integrated in ArcheOS 4 (Caesar) with the new GUI (PPT-GUI) written in Python by +Alessandro Bezzi and me. The second one is the evolution of PPT: openMVG, which Pierre is developing since some years and that will be integrated in the next releases of ArcheOS.
Our small test regarded just four pictures taken with a Nikon D5000 on an old excavation. We want to point out the speed of the overall process in OpenMVG, which gave a result compatible with the one of PPT.
In the image below you can have an overview (in +MeshLab) of the two pointclouds generated bye the different software: openMVG processed a ply file with 391197 points, while PPT gave us a result with 425296 points.


Comparison of the two models generated by opnMVG and PPT

The main different stays in the processing time. In fact, while PPT needed 16 minutes, 11 seconds and 25 tenths, openMVG complete the model in just 3 minutes, 28 seconds and 20 tenths.
Here below I report the log file of openMVG, where you can see each step of the process:

STEP 1: Process Intrisic analysis - openMVG_main_CreateList took: 00:00:00:00.464
STEP 2: Process compute matches - openMVG_main_computeMatches took: 00:00:01:13.73764
STEP 3: Process Incremental Reconstruction -  openMVG_main_IncrementalSfM took: 00:00:00:47.47717
STEP 4: Process Export to CMVS-PMVS - openMVG_main_openMVG2PMVS took: 00:00:00:00.352
STEP 4: Process Export to CMVS-PMVS - openMVG_main_openMVG2PMVS took: 00:00:00:00.352
STEP 5: Process CMVS-PMVS took: 00:00:01:25.85958
--------------------
The whole detection and 3D reconsruction process took: 00:00:03:28.208258

We will go on in working and testing openMVG, hopfully posting soon news about this nice software.

Have a nice day!

Acknowledgment

Many thanks to +Pierre Moulon and +Cícero Moraes for the help!

Monday, 9 December 2013

Caldonazzo castle - from ruins to archaeological 3D reconstruction



In 2009 I met a technology called SfM, or Structure-from-Motion, where with a series of photographs and a kind of reverse engineering using the camera data, we could reconstruct the objects photographed in a cloud of points in three dimensions. After many studies realized, I saw it was not a trivial task to get good results, but I did not give up until I found a very interesting material in the ATOR's blog.


I already knew the impressive 123D Catch, but the goals with this technology were two. 1) Scanning objects in 3D using only free software and 2) The scan would need to have an accuracy of millimeters.

In ATOR's site I accessed excellent materials that enabled me to learn how the PPT-GUI work and achieve amazing results for me, at least at that time. Not so long ago, it was in May 2012.

As usual, I sent an email of thanks to the staff of ATOR and I took the opportunity to congratulate them for the excellent service presented in the posts. I told him that I was interested by their awesome field of archeology and was available if they needed anything related to 3D.


The answer came quickly and was very positive. The staff of Arc-Team research group and archaeological work, maintainers blog ACTOR, congratulated me for the work I developed with free software and invited me to write on the site, which I readily accepted. Moreover, they asked me if I was interested in participating in a project developed by them doing the reconstruction of a castle called Caldonazzo, where they work in their ruins. Second proposal also readily accepts. In that moment was born a partnership that lasts a year and a half and has yielded good fruits.

Caldonazzo



Caldonazzo is a tourist village located in Trentino, northern Italy. Famous for its lakes and mountains, houses a set of ruins of what has been a great castle, built between the twelfth and thirteenth centuries.

Since 2006 these ruins are the object of study under the responsibility of the Archaeological Superintendence of Trento, represented by Dr. Nicoletta Pisu.
The Arc-Team, a group to which I was built, aims to make the archaeological survey, organization of historical documents and was also tasked to scan the space in three dimensions, as well as rebuild it digitally. It is precisely this last part that comes into my work.

The Reconstruction



Despite my knowledge in architectural modeling, I had never worked with archaeological buildings. The challenge was to get something from nothing. Above we have the floorplan humanized and created from the 3D, but at the beginning of the modeling we did not we had a lot of information and the research for some features of the work would be changing as new references were found.

From Italy the staff of Arc-Team sent me via Dropbox all the data that were collected. Scans made ​​from photographs, notes on the works, the basic floor plans, facades, etc.

For facilitating the work I chose to use Inkscape to align elements scanned with plants and lay the ground for architectural modeling.

With the floorplan and placement of elements, sufficed to raise them in 3D.

I got the curves of the terrain and I converted into a mesh, that receive little by little the castle, so go already adapting all the terrain.
Not leaving some to follow the basic data of floor plans and cuts that I received from Italy.

Texturing was already set, together with the vegetation. When we work with architectural modeling, people expect the fastest possible visual results. Thus, the coloring and mapping of the scene, offer a preview of how it looks, keeping everyone motivated.


Once data arrived and internet modeling progressed, the part of the palace and also courtyard greenery received a modest humanization.

Details such as the configuration of the stairs was widely discussed, so that they represent a strategic tool of defense. In the case of the castle Caldonazzo, according to surveys, they relied on a retractable staircase for access to the tower. Thus, if the castle was invaded, the occupants would have to defend themselves shutting them in the tower. When storing the ladder, they hindered the access of the attackers inside the tower.

During the modeling of the castle courtyard area, was also worked to position the camera to show all the more didactic and elegant way possible.

After a few months of working, the outside of the palace was modeled completely, leaving only a few details to be completed. The main cameras were already positioned and humanization was complete.

The structure was ready, waiting for the footage taken by drones (look at the post about the filming that is very interesting!), to insert the castle virtually, through a technique called camera tracking, where the program captures the displacement of the real camera and transports it to the 3D scene. Thus, over a composite image can be fused real footage + 3D scene.

Some tests crossing photo + 3D scene had already been made​​, as the picture shown above, aiming to work the "color palette" of the real environment.

During the modeling of the outside of the castle, the data were collected and made ​​the refinements of the internal divisions of the building. With a floor plan ready, little by little were being composed indoor environments, both in the setting of furniture when lighting.

Above we have the dining room of the castle. Interestingly, the floor in question is not only of wood. Was placed mortar on the floor, much like the floors we have today, but matte. The wall, in contrast, has coated veneers.

Unlike a modern architectural modeling for internal purposes, such work is done with reference of documentary evidence. The artist does not do what he wants, or even what is more pleasing to the eye. He follows comments from archaeologists, who in their turn were guided by documents, pictures and the excavation of the site.

The kitchen had fairly simple accessories in relation to what we have today.

During the excavations, the staff of Arc-Team found some parts of the plaster wall belonging to the rooftop, where would the dorm. Using a graphic revolution, I created a graphic pattern to adorn the wall of 3D modeling.


The room was then modeled, always according to the observations of archaeologists.

To make viewing a most didactic work, was composed a cut lightweight prospect, covering the largest number of  environments. So we can have a good idea of ​​the building structure, scales and the like.

We also developed a blueprint to serve as the basis of presentation of the site and reconstruction. Always using Inkscape.

Once the footage was taken by drone, the time to cross the actual filmed scene with the scene vitual raised by scanning photogrammetry was reached.

The work is still in its start phase. Because it is a natural hill with irregularity it was a challenge to match the real scene with virtual scene.

Fortunately the process was facilitated by the robustness of tracking and compositing tools natively present in Blender. Above is an image with the scene in 3D view at left and rendered at right.



Now we have two different renderings representing boards. Note that the 3D scene fits the scene in the background, that it is the video.

At the beginning of the post was shown the results of previous studies of tracking. There is still much work ahead, but slowly we can get a good idea of how it was the palace Caldonazzo in its heyday and all done with free and open software.

I hope you enjoyed.

I leave here my thanks to Arc-Team for the opportunity to work with them in this fantastic project. I hope its the first of many. Grazie tante amici!

Bibliography:

Torre dei Sicconi: progetto di ricostruzione e valorizzazione di un antico sito castellare trentino (here in ResearchGate; here in Academia)
BlogItalia - La directory italiana dei blog Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.