FaceDetect.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. * Copyright (c) 2016-2017, 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. * @file
  30. * <b>Libargus Extension: Face Detect API</b>
  31. *
  32. * @b Description: This file defines the FaceDetect extension.
  33. */
  34. #ifndef _ARGUS_FACE_DETECT_H
  35. #define _ARGUS_FACE_DETECT_H
  36. namespace Argus
  37. {
  38. /**
  39. * Adds internal face-detection algorithms. It introduces four new interfaces:
  40. * - Ext::IFaceDetectCaps; exposes the face detection capabilities of a CaptureSession.
  41. * - Ext::IFaceDetectSettings; enables face detection for a Request.
  42. * - Ext::IFaceDetectMetadata; returns a list of FaceDetectResult objects from a
  43. * completed capture's CaptureMetadata.
  44. * - Ext::IFaceDetectResult; exposes the image rect and confidence level of a result object
  45. * returned by getFaceDetectResults.
  46. *
  47. * @defgroup ArgusExtFaceDetect Ext::FaceDetect
  48. * @ingroup ArgusExtensions
  49. */
  50. DEFINE_UUID(ExtensionName, EXT_FACE_DETECT, 40412bb0,ba24,11e5,a837,08,00,20,0c,9a,66);
  51. namespace Ext
  52. {
  53. /**
  54. * @class IFaceDetectCaps
  55. *
  56. * Interface to expose the face detection capabilities of a CaptureSession.
  57. *
  58. * @ingroup ArgusCaptureSession ArgusExtFaceDetect
  59. */
  60. DEFINE_UUID(InterfaceID, IID_FACE_DETECT_CAPS, 40412bb0,ba24,11e5,a837,08,00,20,0c,9a,66);
  61. class IFaceDetectCaps : public Interface
  62. {
  63. public:
  64. static const InterfaceID& id() { return IID_FACE_DETECT_CAPS; }
  65. /**
  66. * Returns the maximum number of faces that can be detected by the face detection
  67. * algorithm per request. Returned value must be >= 1.
  68. */
  69. virtual uint32_t getMaxFaceDetectResults() const = 0;
  70. protected:
  71. ~IFaceDetectCaps() {}
  72. };
  73. /**
  74. * @class IFaceDetectSettings
  75. *
  76. * Interface to face detection settings.
  77. *
  78. * @ingroup ArgusRequest ArgusExtFaceDetect
  79. */
  80. DEFINE_UUID(InterfaceID, IID_FACE_DETECT_SETTINGS, 40412bb1,ba24,11e5,a837,08,00,20,0c,9a,66);
  81. class IFaceDetectSettings : public Interface
  82. {
  83. public:
  84. static const InterfaceID& id() { return IID_FACE_DETECT_SETTINGS; }
  85. /**
  86. * Enables or disables face detection. When face detection is enabled the CaptureMetadata
  87. * returned by completed captures will expose the IFaceDetectMetadata interface and the
  88. * FaceDetectResults returned by this interface will expose the IFaceDetectResults interface.
  89. * @param[in] enable whether or not face detection is enabled.
  90. */
  91. virtual void setFaceDetectEnable(bool enable) = 0;
  92. /**
  93. * @returns whether or not face detection is enabled.
  94. */
  95. virtual bool getFaceDetectEnable() const = 0;
  96. protected:
  97. ~IFaceDetectSettings() {}
  98. };
  99. /**
  100. * @class IFaceDetectMetadata
  101. *
  102. * Interface to overall face detection results metadata.
  103. *
  104. * @ingroup ArgusCaptureMetadata ArgusExtFaceDetect
  105. *
  106. * @defgroup ArgusFaceDetectResult FaceDetectResult
  107. * Metadata for a single face detection result, returned by
  108. * Ext::IFaceDetectMetadata::getFaceDetectResults
  109. * @ingroup ArgusCaptureMetadata
  110. */
  111. DEFINE_UUID(InterfaceID, IID_FACE_DETECT_METADATA, 40412bb2,ba24,11e5,a837,08,00,20,0c,9a,66);
  112. class IFaceDetectMetadata : public Interface
  113. {
  114. public:
  115. static const InterfaceID& id() { return IID_FACE_DETECT_METADATA; }
  116. /**
  117. * @returns the face detection results.
  118. * @param[out] results A vector that will be populated with the face detect results.
  119. *
  120. * @returns success/status of the call.
  121. */
  122. virtual Status getFaceDetectResults(std::vector<InterfaceProvider*>* results) const = 0;
  123. protected:
  124. ~IFaceDetectMetadata() {}
  125. };
  126. /**
  127. * @class IFaceDetectResult
  128. *
  129. * Interface to the properties of a single face detection result.
  130. *
  131. * @ingroup ArgusFaceDetectResult ArgusExtFaceDetect
  132. */
  133. DEFINE_UUID(InterfaceID, IID_FACE_DETECT_RESULT, 40412bb3,ba24,11e5,a837,08,00,20,0c,9a,66);
  134. class IFaceDetectResult : public Interface
  135. {
  136. public:
  137. static const InterfaceID& id() { return IID_FACE_DETECT_RESULT; }
  138. /**
  139. * @returns the normlized coordinates of the region containing the face, relative
  140. * to the uncropped image sensor mode size.
  141. */
  142. virtual Rectangle<float> getRect() const = 0;
  143. /**
  144. * @returns the confidence level of the result. This confidence is in the range
  145. * [0, 1], where 1 is the highest confidence. For a typical application that
  146. * highlights faces in a scene, filtering results to ignore those with a
  147. * confidence less than 0.5 is suggested.
  148. */
  149. virtual float getConfidence() const = 0;
  150. protected:
  151. ~IFaceDetectResult() {}
  152. };
  153. } // namespace Ext
  154. } // namespace Argus
  155. #endif // _ARGUS_FACE_DETECT_H