def __init__(self, port=0, pitch=0): self.capture = cv2.VideoCapture(port) # Parameters used to fix radial distortion. radial_data = tools.get_radial_data() self.nc_matrix = radial_data["new_camera_matrix"] self.c_matrix = radial_data["camera_matrix"] self.dist = radial_data["dist"]
def __init__(self, port=0, pitch=0): self.capture = cv2.VideoCapture(port) calibration = tools.get_croppings(pitch=pitch) self.crop_values = tools.find_extremes(calibration['outline']) # Parameters used to fix radial distortion radial_data = tools.get_radial_data() self.nc_matrix = radial_data['new_camera_matrix'] self.c_matrix = radial_data['camera_matrix'] self.dist = radial_data['dist']
def __init__(self, port=0, pitch=0): self.pitch = pitch self.capture = cv2.VideoCapture(port) calibration = tools.get_colors(pitch=pitch) self.camera_settings = calibration["camera"] self.reset_camera_settings() # Parameters used to fix radial distortion self.radial_data = tools.get_radial_data() self.nc_matrix = self.radial_data['new_camera_matrix'] self.c_matrix = self.radial_data['camera_matrix'] self.dist = self.radial_data['dist'] self.background = cv2.imread('pitch_photos/pitch_' + str(pitch) + ".jpeg")
import cv2 import numpy as np import tools import argparse FRAME_NAME = 'ConfigureWindow' WHITE = (255,255,255) BLACK = (0,0,0) BLUE = (255, 0, 0) GREEN = (0, 255, 0) RED = (0, 0, 255) distort_data = tools.get_radial_data() NCMATRIX = distort_data['new_camera_matrix'] CMATRIX = distort_data['camera_matrix'] DIST = distort_data['dist'] class Configure(object): def __init__(self, pitch, width=640, height=480): self.width = width self.height = height self.pitch = pitch self.camera = cv2.VideoCapture(0) self.new_polygon = True self.polygon = self.polygons = [] self.points = [] keys = ['outline', 'Zone_0', 'Zone_1', 'Zone_2', 'Zone_3']
def fix_radial_distortion(frame): a = tools.get_radial_data() return cv2.undistort(frame, a['camera_matrix'], a['dist'], None, a['new_camera_matrix'])
import cv2 import numpy as np import tools import argparse FRAME_NAME = 'ConfigureWindow' WHITE = (255, 255, 255) BLACK = (0, 0, 0) BLUE = (255, 0, 0) GREEN = (0, 255, 0) RED = (0, 0, 255) distort_data = tools.get_radial_data() NCMATRIX = distort_data['new_camera_matrix'] CMATRIX = distort_data['camera_matrix'] DIST = distort_data['dist'] class Configure(object): def __init__(self, pitch, width=640, height=480): self.width = width self.height = height self.pitch = pitch self.camera = cv2.VideoCapture(0) self.new_polygon = True self.polygon = self.polygons = [] self.points = [] keys = ['outline', 'Zone_0', 'Zone_1', 'Zone_2', 'Zone_3'] self.data = self.drawing = {}