# An Effective Motion-Tracking Scheme for Machine-Learning Applications in Noisy Videos
## 3 Proposed Scheme
### Modified Simplest Color Balance (SCB) Algorithm  
The features of the SCB algorithm are as follows. SCB designates the upper and lower value ranges of pixels in the image, and then replaces the pixels within the range with the minimum and maximum available pixel values. When an image is expressed in R, G, and B, 0 and 255 are designated as the lower and upper values, respectively, by using an unsigned 8-bit representation format. After that, the image quality, including the color balance, is improved by normalizing the histogram of the pixel values that do not belong to the lower and upper ranges within the given value scale as much as possible [21]. In addition to these features, one assumption was made. In order to apply SCB to a specific frame image extracted from a video, three matrices consisting of values between 0 and 255 and three channels of red, green, and blue based on the three primary colors of light were used. When using these, if the values present in each channel were expressed in one image, the closer to 255, the closer to white, and the assumption that other darkly expressed parts have ambiguous values must be applied. According to the preceding prerequisite, the images we used for testing were microscope images that provided a very suitable environment for applying the SCB algorithm. However, if the SCB algorithm is applied in its original form, as shown in Figure 1, even though a single channel is output, the histogram range is very wide and it can be seen that it is difficult to specify the background and object. Therefore, the SCB algorithm applied to our proposed method replaced only the values of a specific low range at once. In conclusion, the algorithm was modified so as not to perform calculations on bright parts. In Figure 1, \(N\) represents the ratio of the lower and upper regions of the histogram as a percentage. The details of the modified algorithm are as follows. When the lowest value among the pixel values of the image is expressed as P\({}_{[\text{min}]}\), the values of P\({}_{[\text{min}]}\) to \(N\%\) or less, which are ambiguously expressed internal regions of the object, are determined as 0. To achieve this, the values of the two-dimensional matrix representing the image are converted into a one-dimensional vector arranged in ascending order by allowing duplicates. In this case, vectors are created for each channel. After that, in order to process P\({}_{[\text{min}]}\) values lower than the \(N\%\) of a random value selected by the user as the inner area of the object, the mask matrix that stores true for values lower than P\({}_{[\text{min}]}\) and false otherwise is used to determine the places that are true. The logic is executed to change to P\({}_{[\text{min}]}\). Finally, a normalized image is obtained using the normalize function, and the normalization range is limited from 0 to P\({}_{[\text{avg}]}\). P\({}_{[\text{avg}]}\) means the average value of the image histogram. The reason for doing this is that the object we are interested in has already been set to 0 by using the mask matrix, and only the low-density part or background remains in the rest of the object. That is, the background is compressed as much as possible by using P\({}_{[\text{avg}]}\), which occupies the greatest value in the background, and the histogram of the background is unified as much as possible based on this. This is to make it advantageous for the next step, image binarization operation. The pseudo code of the modified SCB is presented in Algorithm 1. Figure 1: Single-channel histogram graphs without modification of the SCB algorithm; \(N=10\): (**A**) four microscopy image samples; (**B**) Histograms corresponding to each image sample. ```
\(percent=10\)//bottom10% in histogram \(half\_percent=percent/200.0\)//doublescalefor subdivision, \(1/100\)->\(1/200\)Red, Green, Blue = Split and save the RGB channels of the image // The logic below operates once in each of the Red, Green, and Blue channels.