## 4 Description of the Proposed 3D Underwater Shape Reconstruction System
### Laser Spot Detection and Extraction Algorithm  
The RGB images, acquired from each catadioptric system, present the inputs of the laser spot extraction block. The proposed algorithm aims to detect regions of green-laser projections in order to extract their image positions. In order to achieve good detection accuracy, different methods were tested on our images in order to define the adequate algorithm. The green-colored laser spots, used in our vision system, are analyzed through their projection on the image. Experiments show that the color of the laser spot detected by camera is not only green; its center is very bright (\(200\leq\) (\(R\), \(G\), \(B\)) \(\leq\) 255).  
Figure 3: Flowchart of the proposed 3D reconstruction algorithm.  
Therefore, multiple tests were done in different lighting conditions in order to analyze the laser projection and define the expression that permits to highlight the laser spots in the image. For the extraction of the 2D coordinates of the laser projection, we proceed first with a color-based binarisation of the RGB image. Expression (2) permits to highlight pixels of which the green component value \"\(G\)\" is more important than the red \"\(R\)\" and the blue \"\(B\)\" ones.  
\[\left\{\begin{array}{l}if((G>00)\text{ and }(2 xG-R-B>70))\text{ or }((G>110)\text{ and }(2 xG-R-B>120))\\ \text{ }pixel=1;\\ else\\ pixel=0;\end{array}\right\} \tag{2}\]  
Because of water physical properties, a laser beam can undergo non-useful reflections before reaching the object. The RGB image contains green-colored pixels that represent correct and useful laser spot projections and some wrong projections caused by reflections of laser beams when encountering reflecting surfaces such as the plexi waterproof tank (Figure 4a). In order to eliminate these projections, that could mistake the shape reconstruction, we propose to filter them using geometric considerations. Based on multiple experiments, we noted that:  
(1) laser projections that are not located inside the mirror projection are considered false ones;  
(2) laser projections that do not belong to the predefined regions of interest are considered as wrong projections that should be detected and transformed into black-colored pixels;  
(3) if there is multiple projection of the same laser beam on the same direction, the farthest cloud points is the real projection since it represents the extremity of the laser beam when encountering an object. In contrast, all along the laser trajectory, existing small cloud of points are those of unnecessary reflections which will be eliminated later.  
For that, Cartesian coordinates of each white pixel are determined and corresponding polar coordinates (\(r\), \(\theta\)) are calculated. Eliminated pixels are those that have a ray \"\(r\)\" > \"Rmirror\" and of whose angle of inclination \"\(\theta\),\" do not belong to predefined regions \"\(\theta\)\(\pm\)\(\Delta\theta\)\" where \"\(\theta\)\" belongs to the predefined set (Figure 4b). If there are multiple cloud points in the same region, the one who is characterized by the bigger ray is considered.  
For the extraction of the gravity center of a cloud of points, we determine the average value of all pixels belonging to the line crossing the cloud of points and defined through its inclination with respect to the horizontal (Equation (3)) in which \(C\) represents the number of the image column, \(p(x_{i},y_{i})\) represents the pixel coordinates of each point belonging to the line and \(c(x_{c},y_{c})\) is its center and \(n\) represents the number of points.  
\[\left\{\begin{array}{l}x_{c}=\frac{\max\{p(x_{i},y_{i})_{i=1,2}\}-\min\{p(x_ {i},y_{i})_{i=1,2}\}}{2}/C\\ y_{c}=\frac{\max\{p(x_{i},y_{i})_{i=1,2}\}-\min\{p(x_{i},y_{i})_{i=1,2}\}}{-(x_ {c}\times C)}\end{array}\right. \tag{3}\]  
Figure 4: Result of laser spot extraction process: (**a**) RGB image; (**b**) Region-based image classification.