## 2 Developed 3-D Profilometry Using Dual Sensing
### Measuring Principle
#### 2.2.3 Dual Camera Mapping  
To achieve precise mapping and calibration, an automatic and accurate mapping algorithm was developed to align the two cameras into the same FOV on the measured object. Figure 6 illustrates the proposed idea of dual camera mapping using random speckles. When mapping images captured by the two cameras, a unique speckle pattern is used and a cross-correlation algorithm is employed to compute the corresponding coefficient. In this study, the following normalized cross-correlation (NCC) algorithm is employed to compute the correlation between images captured by the two cameras.  
\[R(x,y)=\frac{\sum_{x^{\prime}y^{\prime}}\left(T(x^{\prime},y^{\prime}).I^{ \prime}(x+x^{\prime},y+y^{\prime})\right)}{\sqrt{\sum_{x^{\prime},y^{\prime}}T (x^{\prime},y^{\prime})^{2}.\sum_{x^{\prime},y^{\prime}}I^{\prime}(x+x^{\prime },y+y^{\prime})^{2}}} \tag{4}\]  
where:  
\[I^{\prime}(x+x^{\prime},y+y^{\prime})=I(x+x^{\prime},y+y^{\prime})-\frac{1}{w.h}.\sum_{x^{\prime\prime},y^{\prime\prime}}I^{\prime}(x+x^{\prime\prime},y+y ^{\prime\prime})\]  
Figure 5: Flowchart of the proposed calibration procedure.  
The correlation value ranges from 0.0 to 1.0. The matching score of 1.0 means 100% matching between sub-image and template image. To ensure that the dual camera mapping technique worked well, a correlation threshold is needed to estimate the matching score. It is also important to note that the sub-image size is set to be large enough to retain the accuracy of the matching process. When the sub-image size is too small, the robustness of the correlation technique cannot be assured. In practice, the sub-image size is chosen as a quarter of the captured FOV to achieve good matching and reasonable computation efficiency. To achieve precise image mapping between the two images, a random speckle pattern can be prepared and employed by projecting uniform blue light on an electrostatic-coating aluminum surface with micro random patterns on it. The unique and random speckle pattern can provide accurate image registration for image mapping. Figure 7 shows the aluminum surface target designed and one of the speckle images prepared for image registration.  
Figure 8 shows the flowchart of the proposed dual camera mapping technique. One sub-image (a quarter of captured image) of the vertical camera is cropped in the image center and selected as a template image. The matching score between the tilted image and template image (vertical camera) is determined using the NCC algorithm. The shifted value between the template image and that captured by the tilted camera can be calculated along the X and Y directions of image coordinates. This parameter can accurately represent the spatial location difference between the FOV of the tilted and the vertical cameras. This process is repeated until the parameter converged to a preset threshold for completion.  
Figure 6: Proposed idea of dual camera mapping using random speckles.  
Figure 7: Calibration target design for dual camera image mapping: (**a**) white painted aluminum target; (**b**) captured speckle image using the vertical camera.