我遇到过这个用于人脸检测和图像裁剪的link。我想使用这个脚本,但我有cv2安装,只导入cv2作品,但没有导入简历。
如何将以下函数中的cv函数转换为cv2函数?
def faces_from_pil_image(pil_image):
"Return a list of (x,y,h,w) tuples for faces detected in the PIL image"
storage = cv.CreateMemStorage(0)
facial_features = cv.Load('haarcascade_frontalface_alt.xml', storage=storage)
cv_im = cv.CreateImageHeader(pil_image.size, cv.IPL_DEPTH_8U, 3)
cv.SetData(cv_im, pil_image.tostring())
faces = cv.HaarDetectObjects(cv_im, facial_features, storage)
# faces includes a `neighbors` field that we aren't going to use here
return [f[0] for f in faces]发布于 2016-06-14 17:01:18
要么使用
import cv2
storage = cv2.cv.CreateMemStorage(0)或
from cv2 import *
storage = cv.CreateMemStorage(0)https://stackoverflow.com/questions/37807268
复制相似问题