## 2 Extreme Learning Machine (ELM)-Based Moving Cast Shadow Detection
### Post-Processing  
In the process of classification, misclassification may commonly occur. Specifically, the shadows may be detected as objects incorrectly, and the objects may be misclassified as shadows. Figure 2 shows the shadow detection results of some frames in different scenes.  
(1) Size discrimination of candidate moving shadows and moving objects  
Generally, the candidate moving shadow consists of shadow regions classified correctly and some small object blobs classified incorrectly, as well as the candidate moving objects shown in Figure 2c. To remove the misclassified blobs, we first utilize a connected component labelling algorithm to mark candidate moving shadows and moving objects respectively, in order to generate different labelled sub-regions. Then, a size filter is performed to redress small misclassified blobs. Take the candidate moving shadows as an example, we expound the operation in detail.  
For a candidate moving shadow mask \(M^{S}\), a connected component algorithm is performed, then a series of connected regions are generated:  
\[M^{S}=\{R_{1},R_{2},\cdots,R_{n}\},i=1,2,\ldots,n \tag{17}\]  
where \(R_{i}\) is the \(i\)th connected sub-region and \(n\) is the number of sub-regions.  
Figure 2: Shadow detection results of some frames in different scenes. (**a**) original frames; (**b**) groundtruths; (**c**) classification results. The shadows are marked with red and objects are marked with green; (**d**) final results after post-processing.  
Next, the sub-regions in the set \(M^{S}\) are sorted in terms of their sizes and the sub-regions have small sizes will be filtered and recognized as object regions.  
\[R_{i}\in\left\{\begin{array}{ll}shadow&Num(R_{i})<\alpha\cdot num\\ object&otherwise\end{array}\right. \tag{18}\]  
where \(Num(R_{i})\) denote the number of pixels in the sub-region \(R_{i}\). \(num\) is the number of pixels in the maximum sub-region, and \(\alpha\) is an empirical threshold, \(\alpha\in[0,0.2]\). Likewise, the same operations are performed on the candidate moving object \(M^{o}\).  
(2) Border discrimination of candidate moving shadows  
In practice, the true shadow pixels will occur at the edges of blobs. In other words, if a part of a moving object is misclassified as a shadow, most of the boundary of this region will be located inside the candidate moving object, as displayed in Figure 2c. Similarly, if a shadow candidate is a true shadow, then more than half of the boundary should be adjacent to the boundary of moving objects. Therefore, the boundary information of the candidate shadow region can be helpfully exploited to determine whether the region is a shadow or not. First, the candidate moving objects and moving shadows are segmented by the sobel edge algorithm. Then, a connected component labelling algorithm is also performed to mark each region and compute the edge of the region. For one candidate shadow region, the number of all boundary shadow pixels \(N_{s}\) and the number of boundary shadow pixels \(N_{o}\) which are adjacent to the boundary of a candidate moving object region are obtained, respectively. Consequently, we can determine the candidate region to a shadow according to the following rule:  
\[R_{i}\in\left\{\begin{array}{ll}shadow&\frac{N_{o}}{N_{s}}>0.5\\ object&otherwise\end{array}\right. \tag{19}\]  
The results after post-processing are given in Figure 2d. Obviously, the post processing can refine shadow detection results and play a very important role in correcting misclassification results.