opencv_webcam/ows_pypi.md

66 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🔥 opencv-webcam-scriptPyPi版
## 创建人:曾逸夫
### ⚡ 安装教程
- 第一步:创建虚拟环境
```shell
# 创建conda虚拟环境以python 3.8为例
conda create -n ows python==3.8 # 虚拟环境名称为ows
conda activate ows # 激活虚拟环境
```
- 第二步安装
```shell
pip install opencv-webcam-script==0.4.0 # 以0.4.0为例
```
- 注意:`==`后面一定要加**版本号**。如果执行`pip install opencv-webcam-script` 可能安装为测试版,会影响使用。
### ⚡ 使用教程
```shell
from opencv_webcam.opencv_webcam import webcam_opencv
# 例举两个功能
webcam_opencv() # 常规调用
webcam_opencv(is_autoSaveFrame=True) # 自动保存帧
webcam_opencv(is_autoSaveFrame=True, is_compress=True) # 压缩帧
```
- 使用参数参考`opencv_webcam.py`源码
```python
def webcam_opencv(device_index="0",
quit_key="q",
pause_key="p",
is_autoSaveFrame=False,
frame_saveDir="./WebcamFrame",
frame_dirName="frames",
frame_nSave=1,
auto_frameNum=0,
is_handSaveFrame=False,
frame_capKey="a",
is_resizeFrame=False,
resize_frame=[640, 480],
resizeRatio_frame=1.0,
frame_namePrefix="frame",
frame_saveStyle="jpg",
jpg_quality=95,
png_quality=3,
logName="test.log",
logMode="a",
is_compress=False,
compressStyle="zip",
is_autoCompressName=False,
compressName="test",
compressMode="w"):
```