summaryrefslogtreecommitdiff
path: root/thirdparty1/linux/include/opencv2/face
diff options
context:
space:
mode:
authorshamikam2017-01-16 02:56:17 +0530
committershamikam2017-01-16 02:56:17 +0530
commita6df67e8bcd5159cde27556f4f6a315f8dc2215f (patch)
treee806e966b06a53388fb300d89534354b222c2cad /thirdparty1/linux/include/opencv2/face
downloadFOSSEE_Image_Processing_Toolbox-master.tar.gz
FOSSEE_Image_Processing_Toolbox-master.tar.bz2
FOSSEE_Image_Processing_Toolbox-master.zip
First CommitHEADmaster
Diffstat (limited to 'thirdparty1/linux/include/opencv2/face')
-rw-r--r--thirdparty1/linux/include/opencv2/face/bif.hpp83
-rw-r--r--thirdparty1/linux/include/opencv2/face/facerec.hpp166
-rw-r--r--thirdparty1/linux/include/opencv2/face/predict_collector.hpp127
3 files changed, 376 insertions, 0 deletions
diff --git a/thirdparty1/linux/include/opencv2/face/bif.hpp b/thirdparty1/linux/include/opencv2/face/bif.hpp
new file mode 100644
index 0000000..c22c28c
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/face/bif.hpp
@@ -0,0 +1,83 @@
+/*
+By downloading, copying, installing or using the software you agree to this license.
+If you do not agree to this license, do not download, install,
+copy or use the software.
+
+
+ License Agreement
+ For Open Source Computer Vision Library
+ (3-clause BSD License)
+
+Copyright (C) 2000-2015, Intel Corporation, all rights reserved.
+Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+Copyright (C) 2009-2015, NVIDIA Corporation, all rights reserved.
+Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
+Copyright (C) 2015, OpenCV Foundation, all rights reserved.
+Copyright (C) 2015, Itseez Inc., all rights reserved.
+Third party copyrights are property of their respective owners.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the names of the copyright holders nor the names of the contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+This software is provided by the copyright holders and contributors "as is" and
+any express or implied warranties, including, but not limited to, the implied
+warranties of merchantability and fitness for a particular purpose are disclaimed.
+In no event shall copyright holders or contributors be liable for any direct,
+indirect, incidental, special, exemplary, or consequential damages
+(including, but not limited to, procurement of substitute goods or services;
+loss of use, data, or profits; or business interruption) however caused
+and on any theory of liability, whether in contract, strict liability,
+or tort (including negligence or otherwise) arising in any way out of
+the use of this software, even if advised of the possibility of such damage.
+*/
+
+#ifndef __OPENCV_BIF_HPP__
+#define __OPENCV_BIF_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace face {
+
+/** Implementation of bio-inspired features (BIF) from the paper:
+ * Guo, Guodong, et al. "Human age estimation using bio-inspired features."
+ * Computer Vision and Pattern Recognition, 2009. CVPR 2009.
+ */
+class CV_EXPORTS_W BIF : public Algorithm {
+public:
+ /** @returns The number of filter bands used for computing BIF. */
+ CV_WRAP virtual int getNumBands() const = 0;
+
+ /** @returns The number of image rotations. */
+ CV_WRAP virtual int getNumRotations() const = 0;
+
+ /** Computes features sby input image.
+ * @param image Input image (CV_32FC1).
+ * @param features Feature vector (CV_32FC1).
+ */
+ CV_WRAP virtual void compute(InputArray image,
+ OutputArray features) const = 0;
+};
+
+/**
+ * @param num_bands The number of filter bands (<=8) used for computing BIF.
+ * @param num_rotations The number of image rotations for computing BIF.
+ * @returns Object for computing BIF.
+ */
+CV_EXPORTS_W cv::Ptr<BIF> createBIF(int num_bands = 8, int num_rotations = 12);
+
+} // namespace cv
+} // namespace face
+
+#endif // #ifndef __OPENCV_FACEREC_HPP__
diff --git a/thirdparty1/linux/include/opencv2/face/facerec.hpp b/thirdparty1/linux/include/opencv2/face/facerec.hpp
new file mode 100644
index 0000000..40f62f1
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/face/facerec.hpp
@@ -0,0 +1,166 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (c) 2011,2012. Philipp Wagner <bytefish[at]gmx[dot]de>.
+// Third party copyrights are property of their respective owners.
+
+#ifndef __OPENCV_FACEREC_HPP__
+#define __OPENCV_FACEREC_HPP__
+
+#include "opencv2/face.hpp"
+#include "opencv2/core.hpp"
+
+namespace cv { namespace face {
+
+//! @addtogroup face
+//! @{
+
+// base for two classes
+class CV_EXPORTS_W BasicFaceRecognizer : public FaceRecognizer
+{
+public:
+ /** @see setNumComponents */
+ CV_WRAP virtual int getNumComponents() const = 0;
+ /** @copybrief getNumComponents @see getNumComponents */
+ CV_WRAP virtual void setNumComponents(int val) = 0;
+ /** @see setThreshold */
+ CV_WRAP virtual double getThreshold() const = 0;
+ /** @copybrief getThreshold @see getThreshold */
+ CV_WRAP virtual void setThreshold(double val) = 0;
+ CV_WRAP virtual std::vector<cv::Mat> getProjections() const = 0;
+ CV_WRAP virtual cv::Mat getLabels() const = 0;
+ CV_WRAP virtual cv::Mat getEigenValues() const = 0;
+ CV_WRAP virtual cv::Mat getEigenVectors() const = 0;
+ CV_WRAP virtual cv::Mat getMean() const = 0;
+};
+
+/**
+@param num_components The number of components (read: Eigenfaces) kept for this Principal
+Component Analysis. As a hint: There's no rule how many components (read: Eigenfaces) should be
+kept for good reconstruction capabilities. It is based on your input data, so experiment with the
+number. Keeping 80 components should almost always be sufficient.
+@param threshold The threshold applied in the prediction.
+
+### Notes:
+
+- Training and prediction must be done on grayscale images, use cvtColor to convert between the
+ color spaces.
+- **THE EIGENFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL
+ SIZE.** (caps-lock, because I got so many mails asking for this). You have to make sure your
+ input data has the correct shape, else a meaningful exception is thrown. Use resize to resize
+ the images.
+- This model does not support updating.
+
+### Model internal data:
+
+- num_components see createEigenFaceRecognizer.
+- threshold see createEigenFaceRecognizer.
+- eigenvalues The eigenvalues for this Principal Component Analysis (ordered descending).
+- eigenvectors The eigenvectors for this Principal Component Analysis (ordered by their
+ eigenvalue).
+- mean The sample mean calculated from the training data.
+- projections The projections of the training data.
+- labels The threshold applied in the prediction. If the distance to the nearest neighbor is
+ larger than the threshold, this method returns -1.
+ */
+CV_EXPORTS_W Ptr<BasicFaceRecognizer> createEigenFaceRecognizer(int num_components = 0, double threshold = DBL_MAX);
+
+/**
+@param num_components The number of components (read: Fisherfaces) kept for this Linear
+Discriminant Analysis with the Fisherfaces criterion. It's useful to keep all components, that
+means the number of your classes c (read: subjects, persons you want to recognize). If you leave
+this at the default (0) or set it to a value less-equal 0 or greater (c-1), it will be set to the
+correct number (c-1) automatically.
+@param threshold The threshold applied in the prediction. If the distance to the nearest neighbor
+is larger than the threshold, this method returns -1.
+
+### Notes:
+
+- Training and prediction must be done on grayscale images, use cvtColor to convert between the
+ color spaces.
+- **THE FISHERFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL
+ SIZE.** (caps-lock, because I got so many mails asking for this). You have to make sure your
+ input data has the correct shape, else a meaningful exception is thrown. Use resize to resize
+ the images.
+- This model does not support updating.
+
+### Model internal data:
+
+- num_components see createFisherFaceRecognizer.
+- threshold see createFisherFaceRecognizer.
+- eigenvalues The eigenvalues for this Linear Discriminant Analysis (ordered descending).
+- eigenvectors The eigenvectors for this Linear Discriminant Analysis (ordered by their
+ eigenvalue).
+- mean The sample mean calculated from the training data.
+- projections The projections of the training data.
+- labels The labels corresponding to the projections.
+ */
+CV_EXPORTS_W Ptr<BasicFaceRecognizer> createFisherFaceRecognizer(int num_components = 0, double threshold = DBL_MAX);
+
+class CV_EXPORTS_W LBPHFaceRecognizer : public FaceRecognizer
+{
+public:
+ /** @see setGridX */
+ CV_WRAP virtual int getGridX() const = 0;
+ /** @copybrief getGridX @see getGridX */
+ CV_WRAP virtual void setGridX(int val) = 0;
+ /** @see setGridY */
+ CV_WRAP virtual int getGridY() const = 0;
+ /** @copybrief getGridY @see getGridY */
+ CV_WRAP virtual void setGridY(int val) = 0;
+ /** @see setRadius */
+ CV_WRAP virtual int getRadius() const = 0;
+ /** @copybrief getRadius @see getRadius */
+ CV_WRAP virtual void setRadius(int val) = 0;
+ /** @see setNeighbors */
+ CV_WRAP virtual int getNeighbors() const = 0;
+ /** @copybrief getNeighbors @see getNeighbors */
+ CV_WRAP virtual void setNeighbors(int val) = 0;
+ /** @see setThreshold */
+ CV_WRAP virtual double getThreshold() const = 0;
+ /** @copybrief getThreshold @see getThreshold */
+ CV_WRAP virtual void setThreshold(double val) = 0;
+ CV_WRAP virtual std::vector<cv::Mat> getHistograms() const = 0;
+ CV_WRAP virtual cv::Mat getLabels() const = 0;
+};
+
+/**
+@param radius The radius used for building the Circular Local Binary Pattern. The greater the
+radius, the
+@param neighbors The number of sample points to build a Circular Local Binary Pattern from. An
+appropriate value is to use `8` sample points. Keep in mind: the more sample points you include,
+the higher the computational cost.
+@param grid_x The number of cells in the horizontal direction, 8 is a common value used in
+publications. The more cells, the finer the grid, the higher the dimensionality of the resulting
+feature vector.
+@param grid_y The number of cells in the vertical direction, 8 is a common value used in
+publications. The more cells, the finer the grid, the higher the dimensionality of the resulting
+feature vector.
+@param threshold The threshold applied in the prediction. If the distance to the nearest neighbor
+is larger than the threshold, this method returns -1.
+
+### Notes:
+
+- The Circular Local Binary Patterns (used in training and prediction) expect the data given as
+ grayscale images, use cvtColor to convert between the color spaces.
+- This model supports updating.
+
+### Model internal data:
+
+- radius see createLBPHFaceRecognizer.
+- neighbors see createLBPHFaceRecognizer.
+- grid_x see createLBPHFaceRecognizer.
+- grid_y see createLBPHFaceRecognizer.
+- threshold see createLBPHFaceRecognizer.
+- histograms Local Binary Patterns Histograms calculated from the given training data (empty if
+ none was given).
+- labels Labels corresponding to the calculated Local Binary Patterns Histograms.
+ */
+CV_EXPORTS_W Ptr<LBPHFaceRecognizer> createLBPHFaceRecognizer(int radius=1, int neighbors=8, int grid_x=8, int grid_y=8, double threshold = DBL_MAX);
+
+//! @}
+
+}} //namespace cv::face
+
+#endif //__OPENCV_FACEREC_HPP__
diff --git a/thirdparty1/linux/include/opencv2/face/predict_collector.hpp b/thirdparty1/linux/include/opencv2/face/predict_collector.hpp
new file mode 100644
index 0000000..a9f907d
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/face/predict_collector.hpp
@@ -0,0 +1,127 @@
+/*
+By downloading, copying, installing or using the software you agree to this license.
+If you do not agree to this license, do not download, install,
+copy or use the software.
+
+
+ License Agreement
+ For Open Source Computer Vision Library
+ (3-clause BSD License)
+
+Copyright (C) 2000-2015, Intel Corporation, all rights reserved.
+Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+Copyright (C) 2009-2015, NVIDIA Corporation, all rights reserved.
+Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
+Copyright (C) 2015, OpenCV Foundation, all rights reserved.
+Copyright (C) 2015, Itseez Inc., all rights reserved.
+Third party copyrights are property of their respective owners.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the names of the copyright holders nor the names of the contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+This software is provided by the copyright holders and contributors "as is" and
+any express or implied warranties, including, but not limited to, the implied
+warranties of merchantability and fitness for a particular purpose are disclaimed.
+In no event shall copyright holders or contributors be liable for any direct,
+indirect, incidental, special, exemplary, or consequential damages
+(including, but not limited to, procurement of substitute goods or services;
+loss of use, data, or profits; or business interruption) however caused
+and on any theory of liability, whether in contract, strict liability,
+or tort (including negligence or otherwise) arising in any way out of
+the use of this software, even if advised of the possibility of such damage.
+*/
+
+#ifndef __OPENCV_PREDICT_COLLECTOR_HPP__
+#define __OPENCV_PREDICT_COLLECTOR_HPP__
+
+#include <vector>
+#include <map>
+#include <utility>
+#include <cfloat>
+
+#include "opencv2/core/cvstd.hpp"
+
+namespace cv {
+namespace face {
+//! @addtogroup face
+//! @{
+/** @brief Abstract base class for all strategies of prediction result handling
+*/
+class CV_EXPORTS_W PredictCollector
+{
+public:
+ virtual ~PredictCollector() {}
+
+ /** @brief Interface method called by face recognizer before results processing
+ @param size total size of prediction evaluation that recognizer could perform
+ */
+ virtual void init(size_t size) { (void)size; }
+
+ /** @brief Interface method called by face recognizer for each result
+ @param label current prediction label
+ @param dist current prediction distance (confidence)
+ */
+ virtual bool collect(int label, double dist) = 0;
+};
+
+/** @brief Default predict collector
+
+Trace minimal distance with treshhold checking (that is default behavior for most predict logic)
+*/
+class CV_EXPORTS_W StandardCollector : public PredictCollector
+{
+public:
+ struct PredictResult
+ {
+ int label;
+ double distance;
+ PredictResult(int label_ = -1, double distance_ = DBL_MAX) : label(label_), distance(distance_) {}
+ };
+protected:
+ double threshold;
+ PredictResult minRes;
+ std::vector<PredictResult> data;
+public:
+ /** @brief Constructor
+ @param threshold_ set threshold
+ */
+ StandardCollector(double threshold_ = DBL_MAX);
+ /** @brief overloaded interface method */
+ void init(size_t size);
+ /** @brief overloaded interface method */
+ bool collect(int label, double dist);
+ /** @brief Returns label with minimal distance */
+ CV_WRAP int getMinLabel() const;
+ /** @brief Returns minimal distance value */
+ CV_WRAP double getMinDist() const;
+ /** @brief Return results as vector
+ @param sorted If set, results will be sorted by distance
+ Each values is a pair of label and distance.
+ */
+ CV_WRAP std::vector< std::pair<int, double> > getResults(bool sorted = false) const;
+ /** @brief Return results as map
+ Labels are keys, values are minimal distances
+ */
+ std::map<int, double> getResultsMap() const;
+ /** @brief Static constructor
+ @param threshold set threshold
+ */
+ CV_WRAP static Ptr<StandardCollector> create(double threshold = DBL_MAX);
+};
+
+//! @}
+}
+}
+
+#endif