title: How to perform pixel-by-pixel matching to check whether a query image exist in the template database or not
body: <p>I am working on dorsal hand vein recognition system. I have already binarised and pre-processed the image followed by feature extraction (white pixels coordinates) of the thinned vein patterns as shown below in the figure (Image 1). These steps were repeated for 10 images and having their coordinates stored in .txt file. </p>
  
  <p><img src="https://i.stack.imgur.com/K4fi6.png" alt="zsthin0073hv1.png"></p>
  
  <p>Now, let's say I have a query image (Image 2) as below where all the mentioned above steps have been applied and coordinates were retrieved.</p>
  
  <p><img src="https://i.stack.imgur.com/4847W.png" alt="zsthin0059hv1.png"></p>
  
  <p>For the matching purpose, I want to adapt <a href="http://www.ipcsit.com/vol2/3-A172.pdf" rel="nofollow noreferrer">this</a> paper matching strategy which stated that "<em>An algorithm that, somehow, does the exact same thing is implemented in order to do a similarity matching between binary images. The matching is a two way process. In the first step, the algorithm scans through the query image and takes every foreground pixel (background pixels can also be taken) value and compares this with the pixel value in the database image at the corresponding location. If it finds the same value at the same position in the database image, this will be taken as a hit count. Otherwise, it will be taken as a miss count and finally the difference of the hit and the miss count is divided by the total number of foreground pixels in the query image. The result of this division gives a number that indicates how Similar the Query image is to the Database image (SQD). In the second step, the database image is scanned and its foreground pixel elements are compared against the query image as is done in the first step. This will give us a result that indicates how Similar
  the Database image is to the Query image (SDQ). Then the average of the SQD and the SDQ, Average
  Similarity Measure (ASM), is taken as a ranking measure for the retrieval process.</em>"</p>
  
  <p>Thank You.</p>