## 4 High-Resolution Images in Camera-Based WMSNs
### Image Stitching Technique
#### 4.1.2 Image Matching  
In this step, the goal is to find all matching images. The ones having more matching features than a constant number would be considered as potential match images of current image. First, the RANSAC method [44] is used to select a set of inliers that are compatible with a homography between the images. Next, a probabilistic model is applied to verify the match.  
RANSAC is an iterative method to estimate parameters of a mathematical model from a set of data which contains outliers. In the case of image stitching, it selects sets of \(4\) feature correspondences and computes the homography \(H\) between them using the direct linear transformation (DLT) method [45]. This procedure repeats \(n=500\) times and the solution that has the maximum of inliers is selected. Given the probability that a feature match is correct between a pair of matching images (the inlier probability) is \(p_{i}\), the probability of finding the correct transformation after \(n\) trials is:  
\[p(H\;\text{is\ correct})=1-(1-(p_{i})^{r})^{n} \tag{1}\]After a large number of trials the probability of finding the correct homography is very high. For example, for an inlier probability \(p_{i}=0.5\), the probability that the correct homography is not found after 500 trials is approximately \(1\times 10^{-14}\).  
[PERSON] and [PERSON] [38] use a probabilistic model for image matching verification which is explained in the following. For each pair of potentially matching images there are feature matches which are geometrically consistent (RANSAC inliers) and features that are inside the overlap area but not consistent (RANSAC outliers).  
The idea of this verification model is to compare the probabilities of whether this set of inliers/outliers was generated by a correct image match or by a false image match. For a given image the total number of features in the area of overlap is denoted \(n_{f}\) and the number of inliers is denoted \(n_{i}\). The probabilistic event that this image matches correctly/incorrectly is represented by the binary variable \(m\in\{1,0\}\). The event that the \(i^{th}\) feature match \(f^{(i)}\in\{0,1\}\) is an inlier/outlier is assumed to be independent Bernoulli so that the total number of inliers is binomial:  
\[p(f(1:n_{f})\mid m=1)=B(n_{i};n_{f},p_{1}) \tag{2}\]  
\[p(f(1:n_{f})\mid m=0)=B(n_{i};n_{f},p_{0}) \tag{3}\]  
where \(p_{I}\) is the probability of a feature being an inlier of a correct image match, and \(p_{0}\) is the probability of a feature being an inlier of a false image match. The set of feature match variables \(\left\backslash f(i),i=1,2,...,n_{f}\right\rangle\) is denoted by \(f^{(\mathrm{L}p_{f})}\). The number of inliers is shown by \(n_{i}=\sum\limits_{i=1}^{n_{f}}f^{(i)}\) and \(B(x;\ n,\ p)\) is the Binomial distribution as follows:  
\[B(x;n,p)=\frac{n!}{x!(n-x)!}p^{x}(1-p)^{n-x} \tag{4}\]  
[PERSON] and [PERSON] [38] have chosen values \(P_{I}=0.6\) and \(P_{0}=0.1\). Now the posterior probability that an image match is correct is evaluated using Bayes' Rule:  
\[P(m=1\mid f^{(\mathrm{L}p_{f})})=\frac{p(f^{(\mathrm{L}p_{f})}\mid m=1)p(m=1) }{p(f^{(\mathrm{L}p_{f})})}=1+\frac{p(f^{(\mathrm{L}p_{f})}\mid m=0)p(m=0)}{p (f^{(\mathrm{L}p_{f})}\mid m=1)p(m=1)} \tag{5}\]  
An image match is accepted if \(p(m=1\mid f^{(\mathrm{L}p_{f})})>P_{\mathrm{min}}\)  
\[\each image that transforms it to its correct position in the high-resolution-registered image. As the location of camera nodes are fixed, these matrixes could be used next time. Hence, the transformation matrix is sent to the related cluster head to give it the ability to register and finally stitch low-resolution images before sending them to Sink. It has two merits: first, after the first time calculation in Sink, there is no need to calculate these matrixes in cluster head and, second by stitching images before sending them, the network traffic between upper-tier and Sink is reduced significantly.