# Well-Distributed Feature Extraction for Image Registration Using Histogram Matching
## 3 Method
### Feature Extraction  
In the proposed method, a hybrid approach for feature extraction is suggested that utilizes the concepts from both feature-based and area-based methods. We use mean normalized cross-correlation (ZNCC) [21] measure to find the well-distributed control points. ZNCC is a robust measure against brightness variations due to the effect of the subtraction of the local mean. Basically, an input image is divided into blocks and a template for each block is matched through ZNCC measure. The ZNCC measures are considered as features. We can get a larger numbers of features for each block with even and better distribution by matching multiple templates for one block. In this way, we can overcome the problem with feature-based and area-based methods. Feature-based methods may provide larger numbers of control points; however, these control points may not be well-distributed. They may be dense on edges and sparse in smooth and low contrast areas. On the other hand, the performance of area-based methods is degraded due to the similar spectral ranges. The steps for feature extraction are illustrated in Algorithm 2 and its graphical representation is shown in Figure 6.  
Figure 6: Graphical representation of Algorithm 2: (**a**) reference image; (**b**) sensed image; (**c**) template image; and (**d**) target image. ```
Data:\(R(x,y)\): reference image with size \((X,Y)\); \(Z(x,y)\): sensed image with size \((X,Y)\); for each input imagedo  divide input images into \(K\) blocks, each of \((M\times N)\): block size;  take \(K^{\prime}\) templates, each of \((M^{\prime}\times N^{\prime})\): template size for\(k\gets 1\)to\(K\)do for\(k^{\prime}\gets 1\)to\(K^{\prime}\)do for each position \((u,v)\) in \(k\)th block within \(k^{\prime}\)th templatedo  Compute mean subtracted images for block and template using (8) and (9);  Compute numerator FZNCC through FFT using (10);  Compute ZNCC putting numerator FZNCC in (7);
```  
**Algorithm 2**Feature extraction. The features are extracted from both input images, i.e., the reference image \(R(x,y)\) and the sensed image \(Z(x,y)\), using Algorithm 2. Let an input image \(R(x,y)\) be divided into \(K\) blocks each of size \(M\times N\). For each \(k\)th block, \(K^{\prime}\) template images (\(K^{\prime}\) smaller blocks), each of size \(M^{\prime}\times N^{\prime}\) from the \(k\)th block of \(R(x,y)\) image, are obtained. In other words, each block is divided into \(K^{\prime}=\left\lceil\frac{M}{M^{\prime}}\right\rceil\times\left\lceil\frac{ N}{N^{\prime}}\right\rceil\) smaller blocks (templates). Let \(R_{k^{\prime}}^{(k)}\) be the \(k^{\prime}\)th template in the lexicographical order; then, the template is moved over the block and the similarity is computed for each location. The template is shifted \(u\) discrete steps in the \(x\) direction and \(v\) discrete steps in the \(y\) direction. For each block and at each position \((u,v)\) inside the block, the ZNCC measure is computed as,  
\[ZNCC^{(k)}\left(u,v\right)=\frac{\sum_{x,y}\left[R^{(k)}(x,y)-\bar{R}^{(k)} \right]\left[R_{k^{\prime}}^{(k)}(x-u,y-v)-\bar{R}_{k^{\prime}}^{(k)}\right]}{ \sqrt{\sum_{x,y}\left[R^{(k)}(x,y)-\bar{R}^{(k)}\right]^{2}\left[R_{k^{\prime} }^{(k)}(x-u,y-v)-\bar{R}_{k^{\prime}}^{(k)}\right]^{2}}}, \tag{7}\]  
where \(\bar{R}^{(k)}\) is the mean of the overlapped with template in the \(k\)th block \(R^{(k)}(x,y)\), \(\bar{R}_{k^{\prime}}^{(k)}\) is the mean of the \(k^{\prime}\)th template. Higher value of the ZNCC measure indicates better match. The main drawback of ZNCC is their high computational cost. To overcome high computational complexity, the computation of ZNCC is accelerated by using fast Fourier transform (FFT). The ZNCC of two images using FFT is much faster than computing their spatial correlation.