OpenCV 4.5.3(日本語機械翻訳)
facemark_train.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4
5 /*
6 This file was part of GSoC Project: Facemark API for OpenCV
7 Final report: https://gist.github.com/kurnianggoro/74de9121e122ad0bd825176751d47ecc
8 Student: Laksono Kurnianggoro
9 Mentor: Delia Passalacqua
10 */
11
12 #ifndef __OPENCV_FACELANDMARKTRAIN_HPP__
13 #define __OPENCV_FACELANDMARKTRAIN_HPP__
14
21 #include "opencv2/face/facemark.hpp"
22 #include "opencv2/objdetect.hpp"
23 #include <vector>
24 #include <string>
25
26
27 namespace cv {
28 namespace face {
29
32
33 typedef bool(*FN_FaceDetector)(InputArray, OutputArray, void* userData);
34
35 struct CParams{
36 String cascade;
37 double scaleFactor;
41
42 CV_EXPORTS CParams(
43 String cascade_model,
44 double sf = 1.1,
45 int minN = 3,
46 Size minSz = Size(30, 30),
47 Size maxSz = Size()
48 );
49
50 CascadeClassifier face_cascade;
51};
52
74 CV_EXPORTS bool getFaces(InputArray image, OutputArray faces, CParams* params);
75
76CV_EXPORTS_W bool getFacesHAAR(InputArray image, OutputArray faces, const String& face_cascade_name);
77
93 CV_EXPORTS_W bool loadDatasetList(String imageList,
94 String annotationList,
95 std::vector<String> & images,
96 std::vector<String> & annotations);
97
123 CV_EXPORTS_W bool loadTrainingData( String filename , std::vector<String> & images,
124 OutputArray facePoints,
125 char delim = ' ', float offset = 0.0f);
126
163 CV_EXPORTS_W bool loadTrainingData( String imageList, String groundTruth,
164 std::vector<String> & images,
165 OutputArray facePoints,
166 float offset = 0.0f);
167
184 CV_EXPORTS_W bool loadTrainingData(std::vector<String> filename,std::vector< std::vector<Point2f> >
185 &trainlandmarks,std::vector<String> & trainimages);
186
212 CV_EXPORTS_W bool loadFacePoints( String filename, OutputArray points,
213 float offset = 0.0f);
214
232 CV_EXPORTS_W void drawFacemarks( InputOutputArray image, InputArray points,
233 Scalar color = Scalar(255,0,0));
234
262 class CV_EXPORTS_W FacemarkTrain : public Facemark
263{
264 public:
308 virtual bool addTrainingSample(InputArray image, InputArray landmarks)=0;
309
328 virtual void training(void* parameters=0)=0;
329
351 virtual bool setFaceDetector(FN_FaceDetector detector, void* userData = 0)=0;
352
368 virtual bool getFaces(InputArray image, OutputArray faces)=0;
369
386 virtual bool getData(void * items=0)=0; // FIXIT
387}; /* Facemark*/
388
390} /* namespace face */
391} /* namespace cv */
392 #endif //__OPENCV_FACELANDMARKTRAIN_HPP__
Definition: mat.hpp:386
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
Cascade classifier class for object detection.
Definition: objdetect.hpp:225
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
Abstract base class for all facemark models
Definition: facemark.hpp:48
Abstract base class for trainable facemark models
Definition: facemark_train.hpp:263
virtual bool getData(void *items=0)=0
Get data from an algorithm
virtual bool setFaceDetector(FN_FaceDetector detector, void *userData=0)=0
Set a user defined face detector for the Facemark algorithm.
virtual bool getFaces(InputArray image, OutputArray faces)=0
Detect faces from a given image using default or user defined face detector. Some Algorithm might not...
virtual void training(void *parameters=0)=0
Trains a Facemark algorithm using the given dataset. Before the training process, training samples sh...
virtual bool addTrainingSample(InputArray image, InputArray landmarks)=0
Add one training sample to the trainer.
CV_EXPORTS_W bool loadFacePoints(String filename, OutputArray points, float offset=0.0f)
A utility to load facial landmark information from a given file.
CV_EXPORTS_W bool loadTrainingData(std::vector< String > filename, std::vector< std::vector< Point2f > > &trainlandmarks, std::vector< String > &trainimages)
This function extracts the data for training from .txt files which contains the corresponding image n...
CV_EXPORTS_W bool loadDatasetList(String imageList, String annotationList, std::vector< String > &images, std::vector< String > &annotations)
A utility to load list of paths to training image and annotation file.
CV_EXPORTS_W void drawFacemarks(InputOutputArray image, InputArray points, Scalar color=Scalar(255, 0, 0))
Utility to draw the detected facial landmark points
CV_EXPORTS bool getFaces(InputArray image, OutputArray faces, CParams *params)
Default face detector This function is mainly utilized by the implementation of a Facemark Algorithm....
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: facemark_train.hpp:35
int minNeighbors
Parameter specifying how many neighbors each candidate rectangle should have to retain it.
Definition: facemark_train.hpp:38
Size minSize
Minimum possible object size.
Definition: facemark_train.hpp:39
String cascade
the face detector
Definition: facemark_train.hpp:36
double scaleFactor
Parameter specifying how much the image size is reduced at each image scale.
Definition: facemark_train.hpp:37
Size maxSize
Maximum possible object size.
Definition: facemark_train.hpp:40