<commit_before>import cv2
import numpy as np
import matplotlib.pyplot as plt

def referTemplate(iFrame):
    
    img_rgb = iFrame
    img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)

    template = cv2.imread('train.jpg',0)
    w, h = template.shape[::-1]

    res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
    threshold = 0.75
    loc = np.where( res >= threshold)

    for pt in zip(*loc[::-1]):
        cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0,255,255), 2)

    return img_rgb

def bruteForceMatcher(iFrame):
    
    img2 = iFrame
    img1 = cv2.imread('train.jpg',0)

    orb = cv2.ORB_create()

    kp1, des1 = orb.detectAndCompute(img1,None)
    kp2, des2 = orb.detectAndCompute(img2,None)

    bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=False)

    try:
        matches = bf.match(des1,des2)
        matches = sorted(matches, key = lambda x:x.distance)
    except MatchErrorException as e:
        print "No or Improbable Match Found"

    img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches[:10],None, flags=2)
    
    #plt.imshow(img3)
    #plt.show()
    
    return img3

<commit_msg>Minor Improvements in Library<commit_after>import cv2
import numpy as np
import matplotlib.pyplot as plt

def referTemplate(iFrame, threshold):
    
    img_gray = cv2.cvtColor(iFrame, cv2.COLOR_BGR2GRAY)

    template = cv2.imread('train.jpg',0)
    w, h = template.shape[::-1]

    res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
    loc = np.where( res >= threshold)

    for pt in zip(*loc[::-1]):
        cv2.rectangle(iFrame, pt, (pt[0] + w, pt[1] + h), (0,255,255), 2)

    return iFrame

def bruteForceMatcher(iFrame):
    
    img1 = cv2.imread('train.jpg',0)

    orb = cv2.ORB_create()

    kp1, des1 = orb.detectAndCompute(img1,None)
    kp2, des2 = orb.detectAndCompute(iFrame,None)

    bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=False)

    try:
        matches = bf.match(des1,des2)
        matches = sorted(matches, key = lambda x:x.distance)
    except MatchErrorException as e:
        print "No or Improbable Match Found"

    img3 = cv2.drawMatches(img1,kp1,iFrame,kp2,matches[:10],None, flags=2)
    
    #plt.imshow(img3)
    #plt.show()
    
    return img3


{'fraction_non_alphanumeric': 0.1299107142857143, 'fraction_numerical': 0.04196428571428571, 'mean_word_length': 3.142329020332717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2222825', 'n_tokens_mistral': 914, 'n_tokens_neox': 863, 'n_words': 170}