def show(self): while True: ret, frame = self.value.read() if ret: cv2.imshow("Exercise A", frame) key = cv2.waitKey(20) if esc_pressed(key): break self.value.release()
def exercise_3(): cv2.namedWindow('Exercise 1.3') cv2.setMouseCallback('Exercise 1.3',draw_window) cv2.imshow("Exercise 1.3", img) while(1): key = cv2.waitKey(20) if esc_pressed(key): break cv2.destroyAllWindows()
def test_video(path): cap = cv2.VideoCapture(path) while (True): ret, frame = cap.read() processed = pipeline(frame) if processed is not None: cv2.imshow("Teste", processed) if esc_pressed(cv2.waitKey(1)): break
#same values as quiz rho = 2 theta = np.pi/180 #threshold is minimum number of intersections in a grid for candidate line to go to output threshold = 20 min_line_len = 50 max_line_gap = 200 line_image = hough_lines(roi_image, rho, theta, threshold, min_line_len, max_line_gap) result = weighted_img(line_image, image, α=0.8, β=1., λ=0.) return result # for source_img in os.listdir("test_images/"): # image = mpimg.imread("test_images/"+source_img) # image = cv2.imread("images/lane_test.jpeg") # processed = process_frame(image) # cv2.imshow("Teste", processed) # cv2.waitKey() # mpimg.imsave("test_images/annotated_"+source_img,processed) cap = cv2.VideoCapture("images/challenge.mp4") while(True): ret, frame = cap.read() processed = process_frame(frame) cv2.imshow("Teste", processed) if esc_pressed(cv2.waitKey(1)): break