face_masker

安装opencv

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python

测试代码

import numpy as np
import cv2 as cv
cap = cv.VideoCapture(0)
if not cap.isOpened():
    print("Cannot open camera")
    exit()
while True:
    # 逐帧捕获
    ret, frame = cap.read()
    # 如果正确读取帧,ret为True
    if not ret:
        print("Can't receive frame (stream end?). Exiting ...")
        break
    # 我们在框架上的操作到这里
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    # 显示结果帧e
    cv.imshow('frame', gray)
    if cv.waitKey(1) == ord('q'):
        break
# 完成所有操作后,释放捕获器
cap.release()
cv.destroyAllWindows()
View Code

编译Cpython

pip install Cpython
#在/utils/mesh/cython打开cmd,activate “虚拟环境”,运行下两行
python setup.py build_ext --inplace
python setup.py install

 

posted @ 2022-09-29 11:26  化羽归尘  阅读(11)  评论(0)    收藏  举报