Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zztkm/opencvutil
https://github.com/zztkm/opencvutil
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zztkm/opencvutil
- Owner: zztkm
- License: mit
- Created: 2024-03-20T07:34:58.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-20T13:46:20.000Z (10 months ago)
- Last Synced: 2024-12-20T23:29:52.045Z (14 days ago)
- Language: Rust
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# opencvutil
OpenCV で利用できるカメラの情報を返すライブラリです。
## Install
```bash
pip install opencvutil
```## 使い方
```python
import cv2
import opencvutil# カメラの情報を取得
infos = opencvutil.camera_list()# カメラの情報を表示し、ユーザーに選択させる
for i, info in enumerate(infos):
print(f"Index {info['index']}: {info['name']}")# カメラを選択
camera_index = int(input("使用するカメラの Index を指定してください: "))# OpenCV でカメラを開く
cap = cv2.VideoCapture(camera_index)
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break# 画像を表示
cv2.imshow("frame", frame)if cv2.waitKey(1) & 0xFF == ord("q"):
breakcap.release()
cv2.destroyAllWindows()
```