赞
踩
在本文中,我们将使用Python来检测人脸和手部标志。我们将使用一个模块
检测所有面部和手部标志的解决方案。此外,我们亦会看看如何取得不同的面部及手上标志,这些标志可应用于不同的电脑视觉应用,例如手语侦测、睡意侦测等
所需模块
OpenCVPython库是一个广泛应用于图像分析、图像处理、检测、识别等领域的计算机视觉库。
安装所需的库
- pip install opencv-python mediapipe msvc-runtime
- 复制代码
下面是一种分步骤的人脸和手部地标检测方法。
步骤1:导入所有必需的库,在本例中只需要两个库。
# Import Libraries
import
cv2
import
time
import
mediapipe as mp
步骤2:初始化整体模型和绘图功能,以检测和绘制图像上的地标。
# Grabbing the Holistic Model from Mediapipe and
# Initializing the Model
mp_holistic
=
mp.solutions.holistic
holistic_model
=
mp_holistic.Holistic(
min_detection_confidence
=
0.5
,
min_tracking_confidence
=
0.5
)
# Initializing the drawng utils for drawing the facial landmarks on image
mp_drawing
=
mp.solutions.drawing_utils
让我们研究一下整体模型的参数:
- Holistic(
- static_image_mode=False,
- model_complexity=1,
- smooth_landmarks=True,
- min_detection_confidence=0.5,
- min_tracking_confidence=0.5
- )
- 复制代码
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。