def rect_to_global(rect, geo_image, rotated=True): '''Convert rect in pixels to tuple of 4 corners in global coordinates (in meters).''' if rotated: corners = rectangle_corners(rect) else: x, y, w, h = rect corners = [(x,y), (x,y+h), (x+w,y), (x+w,y+h)] g_corners = [] for corner in corners: x_meters, y_meters, _ = calculate_pixel_position(corner[0], corner[1], geo_image) g_corners.append((x_meters, y_meters)) return g_corners
def add_possibly_missed_code(self, bouding_rect, geo_image): x, y = rectangle_center(bouding_rect) position = calculate_pixel_position(x, y, geo_image) self.possibly_missed_codes.append(self.MissedCode(bouding_rect, position, geo_image.file_name, geo_image.file_path))