def photo_loop(): for fname in os.listdir('chessboard'): if fname[0] == '.': continue frame = cv2.imread('chessboard/' + fname) frame = cv2.resize(frame, IMAGE_SIZE) # frame = cv2.undistort(frame, mtx, dist, None, newcameramtx) frame = cv2.warpPerspective(frame, perspective_matrix, IMAGE_SIZE) cv2.imshow('image', frame) cv2.waitKey(0)
def photo_demo(): # Capture frame-by-frame frame = cv2.imread("images/camera-view.png") frame = cv2.resize(frame, IMAGE_SIZE) show(frame, 'image') # frame = cv2.undistort(frame, mtx, dist, None, newcameramtx) frame = cv2.warpPerspective(frame, perspective_matrix, IMAGE_SIZE) frame = cv2.flip(frame, 1) frame = cv2.flip(frame, -1) show(frame, 'transformed') frame, output = process_image(frame) global IMAGE IMAGE = frame global OUTPUT OUTPUT = output if SHOW_SINGLE_CAPTURE_AND_DUMP: cv2.imshow('label', frame) cv2.waitKey(0) # cap.release() cv2.destroyAllWindows()