Face Engine SDK  5.23.1
A face detection, recognition and tracking engine.
include/fsdk/Types/Detection.h
00001 #pragma once
00002 
00003 #include <fsdk/Types/Rect.h>
00004 
00005 namespace fsdk {
00010     struct Detection {
00014         Detection() noexcept
00015             : m_rect{}
00016             , m_w{0}
00017             , m_h{0}
00018             , m_score{0.0f} {
00019         }
00020 
00028         Detection(FloatRect rect, float score = 1.f) noexcept
00029             : m_rect{rect}
00030             , m_w{static_cast<int>(rect.x + rect.width)}
00031             , m_h{static_cast<int>(rect.y + rect.height)}
00032             , m_score{score} {
00033         }
00034 
00042         Detection(FloatRect rect, int width, int height, float score = 1.f) noexcept
00043             : m_rect{rect}
00044             , m_w{width}
00045             , m_h{height}
00046             , m_score{score} {
00047         }
00048 
00054         Detection(FloatRect rect, Rect imageRect, float score = 1.f) noexcept
00055             : m_rect{rect}
00056             , m_w{imageRect.x + imageRect.width}
00057             , m_h{imageRect.y + imageRect.height}
00058             , m_score{score} {
00059         }
00060 
00061         Detection(const Detection& rhs) noexcept
00062             : m_rect{rhs.m_rect}
00063             , m_w{rhs.m_w}
00064             , m_h{rhs.m_h}
00065             , m_score{rhs.m_score} {
00066         }
00067 
00068         Detection& operator=(const Detection& rhs) noexcept {
00069             m_rect = rhs.m_rect;
00070             m_w = rhs.m_w;
00071             m_h = rhs.m_h;
00072             m_score = rhs.m_score;
00073             return *this;
00074         }
00075 
00080         Rect getRect() const noexcept {
00081             return m_rect & fsdk::Rect{0, 0, m_w, m_h};
00082         }
00083 
00088         FloatRect getRawRect() const noexcept {
00089             return m_rect;
00090         }
00091 
00097         void setRawRect(fsdk::FloatRect rect) noexcept {
00098             m_rect = rect;
00099         }
00100 
00101         float getScore() const noexcept {
00102             return m_score;
00103         }
00104 
00110         void setScore(float score) noexcept {
00111             m_score = score;
00112         }
00113 
00119         bool isValid() const noexcept {
00120             return m_rect.isValid() && m_score && m_w && m_h;
00121         }
00122 
00123     private:
00124         FloatRect m_rect; // Detection rect
00125         int m_w, m_h;     // Bounding width and height of the source image
00126         float m_score;    // Detection score
00127     };
00128 } // namespace fsdk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines