frrostbitee

HistoAnaly_Final

Apr 15th, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. counter=0
  2.     index = {}
  3.     images = {}
  4.     results =[]
  5.     while counter<total_count:
  6.         name="test%d.jpg" % counter
  7.         image = cv2.imread(name)
  8.         images[name] = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
  9.         hist = cv2.calcHist(image, [0, 1, 2], None, [8, 8, 8],[0, 256, 0, 256, 0, 256])
  10.         hist = cv2.normalize(hist, hist).flatten()
  11.         index[name] = hist
  12.         counter+=25
  13.  
  14.     counter=0
  15.     i=0
  16.     for (k, hist) in index.items():
  17.         results.append([])
  18.         name1="test%d.jpg" % counter
  19.         name2="test%d.jpg" % (counter+25)
  20.         if(counter<total_count-25):
  21.             d = cv2.compareHist(index[name1], index[name2], cv2.HISTCMP_CORREL)
  22.             results[i].append(d)
  23.             results[i].append(1)
  24.             counter+=25
  25.             i+=1
  26.     print results
Add Comment
Please, Sign In to add comment