Electron microscopy
 
Euclidean distance and Euclidian Similarity for Images
- Python for Integrated Circuits -
- An Online Book -
Python for Integrated Circuits                                                                                   http://www.globalsino.com/ICs/        


Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

=================================================================================

The algorithm to find the similarity between the two images can be:
         i) Read the image files as an array.
         ii) Convert the image to a grey image such that each image is a single 1-D array. Therefore, the image files as an array to be used to generate a histogram for each image are in the value range of 0 – 255 for each pixel.
         iii) Count the occurrence of that pixel value in the image.
         iv) Use the L2-Norm or Euclidean Distance to find the difference the two histograms.
         v) Find the image which is the most similar to the reference image, based on the distance between the histogram of the test image and the reference images.

============================================

Euclidean distance and Euclidian Similarity for images. One limitation of Euclidean distance is that it requires all the vectors to be normalized, that is, both the vectors for comparison need to be of the same dimensions. To ensure that the histogram vectors are normalized, the images are resized to a specific size which is smaller than the size of all the images (note that error can occur if the specific image size is larger than one or more images in the group for similarity comparison). Finally, script returns a dictionary where the key corresponds to the pixel value and the value of the key is the number of times that pixel is present in the image. code:
          Move files from one directory to another (the file must already exist)
         Move files from one directory to another (the file must already exist)
Input and conclusion from output (Based on this analysis, the Scratch pattern is the most similar to the edge-loc pattern, while the random pattern is the most similar to the donut pattern):             

  Failure pattern ImageName Conclusion (most-similar image)
Scratch Euclidean distance and Euclidian Similarity for Images Ref_1 Ref_4
Random Euclidean distance and Euclidian Similarity for Images Ref_2 Ref_3
Donut Euclidean distance and Euclidian Similarity for Images Ref_3 Ref_2
Edge-Loc Euclidean distance and Euclidian Similarity for Images Ref_4 Ref_1

Output (the final vectors for both the reference images and the test image enables to calculate the distances and predict the image similarity, that is, the smaller than distance is, the more similarity is):         
          Move files from one directory to another (the file must already exist)

         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         

 

 

 

 

 

 

 

 

 

 

=================================================================================