Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- linux
- ppc64le
- raspberry pi
- CUDA
- windows
- ubuntu
- YouTube 8M
- face_recognition
- colaboratory
- keras
- FIle
- urllib
- error
- object detection
- TensorFlow
- Jupyter notebook
- Windows 10
- pyTorch
- python
- install
- shakeratos
- dlib
- download
- gpu memory
- python3
- 딥러닝
- Deep Learning
- Anaconda
- colab
- dataset
Archives
- Today
- Total
Shakerato
Check valid webcams with cv2, python 본문
import cv2
def testDevice(device_id): cap = cv2.VideoCapture(device_id) if cap is None or not cap.isOpened(): print('Warning: unable to open camera:', device_id) return None else: print('here is your camera', device_id) return cap
valid_cam_ids = [] caps = [] for device_id in range(0,5): valid_cap = testDevice(device_id) if valid_cap: valid_cam_ids.append(device_id) caps.append(valid_cap)
while True: for cam_id in valid_cam_ids: ret, frame = caps[cam_id].read() cv2.imshow('cam_id: '+str(cam_id), frame) k = cv2.waitKey(1) if k == ord('q') or k == 27: break
|
'Research' 카테고리의 다른 글
python 2 to python3 automatic change tool (2to3) (0) | 2021.02.08 |
---|---|
HTK, SOX 설치 (ubuntu 18.04 64bit) (0) | 2021.02.08 |
Anaconda on Linux, root can't activate my env (0) | 2020.10.18 |
initialize the empty list in the dictionary' in Python (0) | 2020.09.05 |
Upper Confidence Bound (UCB) 정리, 보충 설명 (0) | 2020.09.03 |
Comments