Argus API
Argus Camera API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FaceDetect.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA CORPORATION nor the names of its
13  * contributors may be used to endorse or promote products derived
14  * from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _ARGUS_FACE_DETECT_H
30 #define _ARGUS_FACE_DETECT_H
31 
32 namespace Argus
33 {
34 
35 /**
36  * The Ext::FaceDetect extension adds internal face-detection algorithms to
37  * the Argus driver. It introduces four new interfaces:
38  * - IFaceDetectCaps; exposes the face detection capabilities of a CaptureSession.
39  * - IFaceDetectSettings; used to enable face detection for a Request.
40  * - IFaceDetectMetadata; returns a list of FaceDetectResult objects from a
41  * completed capture's CaptureMetadata.
42  * - IFaceDetectResult; exposes the image rect and confidence level of a result object
43  * returned by getFaceDetectResults.
44  */
45 DEFINE_UUID(ExtensionName, EXT_FACE_DETECT, 40412bb0,ba24,11e5,a837,08,00,20,0c,9a,66);
46 
47 namespace Ext
48 {
49 
50 /**
51  * @class IFaceDetectCaps
52  *
53  * Exposes the face detect capabilities of a CaptureSession.
54  */
55 DEFINE_UUID(InterfaceID, IID_FACE_DETECT_CAPS, 40412bb0,ba24,11e5,a837,08,00,20,0c,9a,66);
56 
57 class IFaceDetectCaps : public Interface
58 {
59 public:
60  static const InterfaceID& id() { return IID_FACE_DETECT_CAPS; }
61 
62  /**
63  * Returns the maximum number of faces that can be detected by the face detection
64  * algorithm per request. Returned value must be >= 1.
65  */
66  virtual uint32_t getMaxFaceDetectResults() const = 0;
67 
68 protected:
70 };
71 
72 /**
73  * @class IFaceDetectSettings
74  *
75  * Request settings used to configure face detection.
76  */
77 DEFINE_UUID(InterfaceID, IID_FACE_DETECT_SETTINGS, 40412bb1,ba24,11e5,a837,08,00,20,0c,9a,66);
78 
80 {
81 public:
82  static const InterfaceID& id() { return IID_FACE_DETECT_SETTINGS; }
83 
84  /**
85  * Enables or disables face detection. When face detection is enabled the CaptureMetadata
86  * returned by completed captures will expose the IFaceDetectMetadata interface and the
87  * FaceDetectResults returned by this interface will expose the IFaceDetectResults interface.
88  * @param[in] enable whether or not face detection is enabled.
89  */
90  virtual void setFaceDetectEnable(bool enable) = 0;
91 
92  /**
93  * @returns whether or not face detection is enabled.
94  */
95  virtual bool getFaceDetectEnable() const = 0;
96 
97 protected:
99 };
100 
101 /**
102  * @class IFaceDetectMetadata
103  *
104  * Exposes the face detect result objects in a CaptureMetadata object.
105  * These results objects must support at least IFaceDetectResult.
106  */
107 DEFINE_UUID(InterfaceID, IID_FACE_DETECT_METADATA, 40412bb2,ba24,11e5,a837,08,00,20,0c,9a,66);
108 
110 {
111 public:
112  static const InterfaceID& id() { return IID_FACE_DETECT_METADATA; }
113 
114  /**
115  * @returns the face detection results.
116  * @param[out] results, a vector that will be populated with the face detect results.
117  *
118  * @returns success/status of the call.
119  */
120  virtual Status getFaceDetectResults(std::vector<InterfaceProvider*>* results) const = 0;
121 
122 protected:
124 };
125 
126 /**
127  * @class IFaceDetectResult
128  *
129  * Exposes the image rect and confidence level of face detect result object returned
130  * by IFaceDetectMetadata.
131  */
132 DEFINE_UUID(InterfaceID, IID_FACE_DETECT_RESULT, 40412bb3,ba24,11e5,a837,08,00,20,0c,9a,66);
133 
135 {
136 public:
137  static const InterfaceID& id() { return IID_FACE_DETECT_RESULT; }
138 
139  /**
140  * @returns the normlized coordinates of the region containing the face, relative
141  * to the uncropped image sensor mode size.
142  */
143  virtual NormalizedRect getRect() const = 0;
144 
145  /**
146  * @returns the confidence level of the result. This confidence is in the range
147  * [0, 1], where 1 is the highest confidence. For a typical application that
148  * highlights faces in a scene, filtering results to ignore those with a
149  * confidence less than 0.5 is suggested.
150  */
151  virtual float getConfidence() const = 0;
152 
153 protected:
155 };
156 
157 } // namespace Ext
158 
159 } // namespace Argus
160 
161 #endif // _ARGUS_FACE_DETECT_H