python - OpenCV+Python 人脸检测器改变矩形大小(大 25%)
问题描述
我想改变这个人脸检测器的矩形大小,我需要它大 25%:
import cv2
# Load the cascade
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
# Read the input image
img = cv2.imread('test.jpg')
# Convert into grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Detect faces
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
# Draw rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
# Display the output
cv2.imshow('img', img)
cv2.waitKey()
但我不知道该怎么做
解决方案
推荐阅读
- windows - dial tcp [::1]:6397: connectex: 由于目标机器主动拒绝,无法建立连接
- python-3.x - 将数字添加到列表的开头
- python - Python从文本文件中删除单词和字符
- windows - 运行独立的 Windows Powershell
- latex - Pandoc:[警告] 无法转换 TeX 数学
- python - 将数字中的月份转换为单词
- sapui5 - 从 OData 响应将默认值绑定到 Combox
- angular - 初始化我的 Angular 6 项目失败:原理图不起作用
- javascript - 更改字符串值的字体颜色
- javascript - 动画时间没有持续时间?