This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Four Point Image Transforms | |
# BoMeyering 2024 | |
import numpy as np | |
import cv2 | |
from scipy.spatial import distance_matrix | |
from scipy.optimize import linear_sum_assignment | |
from typing import Tuple | |
def order_points(pts: np.ndarray, img_shape: Tuple[int, int]) -> np.ndarray: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Welfords method for calculating mean and variance | |
# BoMeyering 2024 | |
import torch | |
import sys | |
class WelfordCalculator: | |
def __init__(self): | |
self.M = torch.zeros(3, dtype=torch.float64) | |
self.M_old = torch.zeros(3, dtype=torch.float64) | |
self.S = torch.zeros(3, dtype=torch.float64) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy as np | |
import pandas as pd | |
from exif import Image | |
DIRECTORY = "exif_photos" # Set top directory here | |
res = [] |