Face Engine SDK  5.25.0
A face detection, recognition and tracking engine.
include/fsdk/Types/SubImage.h
00001 #pragma once
00002 
00003 #include <fsdk/Types/Format.h>
00004 #include <fsdk/Types/Rect.h>
00005 #include <fsdk/Types/Vector2.h>
00006 
00007 namespace fsdk {
00013     struct SubImage {
00014         void* data; 
00015 
00016         int pitch; 
00017 
00018         int x; 
00019         int y; 
00020 
00021         int width;  
00022         int height; 
00023 
00024         Format format; 
00025 
00028         SubImage() noexcept
00029             : data(nullptr)
00030             , pitch(0)
00031             , x(0)
00032             , y(0)
00033             , width(0)
00034             , height(0) {
00035         }
00036 
00039         template <typename T>
00040         T* getDataAs() noexcept {
00041             return reinterpret_cast<T*>(data);
00042         }
00043 
00046         template <typename T>
00047         const T* getDataAs() const noexcept {
00048             return reinterpret_cast<const T*>(data);
00049         }
00050 
00052         Point2i getOrigin() const noexcept {
00053             return Point2i(x, y);
00054         }
00055 
00057         Size getSize() const noexcept {
00058             return Size(width, height);
00059         }
00060 
00063         Rect getRect() const noexcept {
00064             return Rect(x, y, width, height);
00065         }
00066 
00069         bool isValid() const noexcept {
00070             return !(data == nullptr) && height > 0 && width > 0 && format.isValid();
00071         }
00072     };
00073 } // namespace fsdk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines