예제 #1
0
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)
예제 #2
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()
예제 #3
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()
예제 #4
0
def video_loop():
    cap = cv2.VideoCapture(CAMERA_NUM)
    
    while(True):
        # Capture frame-by-frame
        if BLANKING:
            blanking.set_blank(True)
        wait(0.1)
        if BLANKING:
            blanking.set_blank(False)
        wait(0.1)
        cap.grab()
        # blanking.set_blank(False)
        ret, frame = cap.retrieve()
        frame = cv2.resize(frame, IMAGE_SIZE)
        # 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)
        
        frame, output = process_image(frame)
        
        cv2.imshow('image', frame)
        global IMAGE
        IMAGE = frame
        global OUTPUT
        OUTPUT = output
        if SHOW_SINGLE_CAPTURE_AND_DUMP:
            cv2.waitKey(0)
            break
        if BLANKING:
            wait(0.7)
        else:
            wait(0.01)
    
    cap.release()
    cv2.destroyAllWindows()
예제 #5
0
def show(img, name):
    if SHOW_SINGLE_CAPTURE_AND_DUMP: return
    cv2.imshow('image', img)
    cv2.waitKey(0)
    cv2.imwrite('demo/' + name + '.png', img)
예제 #6
0
def wait(seconds):
    cv2.waitKey(int(seconds * 1000))
예제 #7
0
def show(img):
    return
    cv2.imshow("rotated", img)
    cv2.waitKey(0)
예제 #8
0
def wait(seconds):
    cv2.waitKey(int(seconds * 1000))
예제 #9
0
def show(img):
    return
    cv2.imshow('rotated', img)
    cv2.waitKey(0)
예제 #10
0
def show(img, name):
    if SHOW_SINGLE_CAPTURE_AND_DUMP: return
    cv2.imshow('image', img)
    cv2.waitKey(0)
    cv2.imwrite('demo/' + name + '.png', img)