## 2 Materials and Methods
### QR Code Microrobot Selection  
Pipes, ventilation ducts, crawl spaces, and other infrastructure with confined spaces are challenging to monitor and inspect. AR algorithms use image features, known as anchors, to ensure that objects appear to remain in the same position and orientation in space. Using markers such as QR codes or checkerboards as anchors is a viable method of enabling AR devices with limited processing power to quickly overlay detected 3D models in the real world with respect to the anchors. This requires embedding microcomputers in the network with the ability to detect, locate, and read QR codes.  
QR codes are printed patterns which convey information through cameras that read and decode the image. In this application, as the microrobots largely maneuver in confined spaces not visible to the operator, QR codes are placed in convenient locations providing versatile transmitters of information. They can either be used for robot or sensor selection via the URL containing the local network IP address or offering the repair instruction via self-contained information. The built-in QR code detection in HoloLens has range limitations which prevent it from being effectively used in our microrobot selection prototype. Therefore, to address this issue, a custom QR code detection algorithm was designed to access information from the microrobots, Raspberry Pi, and other target devices via the URL of the local network. The core of this QR code detection is Harris corner detection [45], which can be described as  
\[E(u,v)=\sum_{x,y}w(x,y)[(I(x+u,y+v)-I(x,y))^{2}] \tag{2}\]  
where \(E(u,v)\) represents the second moment matrix of image gradients at a specific pixel location \((u,v)\). \(w(x,y)\) is a window function that is applied to a group of pixels surrounding a specific pixel in an image. \(I(x+u,y+v)\) is shift intensity, while \(I(x,y)\) is intensity.  
The window function weighs each pixel in the group based on the distance from the center pixel. The purpose of the window function is to ensure that the response function used in the Harris corner detection is sensitive to small variations in image intensity and to diminish the effects of noise and other artifacts. This QR code detection application uses the Gaussian window function. It assigns greater weight to pixels that are closer to the central pixel and less weight to pixels that are farther away.  
Shift intensity quantifies the variation in pixel intensity that takes place when a pixel is moved in a particular direction. In this case, intensity refers to the brightness and darkness level of a pixel in an image. Equation (2) measures the intensity of the image within small windows surrounding each pixel. Shifting two windows in a specified direction and then calculating the difference between the intensity of the two windows produces the shift intensity. For nearly constant patches, \(E(u,v)\) is zero. For very distinctive patches, the \(E(u,v)\) is larger. In a QR code image, Equation (2) provides a suitable metric to pick patches with large \(E(u,v)\).  
The Harris detection kernel, which finds pixels with large local neighborhood intensity gradients, can detect checkerboard patterns. The Harris kernel computes the gradient of each pixel to locate corners. If more than one QR code appears in the raw image, K-Means can group point clusters. Noise cancellation operates at the same time as Harris corner detection. In Figure 6b, the corners on the QR codes are successfully detected and outlined with red indicators.  
The Harris corner detector can easily extract the corners shown in the Figure 6a, due to the large gradient between black and white pixels, as shown in Figure 6b. After corner detection, Principal Component Analysis (PCA) can extract the point clusters, which are QR codes [46]. Finally, the application of geometric transformations and decoding determines the QR code information.