## 3 Materials and Methods
### Main Algorithms Used
#### 3.2.2 GMM  
Background Subtraction  
During the auto-scanning process, the robotic arm picks up the item, scans it, and adds it to the cart. The existence of a new item in the cart is detected by GMM and other algorithms applied to the scene of the cart, before and after adding the item.  
Background subtraction is a technique for detecting all moving objects (foreground) in a video stream by creating a background model, which is a representation of the scene. This background model is then compared to the input frame, and any significant difference in an image region from the background model indicate the presence of a moving item. Multiple algorithms have been proposed for background subtraction, such as Gaussian mixture model (GMM) and the kernel density estimator (KDE), over the years [19]. In GMM, each pixel value is modeled as a mixture of Gaussians. A pixel from a new image is considered to be a background pixel if its new value is well described by its background density function. Otherwise, the pixel is classified as foreground. The algorithm starts by initializing the number of distributions for every pixel location in a frame to model a dynamic background that can withhold enough data about the structure of the background. For a pixel to belong to one of the distributions, it should satisfy the condition in Equation (3), where \(X_{t}\) is the pixel value at frame \(t\), \(\mu_{k,t}\) and \(\sigma_{k,t}\) is the mean and standard deviation of distribution \(k\), and factor \(K_{p}\) is selected to be 2.5. If the condition is satisfied for a distribution \(k\), the parameters of the distribution are updated, using (Equations (4)-(6)). Where \(\alpha\) is the learning rate, which \(1/\alpha\) corresponds to the speed at which the model parameters are updated with a value of 0.005, \(\rho\) is computed using Equation (7); \((M_{k,t})\) is 1 when the condition is satisfied and 0 otherwise. After processing each frame of t, the distributions of each pixel are sorted by the ratio of \(\frac{\omega}{\rho}\). If none of the distributions have satisfied the condition, the lowest distribution in the sorted list is replaced by a new distribution initialized with the same parameters as before.  
\[||X_{t}-\mu_{k,t}||\leq K_{p}\times\sigma_{k,t} \tag{3}\]  
\[\omega_{k,t}=(1-\alpha)\omega_{k,t-1}+\alpha(M_{k,t}) \tag{4}\]  
\[\mu_{k,t}=(1-\rho)\mu_{k,t-1}+\rho(X_{t}) \tag{5}\]  
\[\sigma_{k,t}^{2}=(1-\rho)\sigma_{k,t-1}^{2}+\rho(X_{t}-\mu_{t})^{2} \tag{6}\]  
\[\rho=\alpha\eta(X_{t}|\mu_{k},\sigma_{k}) \tag{7}\]  
After all of the training frames have been processed, the background model is built using the smallest number \(b\) of distributions that will fulfill the requirement stated in Equation (8). \(T\) describes how dynamic the model can be. After obtaining the background model, background subtraction is carried out with the successive upcoming frames to obtain the foreground segment. As the process progresses with foreground detection, the model is updated to reflect the changing structure of the background, resulting in a reliable approach for detecting moving objects.  
\[B=argmin_{b}(\sum_{k=1}^{b}\omega_{k}>T) \tag{8}\]