def main(): if len(sys.argv) < 2: print("Filename required") sys.exit() _, _, calibration, _, _, _ = runConfig() lower_bound = np.array(calibration["green"]["green_lower"]) upper_bound = np.array(calibration["green"]["green_upper"]) img_orig = cv2.imread(sys.argv[1]) img = img_orig hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) mask_orig = cv2.inRange(hsv, lower_bound, upper_bound) mask = np.copy(mask_orig) mask_eroded_dilated = MI.erodeAndDilate(mask) mask = np.copy(mask_eroded_dilated) ret, mask_threshold = cv2.threshold(mask, 127, 255, 0) cv2.imwrite('generator_original_frame.png', img_orig) cv2.imwrite('generator_original_mask.png', mask_orig) cv2.imwrite('generator_mask_eroded_dilated.png', mask_eroded_dilated) cv2.imwrite('generator_mask_threshold.png', mask_threshold)
def __init__(self): self.os = None self.camera = None self.calibration = None self.freqFrameNT = None self.vertx = None self.verty = None self.os, self.camera, self.calibration, self.freqFrameNT, self.vertx, self.verty = runConfig( )
import cv2 import numpy as np import time import sys sys.path.append('/usr/local/lib') import logging from datetime import datetime from config import runConfig from networktables import NetworkTables import findTargetS as FT logging.basicConfig(level=logging.DEBUG) os, camera_location, calibration, freqFramesNT, vertx, verty = runConfig(None) def main(): camera_table = nt_init() cap = cap_init(camera_location) rect_cnt = create_rect() run(cap, camera_table, calibration, freqFramesNT, rect_cnt) # main loop contained here. will not return to main. def nt_init(): #NetworkTables.setIPAddress('10.5.1.141') #NetworkTables.setClientMode() #NetworkTables.initialize(server='10.5.1.141') # port 1735
def main(): print("INFO: initializingvision manager") os, cameraDevice, calibration, freqFrameNT = runConfig() print(os, cameraDevice, calibration, freqFrameNT)
def main(): _, cam, calibration, _, _, _ = runConfig(None) cap = init_capture(cam) switch = init_window(calibration) run(cap, switch, calibration)