# Pierrerue tutorial

## Description

This dataset allow you to process a georeferenced orthophoto from a front. This dataset was acquired by student of ENSG during their summer internship in Forcalquier. They have use targets surveyed with total station.

You can find this dataset at http://micmac.ensg.eu/data/pierrerue_dataset.zip
Once you have downloaded it, you have to unzip the ".zip" archive.

## Presentation

Pierrerue Chapel
• 31 JPG images
• 1 file containing the support points (Pierrerue.xml)
• We will use the folder 001_Elements-de-georeferencement

The shooting contain 31 images, taken with the Sony alpha850 with a 244mm lens. Check that the folder contains images recovering :

Support points are available and allows to georeference the readings (see the folder 001_Elements-de-georeferencement).

## Tutorial

### Set up the images

#### Tie-Points search

All the images should be set up simultaneously, in order that the georeference process will be expressed into one only cordinate system. First, we can run the tie-points search :
mm3d Tapioca MulScale ".*JPG" 600 2000

#### Internal orientation and relative orientation

Then, we have to define the settings of the camera used from the images covering the corner between the 2 facades (more suitable than the others, because of the depth).
mm3d Tapas RadialStd "angle.*JPG" Out=Calib24mm
Into the command prompt, we can check if the residual from the images is admissible (around the half pixel). We can check also the number of connection points, aswell as the percentage of points keeped ("99.8258 of 28466" : 99.8% of the connection points kept from 38466 points calculated). We can process yet the setting up of all the images. starting from the camera we calculated before.
mm3d Tapas RadialStd ".*JPG" InCal=Calib24mm Out=MEP
Into the command prompt, we can control residual during the process. At the last step, we can see that the image residual are, for all the images, less than a half-pixel. We control also the number of support points, aswell that the percentage of points keeped ("99.8258 of 38466" : 99.8% of the support points keeped from the 38466 points calculated).

#### Visualization of relative orientation

The AperiCloud command allows to generate 3D clouds, containing all the support points obtained with Tapioca, and the position of the cameras obtained from the Tapas output.

Meshlab visualization
mm3d AperiCloud ".*JPG" MEP
The result of this command can be seen for example with the meshlab software.

### Set up the images into the coordinates system of the support points

Now we have to measure the support points available to georeference the images, and so the incoming products, into the reference coordinate system.

#### Explaining the process

• 1. We measure 3 support points well distributed (SaisieAppuisInit command) ;
• 2. We can now create a 3D similarity (transformation from 7 settings containing one scale coefficient, one translation into space and one space rotation) between the arbitary system calculated while the setting up and the coordinate system chosen (GCPBascule command) ;
• 3. We have now to measure the remaining points : the absolute orientation calculated from the previous step, allows to suggest an approximated position for each points (SaisieAppuisPredic command) ;
• 4. We affine the absolute orientation (GCPBascule command) ;
• 5. We start the final computation for the setting up (this offset allows to find the best position/orientation of the cameras while using the points measurements on the linking points and on the support points) ; (Campari command).

#### Measurement process

• 1. Measurements of almost 3 support points on the facade n°1 (At least one point should be measured to be valid on at least two images). To set the points, you need to get to know the the position of the 3 points thanks to the folder 001_Elements-de-georeferencement.
mm3d SaisieAppuisInitQT "facade1DSC0589[8|9].JPG" MEP 1001 MesureFacade.xml
To validate two other support points (on two images each) :
mm3d SaisieAppuisInitQT "facade1DSC0588[3|5].JPG" MEP 1002 MesureFacade.xml
mm3d SaisieAppuisInitQT "facade1DSC0589[3|6].JPG" MEP 1121 MesureFacade.xml
• 2. Computation of the 3D similarity (absolute orientation)
mm3d GCPBascule ".*JPG" MEP MEP-Basc Pierrerue.xml MesureFacade-S2D.xml
• 3. Measurement of all available points :
mm3d SaisieAppuisPredicQT "facade.*JPG" MEP-Basc Pierrerue.xml MesureFacade-Final.xml
We must now validate the points left.
• 4. Update computation of the absolute orientation.

This time, we need all the support points to calclulate the 3D similarity of the absolute orientation.

mm3d GCPBascule ".*JPG" MEP MEP-Basc2 Pierrerue.xml MesureFacade-Final-S2D.xml
mm3d Campari ".*JPG" MEP-Basc2 MEP-Terrain GCP=[Pierrerue.xml,0.02,MesureFacade-Final-S2D.xml,0.5]

This computation adjustement use to find the best position/orientation of the cameras when the shooting was made assuming that the support points have a 0.02m accuracy, and the linking points have a 0.5 pixel accuracy. This values allows to ponderate the measurements. It suits, at the end of the process, to control the residues on the support points and on the images residuals. The residual images look like this :

| |  RESIDU LIAISON MOYENS = 0.547721 pour Id_Pastis_Hom Evol, Moy=2.38308e-07 ,Max=0.00295916

### 3D Reconstruction

As we did for the Fountain exercise, we have to do the 3D reconstruction with the image geometry with the C3DC tools. First, we have to limit the reconstruction area. To process it, we have to create a mask on the cloud points (AperiCloud), that we have to recalculate in the new set up.
mm3d AperiCloud ".*JPG" MEP-Terrain
To limit the computation area, we will create a 3D mask :
mm3d SaisieMasqQT AperiCloud_MEP-Terrain.ply
Once the mask is created, we can launch the 3D reconstruction :
mm3d C3DC MicMac "facade.*JPG" MEP-Terrain Masq3D=AperiCloud_MEP-Terrain.ply Out=C3DC_MicMac_Pierrerue.ply

The C3DC_MicMac_Pierrerue.ply file can be open with Meshlab.

### Orthorectification

To realize orthorectifications of the Pierrerue facade, we have to define a temporary landmark for each facade, where the Z axis will be perpendicular to the facade. In the first time, we will work on facade n°1. We processing it in 2 steps :

mm3d SaisieMasqQT facade1DSC05893.JPG Attr=Facade1
2. Computation of a local landmark where the Z axis is perpendicular and going through the support points included into the masks :
mm3d RepLocBascule "facade1.*JPG" Ori-MEP-Terrain HOR Repere-Facade1.xml PostPlan=_MasqFacade1

The HOR setting show that for the Ox axis of our orthoimage, we use the horizontal of our worksite. It can be done here, because the set up MEP-Terrain was obtained from support points. The orthoimage will be calculated from new landmark. It is necessary here to reproject the 3D reconstruction process into this new landmark. Normally, a depthmap will be calculated into the orthorectification map : it's about an image applied on the object, where the pixels show the distance from map. We describe it as 2.5D (3D information isn't available only for a finite number of positions).

The PIMs2MNT command allows to create a depth map into the map of the facade n°1 (the one calculated before : Repere-Facade1.xml) :

mm3d Pims2MNT MicMac DoOrtho=1 Repere=Repere-Facade1.xml Pat="facade1.*JPG"

The correlation map resulting, calculated into the facade n°1, can be found into the folder PIMs-TmpBasc with the name PIMs-Merged_Correl.tif. This file contains the correlation results : white is corresponding to a very good correlation scores ; more the grey is dark, less the matching process went well.

Once the depth map processed, MicMac compute into the PIMs-ORTHO repertory the orthoimages for each image, aswell as incidence pictures, with the angle between the facade and the perspective ray (images Incid_facade1DSC###.tif) and images with hidden parts, that show in white the hidden parts into the image (imgaes PC_facade1DSC###.tif).

Pierrerue Chapel

After the calculation, each orthoimages should be mosaiced. The choice of the image to use for each pixel is done with these specificity : no hidden parts, best angle of attack, continuity in the choice of images :

mm3d Tawny PIMs-ORTHO/

The result is an image created into PIMs-ORTHO folder, called Orthophotomosaic.tif. Metadatas associated are available into the file Orthophotomosaic.tfw. We can see the resolution chosen for the orthoimage computation here (1.1mm).

Meshlab visualization

We can now create a faded image relief, this image allows to evaluate the quality of the reconstruction, especially in detecting the noise existing on the reconstructed surface.

mm3d GrShade PIMs-TmpBasc/PIMs-Merged_Prof.tif ModeOmbre=IgnE Mask=PIMs-TmpBasc/PIMs-Merged_Masq.tif Out=Facade1_Shade.tif

Another product can be created, it's an colorized image into the facade depth (each colour is corresponding to a scale of depth) :

mm3d to8Bits PIMs-TmpBasc/PIMs-Merged_Prof.tif Coul=1 Circ=1 Mask=PIMs-TmpBasc/PIMs-Merged_Masq.tif Out=Facade1_8Bits.tif

mm3d Nuage2Ply PIMs-TmpBasc/PIMs-Merged.xml Attr=PIMs-ORTHO/Orthophotomosaic.tif Out=Facade1.ply