Face Engine SDK
5.8.0
A face detection, recognition and tracking engine.
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
Format.h
1
#pragma once
2
3
#include <cassert>
4
5
namespace
fsdk
6
{
7
11
struct
Format
{
12
15
enum
Type
{
16
Unknown
,
17
B8G8R8X8
,
18
R8G8B8X8
,
19
B8G8R8
,
20
R8G8B8
,
21
R8
,
22
R16
,
23
IR_X8X8X8
,
24
YUV_NV21
,
25
YUV_NV12
26
};
27
34
int
getChannelCount
() const noexcept {
35
switch
(
m_type
) {
36
case
B8G8R8X8
:
37
case
R8G8B8X8
:
38
case
B8G8R8
:
39
case
R8G8B8
:
40
case
IR_X8X8X8
:
41
case
YUV_NV21
:
42
case
YUV_NV12
:
43
return
3;
44
case
R8
:
45
case
R16
:
46
return
1;
47
default
:
48
return
0;
49
}
50
}
51
56
int
getChannelStep
() const noexcept {
57
switch
(
m_type
) {
58
case
B8G8R8X8
:
59
case
R8G8B8X8
:
60
return
4;
61
case
B8G8R8
:
62
case
R8G8B8
:
63
case
IR_X8X8X8
:
64
return
3;
65
case
R8
:
66
case
R16
:
67
case
YUV_NV21
:
68
case
YUV_NV12
:
69
return
1;
70
default
:
71
return
0;
72
}
73
}
74
78
int
getChannelSize
() const noexcept {
79
switch
(
m_type
) {
80
case
B8G8R8X8
:
81
case
R8G8B8X8
:
82
case
B8G8R8
:
83
case
R8G8B8
:
84
case
IR_X8X8X8
:
85
case
R8
:
86
return
8;
87
case
R16
:
88
return
16;
89
case
YUV_NV21
:
90
case
YUV_NV12
:
91
return
12;
92
default
:
93
return
0;
94
}
95
}
96
100
int
getBitDepth
() const noexcept {
101
return
getChannelStep
() *
getChannelSize
();
102
}
103
107
int
getByteDepth
() const noexcept {
108
if
(
isBlock
()) {
109
assert(!
"Not implemented"
);
110
return
0;
111
}
112
else
{
113
return
getBitDepth
() >> 3;
114
}
115
}
116
121
int
computePitch
(
int
rowWidth)
const
noexcept {
122
return
rowWidth *
getByteDepth
();
123
}
124
127
bool
isPadded
() const noexcept {
128
switch
(
m_type
) {
129
case
B8G8R8X8
:
130
case
R8G8B8X8
:
131
return
true
;
132
default
:
133
return
false
;
134
}
135
}
136
141
bool
isBGR
() const noexcept {
142
switch
(
m_type
) {
143
case
B8G8R8X8
:
144
case
B8G8R8
:
145
return
true
;
146
default
:
147
return
false
;
148
}
149
}
150
153
bool
isYUV
() const noexcept {
154
switch
(
m_type
) {
155
case
YUV_NV21
:
156
case
YUV_NV12
:
157
return
true
;
158
default
:
159
return
false
;
160
}
161
}
162
167
bool
isBlock
() const noexcept {
168
return
false
;
169
}
170
174
bool
isValid
() const noexcept {
175
return
m_type
!=
Unknown
;
176
}
177
181
Format
() noexcept :
m_type
(
Unknown
) {}
182
186
Format
(
Type
type) noexcept :
m_type
(type) {}
187
189
operator
Type
() const noexcept {
190
return
m_type
;
191
}
192
193
protected
:
194
Type
m_type
;
195
};
196
}
197
198
fsdk::Format::getBitDepth
int getBitDepth() const noexcept
Get number of bits per pixel.
Definition:
Format.h:100
fsdk::Format::getChannelSize
int getChannelSize() const noexcept
Get color channel size in bits.
Definition:
Format.h:78
fsdk::Format::R8G8B8
3 channel, 8 bit per channel, R-G-B color order format;
Definition:
Format.h:20
fsdk::Format::Unknown
unknown format.
Definition:
Format.h:16
fsdk::Format::getChannelStep
int getChannelStep() const noexcept
Get channel step.
Definition:
Format.h:56
fsdk::Format::isBlock
bool isBlock() const noexcept
Definition:
Format.h:167
fsdk::Format::Format
Format() noexcept
Initializes format structure.
Definition:
Format.h:181
fsdk::Format::computePitch
int computePitch(int rowWidth) const noexcept
Compute row size in bytes.
Definition:
Format.h:121
fsdk::Format::isValid
bool isValid() const noexcept
Definition:
Format.h:174
fsdk::Format
Image format.
Definition:
Format.h:11
fsdk::Format::isBGR
bool isBGR() const noexcept
Definition:
Format.h:141
fsdk::Format::getChannelCount
int getChannelCount() const noexcept
Get color channel count.
Definition:
Format.h:34
fsdk::Format::YUV_NV12
4:2:0 planar format with a plane of 8-bit Y samples followed by interleaved 2x2 subsampled U/V 8-bit ...
Definition:
Format.h:25
fsdk::Format::getByteDepth
int getByteDepth() const noexcept
Get number of bytes per pixel.
Definition:
Format.h:107
fsdk::Format::B8G8R8
3 channel, 8 bit per channel, B-G-R color order format;
Definition:
Format.h:19
fsdk::Format::Type
Type
Format type enumeration.
Definition:
Format.h:15
fsdk::Format::m_type
Type m_type
Format type.
Definition:
Format.h:194
fsdk::Format::isPadded
bool isPadded() const noexcept
Definition:
Format.h:127
fsdk::Format::R8
1 channel, 8 bit per channel format;
Definition:
Format.h:21
fsdk::Format::B8G8R8X8
3 channel, 8 bit per channel, B-G-R color order format with 8 bit padding before next pixel; ...
Definition:
Format.h:17
fsdk::Format::R16
1 channel, 16 bit per channel format;
Definition:
Format.h:22
fsdk::Format::R8G8B8X8
3 channel, 8 bit per channel, R-G-B color order format with 8 bit padding before next pixel; ...
Definition:
Format.h:18
fsdk::Format::YUV_NV21
4:2:0 planar format with a plane of 8-bit Y samples followed by interleaved 2x2 subsampled V/U 8-bit ...
Definition:
Format.h:24
fsdk::Format::isYUV
bool isYUV() const noexcept
Definition:
Format.h:153
fsdk::Format::Format
Format(Type type) noexcept
Initializes format structure.
Definition:
Format.h:186
fsdk::Format::IR_X8X8X8
3 channel, 8 bit per channel format with InfraRed semantics;
Definition:
Format.h:23
include
fsdk
Types
Format.h
Generated on Fri Jun 17 2022 12:22:25 for Face Engine SDK by
1.8.5