## 4 High-Resolution Images in Camera-Based WMSNs
### Camera Sensor Node Selection Algorithm with Good Coverage and Minimum Energy Dissipation
#### 4.2.1 Camera Node Selection Approach  
As mentioned before, it is unnecessary to select all sensors of a cluster head to create a high resolution image and a proper subset of them is adequate. Selecting a proper subset of camera sensor nodes is solved by the presented algorithm. By each query from Sink, cluster head selects this subset based on some information (Coverage Data Structure) which has been received after first query in a way that in long term the average of activation times between camera sensor nodes becomes equal. Consequently, a balance in nodes energy consumption is achieved and this balance makes a good coverage of desired area be provided for a longer time. Other sensors that are not in this active subset are in sleep mode, so lower-tier energy dissipation decreases and its life time increases as much as possible. It is obvious that by reducing the number of active nodes to cover the desired area, inter-tier network traffic and camera overlap area are decreased. In addition, it reduces the processing amount in cluster head and response time to Sink queries. Sink sends Coverage Data Structure to cluster heads along with stitching related information (transformation matrixes) in order to perform the presented algorithm. To calculate this information, after stitching low-resolution images captured by all camera sensors, Sink grids the final result that is a high resolution image (see Figure 5b). Also, it specifies which grid cells are covered by the image of each camera sensor (see Figure 5c,d). The result of this process is an array, which each element of it corresponds to a grid cell covered by more than one camera. Each element points to a linked list call Sensor List. Linked list (Sensor List) assigned to each grid cell (element) includes camera sensor nodes' IDs which cover this gird cell. Figure 5e shows a sample of this data structure. Most of the grid cells are covered by multiple cameras because camera sensors have overlaps and each sensor image covers multiple gird cells. The grid cells which are not covered by more than one camera are not included in data structure. The reason is in case they were included, the corresponding cameras would be kept in active mode to cover them and the corresponding camera nodes would lose its energy quickly. **d)** Grid cells which are covered by 2\({}^{\text{nd}}\) camera. **e)** Coverage Data Structure that is created based on grid in part d and camera images like 2\({}^{\text{nd}}\) camera in part e. For example, whereas 2\({}^{\text{nd}}\) camera covers 23\({}^{\text{rd}}\) grid cell, it's ID is in the list of this cell. Figure 5: Creating coverage data structure. Also, the size of grid cells is an important issue. When a grid cell is not completely covered by a camera sensor node image, another camera must be selected to cover it. Consequently, the overlap of selected cameras expands. As the size of grid cells reduces more, the probability of covering them increase and less areas of camera images are wasted. By decreasing the size of grid cells, therefore, total overlap decreases and less number of camera sensor nodes is required to be in active mode to cover the desired area. However, decreasing the size of grid cells increases their number; consequently, the algorithm runtime prolongs and requires more memory. If there are \(N\) grid cells, \(M\) camera nodes and in average each grid cell is covered by \(K\) camera nodes, in the best case, the algorithm finds a proper subset whose computational order is \(O\) (\(N\times K\)). In the worst case, the proper subset is found which has a computational order of \(O\) (\(M\times N\times K\)). So, according to the memory volume and processing power of upper-tier nodes, the size of grid cells (\(N\)) should be specified. Also, \(K\) is achieved by Equation (8) after creating the Coverage Data Structure.