<commit_before>import numpy as np
import cv2
from math import sqrt, pow

def rotate(img, direction):
    orientation = {"NORTH" : 0, "EAST" : -90, "SOUTH" : 180, "WEST" : 90}
    rows,cols = img.shape
    M = cv2.getRotationMatrix2D((cols/2, rows/2), orientation[direction], 1)
    dst = cv2.warpAffine(img, M, (cols,rows))
    return dst

def analyze(key1, key2, matches, scale): 
    scorex = 0
    scorey = 0
    for match in matches:
        x1, y1 = key1[match.trainIdx].pt
        x2, y2 = key2[match.trainIdx].pt
        if x1>x2*scale:
            scorex += 1
        else:
            scorex -= 1
        if y1>y2*scale:
            scorey += 1
        else:
            scorey -= 1
    return scorex, scorey

def scale(key1, key2, matches, amount):
    total = 0.0
    for i in range(amount):
        x1, y1 = key1[matches[i].queryIdx].pt
        x2, y2 = key1[matches[i+1].queryIdx].pt
        x3, y3 = key2[matches[i].trainIdx].pt
        x4, y4 = key2[matches[i+1].trainIdx].pt
        total+= sqrt(pow(x2-x1, 2) + pow(y2-y1, 2))/sqrt(pow(x4-x3, 2) +
                pow(y4-y3,2))
    return total/amount

if __name__=="__main__":
    left = cv2.imread("img/left.jpg", 1)
    right = cv2.imread("img/right.jpg", 0)

    # Initiate the SIFT detector
    orb= cv2.ORB()<commit_msg>working? but bugged<commit_after>import numpy as np
import cv2
from math import sqrt, pow

def rotate(img, direction):
    orientation = {"NORTH" : 0, "EAST" : -90, "SOUTH" : 180, "WEST" : 90}
    rows,cols = img.shape
    M = cv2.getRotationMatrix2D((cols/2, rows/2), orientation[direction], 1)
    dst = cv2.warpAffine(img, M, (cols,rows))
    return dst

def analyze(key1, key2, matches, scale): 
    scorex = 0
    scorey = 0
    for match in matches:
        x1, y1 = key1[match.queryIdx].pt
        x2, y2 = key2[match.trainIdx].pt
        if x1>x2*scale:
            scorex += 1
        else:
            scorex -= 1
        if y1>y2*scale:
            scorey += 1
        else:
            scorey -= 1
    return scorex, scorey

def scale(key1, key2, matches, amount):
    total = 0.0
    for i in range(amount):
        x1, y1 = key1[matches[i].queryIdx].pt
        x2, y2 = key1[matches[i+1].queryIdx].pt
        x3, y3 = key2[matches[i].trainIdx].pt
        x4, y4 = key2[matches[i+1].trainIdx].pt
        total+= sqrt(pow(x2-x1, 2) + pow(y2-y1, 2))/sqrt(pow(x4-x3, 2) +
                pow(y4-y3,2))
    return total/amount

if __name__=="__main__":
    left = cv2.imread("img/right.jpg", 0)
    right = cv2.imread("img/left.jpg", 0)
    right = rotate(right, "SOUTH")

    # Initiate the SIFT detector
    orb= cv2.ORB()
{'fraction_non_alphanumeric': 0.14666666666666667, 'fraction_numerical': 0.05180952380952381, 'mean_word_length': 2.245982694684796, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '167453', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1003, 'n_words': 240}