OpenCV 4.13.0
开源计算机视觉库 (Open Source Computer Vision)
正在加载...
正在搜索...
未找到匹配项
面部分析

详细说明

类  cv::face::BasicFaceRecognizer
 
结构体  cv::face::CParams
 
类  cv::face::EigenFaceRecognizer
 
类  cv::face::Facemark
 所有面部标记模型的抽象基类。更多...
 
类  cv::face::FacemarkAAM
 
类  cv::face::FacemarkLBF
 
类  cv::face::FacemarkTrain
 所有可训练的面部标记模型的抽象基类。更多...
 
类  cv::face::FaceRecognizer
 所有面部识别模型的抽象基类。更多...
 
类  cv::face::FisherFaceRecognizer
 
类  cv::face::LBPHFaceRecognizer
 
类  cv::face::MACE
 Minimum Average Correlation Energy Filter,可用于通过(可取消的)生物特征进行身份验证。(训练无需大量正样本(10-50),也无需负样本,并且对噪声/加盐具有鲁棒性)更多...
 
类  cv::face::PredictCollector
 所有预测结果处理策略的抽象基类。更多...
 
类  cv::face::StandardCollector
 默认预测收集器。更多...
 

类型定义 (Typedefs)

typedef bool(* cv::face::FN_FaceDetector) (InputArray, OutputArray, void *userData)
 

函数

Ptr< Facemarkcv::face::createFacemarkAAM ()
 构建一个 AAM 面部标记检测器
 
Ptr< Facemarkcv::face::createFacemarkKazemi ()
 构建一个 Kazemi 面部标记检测器
 
Ptr< Facemarkcv::face::createFacemarkLBF ()
 构建一个 LBF 面部标记检测器
 
void cv::face::drawFacemarks (InputOutputArray image, InputArray points, Scalar color=Scalar(255, 0, 0))
 用于绘制检测到的面部标志点的实用函数。
 
bool cv::face::getFaces (InputArray image, OutputArray faces, CParams *params)
 默认面部检测器此函数主要由 Facemark Algorithm 实现使用。建议最终用户使用 Facemark::getFaces 函数,该函数可以手动定义并通过 Facemark::setFaceDetector 绕过算法。
 
bool cv::face::getFacesHAAR (InputArray image, OutputArray faces, const String &face_cascade_name)
 
bool cv::face::loadDatasetList (String imageList, String annotationList, std::vector< String > &images, std::vector< String > &annotations)
 加载训练图像和注释文件路径列表的实用工具。
 
bool cv::face::loadFacePoints (String filename, OutputArray points, float offset=0.0f)
 从给定文件中加载面部标志信息的实用工具。
 
bool cv::face::loadTrainingData (std::vector< String > filename, std::vector< std::vector< Point2f > > &trainlandmarks, std::vector< String > &trainimages)
 此函数从包含相应图像名称和标志点的 .txt 文件中提取训练数据。每个文件中的第一个文件应给出正在文件中描述其标志点的图像的路径。然后,在后续行中,应包含图像中标志点的坐标,即每行应为 x,y 格式,其中 x 代表标志点的 x 坐标,y 代表标志点的 y 坐标。
 
bool cv::face::loadTrainingData (String filename, std::vector< String > &images, OutputArray facePoints, char delim=' ', float offset=0.0f)
 从单个文件加载面部标志数据集的实用工具。
 
bool cv::face::loadTrainingData (String imageList, String groundTruth, std::vector< String > &images, OutputArray facePoints, float offset=0.0f)
 从数据集中加载面部标志信息的实用工具。
 

类型定义文档 (Typedef Documentation)

◆ FN_FaceDetector

typedef bool(* cv::face::FN_FaceDetector) (InputArray, OutputArray, void *userData)

函数文档 (Function Documentation)

◆ createFacemarkAAM()

Ptr< Facemark > cv::face::createFacemarkAAM ( )
Python
cv.face.createFacemarkAAM() -> retval

#include <opencv2/face/facemark.hpp>

构建一个 AAM 面部标记检测器

◆ createFacemarkKazemi()

Ptr< Facemark > cv::face::createFacemarkKazemi ( )
Python
cv.face.createFacemarkKazemi() -> retval

#include <opencv2/face/facemark.hpp>

构建一个 Kazemi 面部标记检测器

◆ createFacemarkLBF()

Ptr< Facemark > cv::face::createFacemarkLBF ( )
Python
cv.face.createFacemarkLBF() -> retval

#include <opencv2/face/facemark.hpp>

构建一个 LBF 面部标记检测器

◆ drawFacemarks()

void cv::face::drawFacemarks ( InputOutputArray 图像,
InputArray points,
Scalar color = Scalar(255, 0, 0) )
Python
cv.face.drawFacemarks(image, points[, color]) -> 图像

#include <opencv2/face/facemark_train.hpp>

用于绘制检测到的面部标志点的实用函数。

参数
图像要处理的输入图像。
points包含将要绘制的点的数据。
color点的颜色,以 BGR 格式表示,由cv::Scalar表示。

使用示例

std::vector<Rect> faces;
std::vector<std::vector<Point2f> > landmarks;
facemark->getFaces(img, faces);
facemark->fit(img, faces, landmarks);
for(int j=0;j<rects.size();j++){
face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255));
}
Scalar_< double > Scalar
定义于 types.hpp:709
void drawFacemarks(InputOutputArray image, InputArray points, Scalar color=Scalar(255, 0, 0))
用于绘制检测到的面部标志点的实用函数。

◆ getFaces()

bool cv::face::getFaces ( InputArray 图像,
OutputArray faces,
CParams * params )

#include <opencv2/face/facemark_train.hpp>

默认面部检测器此函数主要由 Facemark Algorithm 实现使用。建议最终用户使用 Facemark::getFaces 函数,该函数可以手动定义并通过 Facemark::setFaceDetector 绕过算法。

参数
图像要处理的输入图像。
faces函数输出,表示检测到的面部的感兴趣区域。每个面部存储在cv::Rect容器中。
params检测器参数

使用示例

std::vector<cv::Rect> faces;
CParams params("haarcascade_frontalface_alt.xml");
cv::face::getFaces(frame, faces, &params);
for(int j=0;j<faces.size();j++){
cv::rectangle(frame, faces[j], cv::Scalar(255,0,255));
}
cv::imshow("detection", frame);
bool getFaces(InputArray image, OutputArray faces, CParams *params)
默认面部检测器此函数主要由 Facemark Algorithm 实现使用……
void imshow(const String &winname, InputArray mat)
在指定窗口中显示图像。
void rectangle(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
绘制一个简单的、粗线条的或填充的正矩形。
定义 facemark_train.hpp:29

◆ getFacesHAAR()

bool cv::face::getFacesHAAR ( InputArray 图像,
OutputArray faces,
const String & face_cascade_name )
Python
cv.face.getFacesHAAR(image, face_cascade_name[, faces]) -> 返回值, faces

◆ loadDatasetList()

bool cv::face::loadDatasetList ( String imageList,
String annotationList,
std::vector< String > & images,
std::vector< String > & annotations )
Python
cv.face.loadDatasetList(imageList, annotationList, images, annotations) -> retval

#include <opencv2/face/facemark_train.hpp>

加载训练图像和注释文件路径列表的实用工具。

参数
imageList指定的文件包含训练图像的路径。
annotationList指定的文件包含训练注释的路径。
images加载的训练图像路径。
annotations加载的注释文件路径。

使用示例

String imageFiles = "images_path.txt";
String ptsFiles = "annotations_path.txt";
std::vector<String> images_train;
std::vector<String> landmarks_train;
loadDatasetList(imageFiles,ptsFiles,images_train,landmarks_train);
std::string String
定义 cvstd.hpp:151
bool loadDatasetList(String imageList, String annotationList, std::vector< String > &images, std::vector< String > &annotations)
加载训练图像和注释文件路径列表的实用工具。

◆ loadFacePoints()

bool cv::face::loadFacePoints ( String filename,
OutputArray points,
float offset = 0.0f )
Python
cv.face.loadFacePoints(filename[, points[, offset]]) -> 返回值, points

#include <opencv2/face/facemark_train.hpp>

从给定文件中加载面部标志信息的实用工具。

参数
filename包含面部标志数据的文件名。
points加载的面部标志点。
offset用于调整加载点的偏移值。

使用示例

std::vector<Point2f> points;
face::loadFacePoints("filename.txt", points, 0.0f);
bool loadFacePoints(String filename, OutputArray points, float offset=0.0f)
从给定文件中加载面部标志信息的实用工具。

注释文件应遵循默认格式,即

version: 1
n_points: 68
{
212.716603 499.771793
230.232816 566.290071
...
}

其中 n_points 是考虑的点数,每个点由其在 x 和 y 中的位置表示。

◆ loadTrainingData() [1/3]

bool cv::face::loadTrainingData ( std::vector< String > filename,
std::vector<std::vector< Point2f > > & trainlandmarks,
std::vector< String > & trainimages )
Python
cv.face.loadTrainingData(filename, images[, facePoints[, delim[, offset]]]) -> retval, facePoints
cv.face.loadTrainingData(imageList, groundTruth, images[, facePoints[, offset]]) -> retval, facePoints
cv.face.loadTrainingData(filename, trainlandmarks, trainimages) -> retval

#include <opencv2/face/facemark_train.hpp>

此函数从包含相应图像名称和标志点的 .txt 文件中提取训练数据。每个文件中的第一个文件应给出正在文件中描述其标志点的图像的路径。然后,在后续行中,应包含图像中标志点的坐标,即每行应为 x,y 格式,其中 x 代表标志点的 x 坐标,y 代表标志点的 y 坐标。

有关参考,请参阅HELEN数据集中提供的文件。

参数
filename包含 .txt 文件名的 cv::String 类型向量。
trainlandmarks存储所有图像形状或标志点的 cv::Point2f 类型向量。
trainimages存储被跟踪的标志点图像名称的 cv::String 类型向量。
返回
一个布尔值。成功读取数据时返回 true,否则返回 false。

◆ loadTrainingData() [2/3]

bool cv::face::loadTrainingData ( String filename,
std::vector< String > & images,
OutputArray facePoints,
char delim = ' ',
float offset = 0.0f )
Python
cv.face.loadTrainingData(filename, images[, facePoints[, delim[, offset]]]) -> retval, facePoints
cv.face.loadTrainingData(imageList, groundTruth, images[, facePoints[, offset]]) -> retval, facePoints
cv.face.loadTrainingData(filename, trainlandmarks, trainimages) -> retval

#include <opencv2/face/facemark_train.hpp>

从单个文件加载面部标志数据集的实用工具。

参数
filename包含数据集信息的文件的文件名。每行包含一个图像的文件名,后跟用空格分隔的面部标志点 x 和 y 值的对。例如:
/home/user/ibug/image_003_1.jpg 336.820955 240.864510 334.238298 260.922709 335.266918 ...
/home/user/ibug/image_005_1.jpg 376.158428 230.845712 376.736984 254.924635 383.265403 ...
images存储数据集中图像文件名的向量。默认情况下不加载图像以节省内存。
facePoints所有训练数据的加载标志点。
delim每个元素之间的分隔符,默认为空格。
offset用于调整加载点的偏移值。

使用示例

cv::String imageFiles = "../data/images_train.txt";
cv::String ptsFiles = "../data/points_train.txt";
std::vector<String> images;
std::vector<std::vector<Point2f> > facePoints;
loadTrainingData(imageFiles, ptsFiles, images, facePoints, 0.0f);
bool loadTrainingData(String filename, std::vector< String > &images, OutputArray facePoints, char delim=' ', float offset=0.0f)
从单个文件加载面部标志数据集的实用工具。

◆ loadTrainingData() [3/3]

bool cv::face::loadTrainingData ( String imageList,
String groundTruth,
std::vector< String > & images,
OutputArray facePoints,
float offset = 0.0f )
Python
cv.face.loadTrainingData(filename, images[, facePoints[, delim[, offset]]]) -> retval, facePoints
cv.face.loadTrainingData(imageList, groundTruth, images[, facePoints[, offset]]) -> retval, facePoints
cv.face.loadTrainingData(filename, trainlandmarks, trainimages) -> retval

#include <opencv2/face/facemark_train.hpp>

从数据集中加载面部标志信息的实用工具。

参数
imageList一个包含训练数据集中图像文件名的文件。
groundTruth一个文件,其中包含存储标志点信息的文件的列表。每个文件中的内容应遵循标准格式(参见face::loadFacePoints)。
images存储数据集中图像文件名的向量。默认情况下不加载图像以节省内存。
facePoints所有训练数据的加载标志点。
offset用于调整加载点的偏移值。

使用示例

cv::String imageFiles = "../data/images_train.txt";
cv::String ptsFiles = "../data/points_train.txt";
std::vector<String> images;
std::vector<std::vector<Point2f> > facePoints;
loadTrainingData(imageFiles, ptsFiles, images, facePoints, 0.0f);

images_train.txt 中内容示例

/home/user/ibug/image_003_1.jpg
/home/user/ibug/image_004_1.jpg
/home/user/ibug/image_005_1.jpg
/home/user/ibug/image_006.jpg

points_train.txt 中内容示例

/home/user/ibug/image_003_1.pts
/home/user/ibug/image_004_1.pts
/home/user/ibug/image_005_1.pts
/home/user/ibug/image_006.pts