close
import cv2


#  使用視訊鏡頭擷取影像
cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)

if vc.isOpened(): # try to get the first frame
    rval, frame = vc.read()
else:
    rval = False

count = 0
while rval:
    cv2.imshow("preview", frame)  # 產生視窗
    rval, frame = vc.read()
    cv2.imwrite("frame%d.jpg" % count, frame)  # 將影格轉為 frame
    key = cv2.waitKey(100)  # 調整影格數
    if key == 27:  # esc停止
        break
    count += 1
cv2.destroyWindow("preview")
import cv2


#  使用視訊鏡頭擷取影像
cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)

if vc.isOpened(): # try to get the first frame
    rval, frame = vc.read()
else:
    rval = False

count = 0
while rval:
    cv2.imshow("preview", frame)  # 產生視窗
    rval, frame = vc.read()
    cv2.imwrite("frame%d.jpg" % count, frame)  # 將影格轉為 frame
    key = cv2.waitKey(100)  # 調整影格數
    if key == 27:  # 按esc停止
        break
    count += 1
cv2.destroyWindow("preview")


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 KR 的頭像
    KR

    漫漫長路

    KR 發表在 痞客邦 留言(0) 人氣()