python使用opencv实现人脸检测并模糊人脸功能代码

代码语言:python

所属分类:人工智能

代码描述:python使用opencv实现人脸检测并模糊人脸功能代码,可以实时模糊照片、视频、摄像头中的人脸

代码标签: 实现 人脸 检测 模糊 人脸 功能

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

import cv2
import numpy as np

# https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt
prototxt_path
= "/data/wwwroot/default/model/deploy.prototxt"
# https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180205_fp16/res10_300x300_ssd_iter_140000_fp16.caffemodel
model_path
= "/data/wwwroot/default/model/res10_300x300_ssd_iter_140000_fp16.caffemodel"

# load Caffe model
model
= cv2.dnn.readNetFromCaffe(prototxt_path, model_path)

# read the desired image
image
= cv2.imread("/data/wwwroot/default/asset/man.png")
# get width and height of the image
h
, w = image.shape[:2]
# gaussi.........完整代码请登录后点击上方下载按钮下载查看

网友评论0