| Face Engine SDK 5.31.2 A face detection, recognition and tracking engine.

SubImage.h
1 #pragma once
2
3 #include <fsdk/Types/Format.h>
4 #include <fsdk/Types/Rect.h>
5 #include <fsdk/Types/Vector2.h>
6
7 namespace fsdk {
13 struct SubImage {
14 void* data;
15
16 int pitch;
17
18 int x;
19 int y;
20
21 int width;
22 int height;
23
24 Format format;
25
28 SubImage() noexcept
29 : data(nullptr)
30 , pitch(0)
31 , x(0)
32 , y(0)
33 , width(0)
34 , height(0) {
35 }
36
39 template <typename T>
40 T* getDataAs() noexcept {
41 return reinterpret_cast<T*>(data);
42 }
43
46 template <typename T>
47 const T* getDataAs() const noexcept {
48 return reinterpret_cast<const T*>(data);
49 }
50
52 Point2i getOrigin() const noexcept {
53 return Point2i(x, y);
54 }
55
57 Size getSize() const noexcept {
58 return Size(width, height);
59 }
60
63 Rect getRect() const noexcept {
64 return Rect(x, y, width, height);
65 }
66
69 bool isValid() const noexcept {
70 return !(data == nullptr) && height > 0 && width > 0 && format.isValid();
71 }
72 };
73 } // namespace fsdk
fsdk::SubImage::getSize
Size getSize() const noexcept
Definition: SubImage.h:57
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Point2i
Vector2< int > Point2i
Definition: Vector2.h:294
fsdk::Format::isValid
bool isValid() const noexcept
Definition: Format.h:253
fsdk::Format
Image format.
Definition: Format.h:11
fsdk::SubImage::x
int x
Sub image origin x coordinate.
Definition: SubImage.h:18
fsdk::SubImage::height
int height
Sub image height.
Definition: SubImage.h:22
fsdk::SubImage::format
Format format
Sub image format.
Definition: SubImage.h:24
fsdk::SubImage::pitch
int pitch
Number of bytes to the next scanline of the sub image.
Definition: SubImage.h:16
fsdk::SubImage::y
int y
Sub image origin y coordinate.
Definition: SubImage.h:19
fsdk::SubImage::getDataAs
const T * getDataAs() const noexcept
Definition: SubImage.h:47
fsdk::SubImage::getOrigin
Point2i getOrigin() const noexcept
Definition: SubImage.h:52
fsdk::SubImage::data
void * data
Beginning of data sub image data.
Definition: SubImage.h:14
fsdk::SubImage::isValid
bool isValid() const noexcept
Definition: SubImage.h:69
fsdk::SubImage::width
int width
Sub image width.
Definition: SubImage.h:21
fsdk::SubImage::SubImage
SubImage() noexcept
intializes empty sub image.
Definition: SubImage.h:28
fsdk::SubImage::getRect
Rect getRect() const noexcept
Definition: SubImage.h:63
fsdk::SubImage::getDataAs
T * getDataAs() noexcept
Definition: SubImage.h:40
fsdk::BaseRect< int >
fsdk::SubImage
Sub Image.
Definition: SubImage.h:13
fsdk::Size
Vector2< int > Size
Definition: Vector2.h:303
fsdk::Vector2< int >