## 2 Materials and Methods
### Image Processing for Calculating 3D Surface Coordinates
The cv2.stereoBM and cv2.stereoSGBM functions demonstrate suboptimal accuracy and precision, rendering them unsuitable for scanning close objects in demanding applications. The utilization of laser pattern projection has been proposed within the device under evaluation to obtain a shared visual feature (projected laser pattern) within a stereo image pair at the requisite quality level. The rectified and thresholded binary images employed in this study necessitated the development of a custom program function to leverage the laser pattern, thereby facilitating the acquisition of higher quality data. To address these challenges, a custom program function was designed. Initially, the baseline is calculated as the distance between the cameras based on the transformation vector T. Subsequently, the focal length is calculated as the average of the focal lengths of the two cameras. Subsequent to this initial step, it is imperative to identify and extract the non-zero values within the images, a process that necessitates the implementation of a thresholding technique. Thereafter, an order of values is established, wherein the 3D coordinate points are to be stored. Subsequently, for each point in the first image, a corresponding point in the second image is located in the non-zero points in the same pixel row. The rectification of the images, the identification of their epipolar lines, and the subsequent alignment of the rows of pixels are utilized to calculate the disparity within them. Consequently, the fundamental formula for calculating depth based on disparity is employed. This formula is then utilized to calculate the X and Y coordinates. The resultant coordinates are then appended to the array points_3D. The program's primary function involves the invocation of previously defined functions, which are then executed in a sequential manner. Initially, web links are obtained to access the ESP32-CAM devices. The number of squares in the calibration pattern is selected, and the image acquisition queues for calibration are created. Subsequently, the user confirms the opening of the image windows for calibration. It is imperative to emphasize that within the calibration process, but this also pertains to other components of the program, the active window with one of the camera images is selected by clicking. Otherwise, the program fails to obtain input from the keyboard. Once a sufficient number of images of the calibration pattern have been acquired, calibration of the device is performed after confirmation by the user. Following the completion of calibration, it is essential to physically move the device to the designated location and orient it appropriately, especially in hard-to-reach areas. Subsequent to the aforementioned orientation, the laser projector is to be activated, and the confirmation of activation is to be made by pressing any key. The initial image pair is then captured, including the laser image projected onto the target. Subsequent to the imaging process, a thresholding operation is performed, and the binary image windows are opened after thresholding with the initial values. The user can adjust the threshold value by pressing the \"\(+\)\" and \"\(-\)\" buttons, which in turn adjusts the binary image according to the current threshold value. If the user is satisfied with the selected thresholding, they confirm it. Then, they click on the camera image from the calibration to activate it and continue to perform the scan. Subsequently, a scan is performed, with the user changing the position of the laser projector in between to cover the necessary part of the surface of the object to be scanned. Following calibration, while maintaining the device in a fixed position during scanning, the user can adjust the position of the laser projector. Any displacement of the device or cameras will result in a reduction in the accuracy, precision, and quality of the acquired surface point cloud. The resulting point cloud would then be shifted by the value of the device displacement.