## 2 Materials and Methods
The sub-images were then converted to greyscale images and aligned with their corresponding reference sub-images using a homography algorithm [13] to match both sub-images over each other and eliminate any misalignments or offsets between the reference and sample sub-images based on  
Figure 4: Defects (disconnections) in some of the resistance lines; from left to right: dotted gap, wide gap, and narrow gap disconnections. Figure 5: Different stages involved in the ADR algorithm. Equations (1) and (2). As all the images taken by the camera were placed over a fixed position before capturing, the alignment algorithm had to implement a minor adjustment. \[H= \begin{bmatrix}h_{00}&h_{01}&h_{02}\\ h_{10}&h_{11}&h_{12}\\ h_{20}&h_{21}&h_{22}\end{bmatrix}  \tag{1}\]  
If \(H\) is a \(3\times 3\) matrix of a homography and the first set of corresponding points (\(x_{1}\), \(y_{1}\)) are considered in the first image and (\(x_{2}\), \(y_{2}\)) in the second image, then the homography \(H\) will be as follows:  
\[H= \begin{bmatrix}x_{1}\\ y_{1}\\ 1\end{bmatrix} =H \begin{bmatrix}x_{2}\\ y_{2}\\ 1\end{bmatrix} = \begin{bmatrix}h_{00}&h_{01}&h_{02}\\ h_{10}&h_{11}&h_{12}\\ h_{20}&h_{21}&h_{22}\end{bmatrix}\begin{bmatrix}x_{2}\\ y_{2}\\ 1\end{bmatrix}  \tag{2}\]  
Once the sub-images were aligned, the next step was to convert the image into a binary image (Figure 6) to make it ready as a suitable input for the defect detection algorithm. The next phase of the testing was to check the quality of the sample's sub-image in comparison to the reference image. To do this, the sub-images from the reference image were subtracted from the sub-images produced from the results of the alignment stage of the process. The remainder of this arithmetic calculation showed the difference between the reference image and the sample images, hence defining the quality (closeness to the reference) of the sample images. The algorithm gives a score in percentage on the quality of the sample image print by calculating the number of pixel differences from the reference image. The higher the presence of differential pixels, the lower the score the algorithm would give, where 100% is considered to be a perfect sample with zero differential pixels. For the defect detection algorithm, the authors of this paper implemented a connected-component labelling (CCL) algorithm using the classical algorithm to detect connected regions in binary digital images [14]. To eliminate the remaining noise, a morphological operation (erosion) was applied before passing the image to the next step. Once each connected component was defined and labelled, the algorithm passed through the image for a blob detection test controlled by parameters such as size, color, and shape, where the shape's parameters consisted of three parameters including inertia, convexity, and circularity. The algorithm iterates through every connected component to see how many blobs the component contains in an iterative process. The idea is to check whether each component has either one or two blobs in it (represented by red dots in Figure 5). If it has two blobs, that means that each end is connected to the other, hence the presence of a single component. Similarly, if it contains a single blob, that means that somewhere alongside the line, we have a disconnection (see Figure 7).