• No se han encontrado resultados

FASE # 2: “ conociendo la crónica desde mi vivencia ”

ORGANIZACIÓN Y ANÁLISIS DE LA INFORMACIÓN

5.1.2 FASE # 2: “ conociendo la crónica desde mi vivencia ”

During the segmentation phase, the location of all 6 reference spheres is estimated from each view either manually or automatically. For both manual and automatic segmentation, Geomagic Studio 12 and user-defined functions are used, respectively. The main goal of this step is to separate each semi-sphere from the original 3PI file and then save the remaining files in STL file format, so that the incomplete semi- spheres can be replaced by full sphere data, facilitating further manipulation. These segmented semi-spheres data are used to estimate the center coordinates and radius. Initially, the LS method is used to estimate these parameters and then fine tuning is done using robust iterative M-estimation with the help of the previously mentioned values as the initial guess. After the parameter estimation phase, these estimated values serve the purpose to generate plant only files by removing the semi-spheres data as well as to replace the semi-sphere data with “perfect” full sphere data. 7 STL files in total, 6 semi-sphere files and 1 plant only file (semi-spheres removed), are generated for each view at this phase. Note that the number of semi-sphere files may vary (≤ 6) depending on the visibility of reference spheres in the original 3PI file. These newly generated files are used in the reconstruction phase.

3.1.1.1 Segmentation of Semi-Spheres

This stage is accomplished in two different ways:

1. Manual Segmentation of Semi-Spheres: Manual segmentation of semi- spheres is performed using Geomagic Studio 12. Theoretically, this stage is needed only for the 1st dataset. But in practice, this is performed for all the

first of datasets where the reference spheres are in constant locations, among the 75 datasets, as Yang changed the spheres’ position during the scanning process. For further explanation, we just consider the 1st dataset. Each of the 12 views

(12 3PI files) of the 1stdataset is opened in the “Model Manager” of Geomagic

and semi-spheres are segmented manually one by one using “Selection” tool. While saving these semi-spheres files, the STL file format is used instead of the 3PI format. We use the STL format here as Geomagic Studio does not allow any altered files to be saved in 3PI format, which is native to ShapeGrabber laser scanner. We can alter 3PI files using any editor, of course.

Moreover, Geomagic’s native format, WRP, is a propriety format and not acces- sible to us. Once any file is saved in the WRP format it can not be manipulated afterward (except by Geomagic, of course). Moreover, the STL format is a well known file formate can be saved in either ASCII and binary. We use the STL format is here for both readability and ease of further processing.

2. Automatic Segmentation of Semi-Spheres: Automatic segmentation is performed on each view of datasets 2-75 (the first view of various subranges

of the datasets, where the reference spheres are moved, was first manually seg- mented). Automatic segmentation is accomplished using user-defined function,

Segment Semi Sphere (). To segment the 3D points related to semi-spheres the estimated parameter values from the estimation phase (Section 3.1.1.2) are used. Although this step is explained here, in practice, it comes after the man- ual segmentation and the estimation of the initial center coordinates and radius of the semi-spheres of the 1st datasets were the reference spheres are moved.

Because the position of the reference spheres is assumed to be static during the whole scanning process (but Yang [16] moved them to improve the spheres’ visibility) and so, the position of any semi-sphere in any dataset can be located once the center coordinates and radius of the semi-spheres of the 1st dataset

where reference spheres are moved are computed.

Let us assume that the estimated center coordinates of themthsemi-sphere,m=

1,2, ...,6, of thenthview,n= 1,2, ...,12, of the 1stdataset are (xc

m,n,1, ycm,n,1, zcm,n,1)

and the radius is rm,n,1. Then, for all 3D points, (xi, yi, zi), where

q

(xi−xcm,n,1)2+ (yi−ycm,n,1)2+ (zi−zcm,n,1)2 ≤(rm,n,1+ε), (3.1)

belong to the mth semi-sphere of the nth view of the rest of the datasets (in dataset ranges where the reference spheres have not been moved). In Eq. 3.1, ε= 0.5. is a term used to slightly increase the estimated radius value (so that all sphere points are definitely included in Eq 3.2.

3.1.1.2 Estimation of Parameters (Center Coordinates and Radius of Semi-Spheres)

To estimate the center coordinates and radius, two different approaches are used in this thesis.

1. Estimation of Parameters using LS Method: To estimate the center co- ordinates and the radius of the semi-spheres for data obtained using manual segmentation, LS method is used. The main reasons for selecting this method include ease of designing an efficient error function, simplicity of the method itself and ease in implementation and computation. Moreover, due to manual segmentation, the possibility of having affiliated sphere elements is relatively low.

A user-defined MATLAB function, LS Sphere Fit (), is used to estimate the parameters using the ordinary LS method. This function is a modification of the solution of a sphere fitting problem provided by Ken Garrard, one of the members of MATLAB Central [51]. This function takes the 3D point cloud of

32 sphere as input and returns the estimated center coordinates and radius along with the individual residual as well as the average residual. Eq. 3.2 is used in the implementation because the equation expresses the parameters,a,b,c, and, d, in a linear manner:

x2+y2+z2 +ax+by+cz+d = 0. (3.2)

By solving the system of equations, the estimated values of the center coordi- nates, (xc, yx, zx), and the radius, r, of the sphere are determined from a, b, c,

and, d using Eq. 3.3 and Eq. (3.4), respectively: (xc, yc, zc)≡(− a 2,− b 2,− c 2) (3.3) and r= r a2+b2+c2 4 −d. (3.4)

Note that these estimated values are used as the initial guess for the robust estimation of spheres. The values obtained from this stage are very important as the convergence of the robust estimation depends on a good initial guess as it is an iterative calculation.

2. Estimation of Parameters using Robust Estimation: Because the au- tomatically segmented semi-spheres in later datasets may be introduced with extremely outside data (e.g., the stands used for the reference spheres and part of plant foliage close to the spheres), further refinement is done using a robust technique, namely M-Estimation. Moreover, data can be corrupted with noise during scanning process. The estimated values of center coordinates and radius for the 1st dataset serve as the initial guess for this stage. One of the main

reason (other than the noises introduced during the scanning process) of using M-Estimation is to protect the estimated parameter values from outliers intro- duced due to automatic segmentation. Because if a little non-sphere data close to the sphere is included it can affect the merging stage with wrong position of target spheres.

When implementing M-Estimation, we examined both the Huber and the Bisquare estimators, to draw comparisons between their performances and their accuracy. Important factors related to the implementation of M-Estimators areM axIter, the maximum number of iterations allowed for the estimation,T olF un, the ter- mination tolerance (difference in adjacent residual sum of squares calculations), and T olX, the termination tolerance on the estimated coefficients. During our experiments, we use MATLAB’S built-in function “nlinfit” to implement the Huber and the Bisquare estimators. The values of the aforementioned parame- ters are set to the default values1

.

1

The default values of M axIter, T olF un, and T olX’ is 100, 1e-8, and 1e-8, respectively, in MATLAB.

3.1.1.3 Segmentation of Plant Data

After estimating the center coordinates and the radius for each semi-sphere for all the datasets, these values are used to delete the semi-spheres data from the original 3PI files, generating a file that contains only the plant data.

If the estimated center coordinates and the radius of one of the semi-spheres in a particular view is (xc, yc, zc) and r, respectively, then we delete all the (xi, yi, zi)

satisfying:

p

(xi−xc)2+ (yi−yc)2+ (zi−zc)2 ≤(r+ε) (3.5)

from the 3PI files. Eq. 3.5 is satisfied only for those points lying on or within the surface of a particular sphere with radius r. However, an additional parameter, ε, is used with the radius to ensure the successful removal of all semi-sphere data from the file. If a little non-sphere data close to the sphere is also removed its effect on the merging stage will be negligible. Figure 3.4(a) shows the original image of the 2nd

view of the 12th dataset and Figure 3.4(b) shows the same image after removing the

semi-spheres data.

(a) (b)

Figure 3.4: Segmentation of plant data; (a) the original raw 3PI image of the 2nd

view of the 12th dataset, (b) the same view after removal of the semi-sphere data from

the original image