# Distributed Visual Crowdsensing Framework for Area Coverage in Resource Constrained Environments
## 3 Methodology
### Data Redundancy Elimination
#### 3.3.1 Local Data Management  
Each sensor node manages the local information of the existing set of photos using the proposed clustering scheme. Each node creates two local trees as follows:  
1. Local K-CoverPicTree: The initial local K-CoverPicTree is produced with the application of Algorithm 2. This tree is used in the classification and clustering of the existing set of photos within the local storage of each sensor. 2. Local Boolean K-CoverPicTree: Prior to the addition of photos to the local K-CoverPicTree, the added value of each photo is examined by each sensor with the application of the local Boolean K-CoverPicTree. Within this tree, the index of each node comprises the sub-region ID, BoI ID, and sector ID. Each node in the local Boolean K-CoverPicTree carries the value of 0 or 1, where 0 means no photo covering a specific sequence of (\(s\), \(b\), \(k\)) while 1 denotes the existence of a photo covering a specific sequence of (\(s\), \(b\), \(k\)). All nodes are initialized with the value of 0. If the local K-CoverPicTree has a child photo for Node(\(s\), \(b\), \(k\)), then the value of the corresponding Boolean K-CoverPicTree node, \(\text{Bool\_Node}(s,\,b,\,k)\), will change from 0 to 1. Algorithm 3 shows how the added value for each photo is computed. ```
1: Extract the metadata of the photo
2: Extract the sequence of coverage features values (\(s,\,b,\,k\)) of the photo
3:Added value = 0;
4:for each coverage sequence (\(s,\,b,\,k\)) in the local Boolean K-CoverPicTree do
5:if\(\text{Bool\_Node}(s,\,b,\,k)=0\)then
6: Added value = Added value + 1
7:endif
8:endfor
```  
**Algorithm 3** Counting the added value of a photo  
The application of the Boolean K-CoverPicTree begins with the examination of the added value of each photo prior to adding the photo to the local K-CoverPicTree. A photo is added to the local K-CoverPicTree when its added value is greater than zero. However, if the newly generated photo has an added value of zero, then each sensor will search within its local K-CoverPicTree and check whether there exists a photo with the same features of coverage values (sub-region ID, Bol ID, and sector ID) or whether the coverage features of the photo entails a sub-set of the coverage features of the existing photos. In this case, the sensor will exclude the photo and consider it redundant. On the other hand, if there is no other photo with the same features of coverage values or sub-set of the features of coverage values, the sensor will add the photo to the local K-CoverPicTree with the respective node index. As an example, suppose that photo \(a\) covers the sequences (\(s=1,\,b=1,\,k=1\)), (\(s=1,\,b=2,\,k=1\)) and (\(s=1,\,b=3,\,k=1\)). In addition, photo \(b\), which resides within the local K-CoverPicTree, covers the sequences (\(s=1,\,b=1,\,k=1\)), (\(s=1,\,b=2,\,k=1\)), (\(s=1,\,b=3\), \(k=1\)) and (\(s=1,\,b=4,\,k=1\)). It can be stated that photo \(a\) is redundant in relation to photo \(b\). This owes to the fact that the sequences (\(1,\,1\)), (\(1,\,2,\,1\)) and (\(1,\,3,\,1\)) are subset of (\(1,\,1,\,1\)), (\(1,\,2,\,1\)), (\(1,\,3,\,1\)), and (\(1,\,4,\,1\)). To demonstrate the advantages of the local trees, suppose that a new photo is created on the sensor each time. Figure 3(a) shows the local K-CoverPicTree after adding four photos (\(a,\,b,\,c,\,and\,\,d\)). Here, Algorithm 2 is applied to form the initial local K-CoverPicTree and the initial local Boolean K-CoverPicTree is generated. The details are as follows:  
1. A newly produced photo with ID = \(a\) (photo \(a\)) has the following coverage values sequence: (\(s=1,\,b=1,\,k=1\)), (\(s=1,\,b=2,\,k=1\)), and (\(s=1,\,b=3,\,k=1\)). In this regard, utilizing Algorithm 3, the added value of photo \(a\) is 4. As the added value of the photo is higher than 0, the photo is appended to the local K-CoverPicTree. This is followed by the update of the value of the local Boolean K-CoverPicTree nodes (\(1,\,1,\,1\)), (\(1,\,2,\,1\)), and (\(1,\,3,\,1\)) to 1. 2.