def start_file(file_path): # Read the file data = read_file(file_path) global global_desired_dict global_desired_dict = data start() a = Args() a.init() args = a.get_args() if args.verbose: print(vars(args)) if args.test: # Just do printing and do nothing else gui = ForegroundGUI() while True: print("Window: {} | Brightness: {}".format( gui.get_foreground_window(), brightness.get_brightness())) time.sleep(1) if args.start: # Check if one or file if args.one: start_one(args.window_name, args.brightness_true) elif args.file: start_file(args.path)
fy=0.5, interpolation=cv2.INTER_NEAREST) # Gray scale gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) return frame, gray if __name__ == '__main__': webcam = cv2.VideoCapture(0) face_cascade = cv2.CascadeClassifier( './haar/haarcascade_frontalface_alt2.xml') eye_cascade = cv2.CascadeClassifier('./haar/haarcascade_eye.xml') original_size = None maximum_size = 0 screen = Brightness() original_bright = screen.get_brightness() current_bright = None while True: # Read from webcam got_frame, original_frame = webcam.read() if got_frame: frame, gray = reduce_gray_image(original_frame) # Detect faces faces = face_cascade.detectMultiScale(gray, SCALE_FACTOR, MIN_NEIGHBOR) bright = current_bright for (fx, fy, fw, fh) in faces: if DEBUG: cv2.rectangle(frame, (fx, fy), (fx + fw, fy + fh), BLUE, 2) area = float(fw * fh)