728x90

opnecv-python tutorial 참고

 

영상 스트리밍

ref : https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html

 

영상 자체가 뒤집혀 나오므로 flip 필요

flip

ref: https://crmn.tistory.com/54

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()


    # Display the resulting frame
    frame = cv2.flip(frame)
    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

 

 

 

 

 

 

 

 

 

주미가 너무 힘들어해서 사이즈를 줄여 사용하겠습니다.

 

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()


    # Display the resulting frame
    frame = cv2.flip(frame, 0)
    dst = cv2.resize(frame, dsize=(320,240))
    cv2.imshow('dst',dst)
    if cv2.waitKey(20) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

 

300x250

+ Recent posts