1. 이미지 캡쳐
import time
import cv2
cam= cv2.VideoCapture(0)
time.sleep(0.1)
while(True):
ret, image = cam.read()
image = cv2.flip(image, -1) # 0: horizontal 1: vertical -1: horizontal & vertical
image = cv2.resize(image, (320, 240))
cv2.imshow("Frame", image)
key = cv2.waitKey(1)
if key == ord("q"):
break
elif key == ord(" "):
myimage = 'image'+time.strftime('%Y%m%d_%H%M%S')+'.jpg'
cv2.imwrite(myimage, image)
cv2.destroyAllWindows()
2. 출력결과

'이미지, 영상 처리 > 실습코드' 카테고리의 다른 글
| BGR 사진을 RGB로 변환 (0) | 2022.07.05 |
|---|---|
| [OpenCV] Motion Detecting (0) | 2022.07.05 |
| [OpenCV] Edge 검출 (0) | 2022.07.05 |