def __init__(self): # get which camera we will use self.camera_index = VN_config.get_integer('camera','index',0) # get image resolution self.img_width = VN_config.get_integer('camera','width',640) self.img_height = VN_config.get_integer('camera','height',480) # get image center self.img_center_x = self.img_width / 2 self.img_center_y = self.img_height / 2 # define field of view self.cam_hfov = VN_config.get_float('camera','horizontal-fov',70.42) self.cam_vfov = VN_config.get_float('camera','vertical-fov',43.3) #get camera distortion matrix and intrinsics. Defaults: logitech c920 mtx = np.array([[ 614.01269552,0,315.00073982], [0,614.43556296,237.14926858], [0,0,1.0]]) dist = np.array([0.12269303, -0.26618881,0.00129035, 0.00081791,0.17005303]) self.matrix = VN_config.get_array('camera','matrix', mtx) self.distortion = VN_config.get_array('camera', 'distortion', dist) self.newcameramtx, self.roi=cv2.getOptimalNewCameraMatrix(self.matrix,self.distortion,(self.img_width,self.img_height),1,(self.img_width,self.img_height)) #create a camera object self.camera = None #number of cores available for use desiredCores = VN_config.get_integer('processing', 'desired_cores', 4) self.cores_available = min(desiredCores, multiprocessing.cpu_count()) #does the user want to capture images in the background self.background_capture = VN_config.get_boolean('processing','background_capture', True) # background image processing variables self.proc = None # background process object self.parent_conn = None # parent end of communicatoin pipe self.img_counter = 0 # num images requested so far self.is_backgroundCap = False #state variable for background capture
def __init__(self): #load algorithm constants #how round a circle needs to be. Perfect circle = 1 self.eccentricity = VN_config.get_float('algorithm', 'eccentricity', 0.6) #acceptable distance(pixels) between cocentric circle centers self.distance_threshold = VN_config.get_integer( 'algorithm', 'distance_threshold', 15) # number of circles needed for a valid target(times 2); 2 circles are often overlayed self.min_circles = VN_config.get_integer('algorithm', 'min_circls', 5) #pixels: used to identify repeat circles(stacked circles). Problem caused by findContours() self.radius_tolerance = VN_config.get_integer('algorithm', 'radius_tolerance', 2) #Tolerance used in comparing actaul ratios and preceived ratios self.ratio_tolerance = VN_config.get_float('algorithm', 'ratio_tolerance', 0.015) #target specific data #target_code is the unique ratio between rings target_code_def = np.array([0.8, 0.91, 0.76, 0.84, 0.7, 0.66, 0.49]) self.target_code = VN_config.get_array('algorithm', 'target_code', target_code_def) #the outer_ring is a scaling factor for targets of various sizes; radius of outer ring in meters self.outer_ring = VN_config.get_float('algorithm', 'outer_ring', 0.08255) #define field of view self.cam_hfov = VN_config.get_float('camera', 'horizontal-fov', 70.42) self.cam_vfov = VN_config.get_float('camera', 'vertical-fov', 43.3)\ #define camera size self.cam_width = VN_config.get_integer('camera', 'width', 640) self.cam_height = VN_config.get_integer('camera', 'height', 480)
def __init__(self): #load algorithm constants #how round a circle needs to be. Perfect circle = 1 self.eccentricity = VN_config.get_float('algorithm', 'eccentricity', 0.6) #acceptable distance(pixels) between cocentric circle centers self.distance_threshold = VN_config.get_integer('algorithm','distance_threshold', 15) # number of circles needed for a valid target(times 2); 2 circles are often overlayed self.min_circles = VN_config.get_integer('algorithm','min_circls',5) #pixels: used to identify repeat circles(stacked circles). Problem caused by findContours() self.radius_tolerance = VN_config.get_integer('algorithm', 'radius_tolerance', 2) #Tolerance used in comparing actaul ratios and preceived ratios self.ratio_tolerance = VN_config.get_float('algorithm', 'ratio_tolerance', 0.015) #target specific data #target_code is the unique ratio between rings target_code_def = np.array([0.8,0.91,0.76,0.84,0.7,0.66,0.49]) self.target_code = VN_config.get_array('algorithm', 'target_code',target_code_def) #the outer_ring is a scaling factor for targets of various sizes; radius of outer ring in meters self.outer_ring = VN_config.get_float('algorithm', 'outer_ring', 0.08255) #define field of view self.cam_hfov = VN_config.get_float('camera', 'horizontal-fov', 70.42) self.cam_vfov = VN_config.get_float('camera', 'vertical-fov', 43.3) #define camera size self.cam_width = VN_config.get_integer('camera', 'width', 640) self.cam_height = VN_config.get_integer('camera', 'height', 480)
def __init__(self): # get which camera we will use self.camera_index = VN_config.get_integer('camera', 'index', 0) # get image resolution self.img_width = VN_config.get_integer('camera', 'width', 640) self.img_height = VN_config.get_integer('camera', 'height', 480) # get image center self.img_center_x = self.img_width / 2 self.img_center_y = self.img_height / 2 # define field of view self.cam_hfov = VN_config.get_float('camera', 'horizontal-fov', 70.42) self.cam_vfov = VN_config.get_float('camera', 'vertical-fov', 43.3) #get camera distortion matrix and intrinsics. Defaults: logitech c920 mtx = np.array([[614.01269552, 0, 315.00073982], [0, 614.43556296, 237.14926858], [0, 0, 1.0]]) dist = np.array( [0.12269303, -0.26618881, 0.00129035, 0.00081791, 0.17005303]) self.matrix = VN_config.get_array('camera', 'matrix', mtx) self.distortion = VN_config.get_array('camera', 'distortion', dist) self.newcameramtx, self.roi = cv2.getOptimalNewCameraMatrix( self.matrix, self.distortion, (self.img_width, self.img_height), 1, (self.img_width, self.img_height)) #create a camera object self.camera = None #number of cores available for use desiredCores = VN_config.get_integer('processing', 'desired_cores', 4) self.cores_available = min(desiredCores, multiprocessing.cpu_count()) #does the user want to capture images in the background self.background_capture = VN_config.get_boolean( 'processing', 'background_capture', True) # background image processing variables self.proc = None # background process object self.parent_conn = None # parent end of communicatoin pipe self.img_counter = 0 # num images requested so far self.is_backgroundCap = False #state variable for background capture