Advertisement
tomateblue

testopenknn.py

Aug 23rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. import numpy as np
  2. import cv2
  3. import argparse
  4. from OpenKNN import CompareImage
  5.  
  6. # argumentos para comparar
  7. ap = argparse.ArgumentParser();
  8. ap.add_argument("--ver",        dest="help",    help = "python testarg.py -i1 img.png -i2 img2.png")
  9. ap.add_argument("--img1",       dest="img1",    help = "path to the image file")
  10. ap.add_argument("--img2",       dest="img2",    help = "path to the image file 2")
  11. args = vars(ap.parse_args())
  12.  
  13. #print args
  14. #print ap.parse_args()
  15.  
  16. try:
  17.  if args['img1'] and args['img2']:
  18.   img1 = cv2.imread(args["img1"],0)
  19.   img2 = cv2.imread(args["img2"],0)
  20.   match = CompareImage(img1,img2)
  21.   #print match  
  22.   if match[0] == True:
  23.      print "[Img1: ",args['img1'],"] | [Img2: ",args["img2"],"] | [Acuraccy Images: ",match[1],"]"
  24.   if match[0] == False:
  25.      print match[1]
  26. except:
  27.   print "Fail Compare Images"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement