k = cv2.waitKey(33) & 0xFF
    if k == 27:    # Esc key to stop
        break
    elif k == -1:  # normally -1 returned,so don't print it
        continue
    elif k == ord('c'):
        ezsift_matcher.add_reference_image(str(angles_to_capture[current]), grey_scale_image)
        print "Reference Added", angles_to_capture[current]
        current += 1
        if current >= len(angles_to_capture):
            cap = False
        time.sleep(0.1)


for row in ezsift_matcher.get_reference_image_confusion_matrix():
    print row

while True:

    gray = vidgrab.grab_frame_return_grey()
    grey_scale_image = cv2.cvtColor(gray, cv2.COLOR_BGR2GRAY)
    grey_scale_image = np.array(grey_scale_image)

    matching_result = ezsift_matcher.match(grey_scale_image)

    angle = []
    angle_average = 0
    lensall = 0
    for logo_key in angles_to_capture:
        coords_1 = matching_result.get_match_coord_lst(str(logo_key))
color_cycle = itertools.cycle([[255, 0, 0], [0, 255, 0], [0, 255, 0]])

ezsift_matcher = EZSiftImageMatcher()

num_images = 100

for i in range(0, num_images, 1):
    path = "./img/image-{}.png".format(i)
    print path
    img1 = cv2.imread(path)
    g1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
    ezsift_matcher.add_reference_image(str(i), g1)


conf_matrix = ezsift_matcher.get_reference_image_confusion_matrix()

np_conf_mat = np.array(conf_matrix)


for i in range(num_images):
    for j in range(num_images):
        if i != j and i > j:
            np_conf_mat[i][j] = np_conf_mat[j][i]

plt.figure(0)
c = plt.imshow(np_conf_mat, interpolation="none")
plt.colorbar(c)


np_conf_mat_inv = np.zeros(np_conf_mat.shape)