본문 바로가기
OpenCV

[OpenCV] read.py

by Lizardee 2024. 4. 10.
Reading an image
import cv2 as cv

# Reading an image
img = cv.imread('Photos/cat_large.jpg')

cv.imshow('Cat', img)

cv.waitKey(0)

 

Reading a video
import cv2 as cv

# Reading a video
capture = cv.VideoCapture('Videos/dog.mp4')

while True:
    isTrue, frame = capture.read()
    
    cv.imshow('Video', frame)

    if cv.waitKey(20) & 0xFF==ord('d'):
        break

capture.release()
cv.destroyAllWindows()

 

'OpenCV' 카테고리의 다른 글

[OpenCV] contours.py  (0) 2024.04.10
[OpenCV] transformations.py  (0) 2024.04.10
[OpenCV] basic.py  (0) 2024.04.10
[OpenCV] draw.py  (0) 2024.04.10
[OpenCV] rescale.py  (0) 2024.04.10