Banuba SDK
Loading...
Searching...
No Matches
full_image.hpp
1#pragma once
2
3#if BNB_SDK_PROJECT
4 #include <bnb/types/config.hpp>
5#endif
7#include <bnb/types/base_types.hpp>
8#include <bnb/types/transformation.hpp>
9#include <bnb/utils/assert.hpp>
10#include <bnb/utils/event.hpp>
11#include <bnb/utils/defs.hpp>
12
13#include <type_traits>
14#include <variant>
15
16namespace bnb
17{
18 /**
19 * @addtogroup Types
20 * @{
21 */
22
23 /**
24 * bt601 and bt709 - two standards for representing color space that use the same
25 * image encoding/decoding algorithm. Differ in the encoding / decoding coefficients.
26 */
27 // clang-format off
28 enum class pixel_buffer_format : int32_t
29 {
30 bpc8_rgb = 0x0101, // one plane: RGB
31 bpc8_bgr = 0x0102, // one plane: BGR
32 bpc8_rgba = 0x0103, // one plane: RGBA
33 bpc8_bgra = 0x0104, // one plane: BGRA
34 bpc8_argb = 0x0105, // one plane: ARGB
35 nv12 = 0x0201, // two planes: first RED, second RG
36 i420 = 0x0401 // three planes: first RED, second RED, third RED
37 }; // enum class pixel_buffer_format
38 // clang-format on
39
40 inline bool pixel_buffer_format_is_bpc8(pixel_buffer_format format)
41 {
42 return static_cast<bool>(static_cast<int32_t>(format) & 0x0100);
43 }
44
45 inline bool pixel_buffer_format_is_nv12(pixel_buffer_format format)
46 {
47 return static_cast<bool>(static_cast<int32_t>(format) & 0x0200);
48 }
49
50 inline bool pixel_buffer_format_is_i420(pixel_buffer_format format)
51 {
52 return static_cast<bool>(static_cast<int32_t>(format) & 0x0400);
53 }
54
55 inline bool pixel_buffer_format_is_yuv(pixel_buffer_format format)
56 {
57 return static_cast<bool>(static_cast<int32_t>(format) & 0x0600);
58 }
59
60 inline std::string_view pixel_buffer_format_to_str(pixel_buffer_format format)
61 {
62 switch (format) {
63 case pixel_buffer_format::bpc8_rgb:
64 return "bpc8_rgb";
65 case pixel_buffer_format::bpc8_bgr:
66 return "bpc8_bgr";
67 case pixel_buffer_format::bpc8_rgba:
68 return "bpc8_rgba";
69 case pixel_buffer_format::bpc8_bgra:
70 return "bpc8_bgra";
71 case pixel_buffer_format::bpc8_argb:
72 return "bpc8_argb";
73 case pixel_buffer_format::nv12:
74 return "nv12";
75 case pixel_buffer_format::i420:
76 return "i420";
77 }
78 BNB_THROW(std::invalid_argument, "Unknown format.");
79 }
80
81 /**
82 * A structure stores format information about image.
83 *
84 */
85 struct BNB_EXPORT image_format
86 {
87 /** It is a width of image in pixels. */
88 uint32_t width = 0;
89 /** It is a height of image in pixels. */
90 uint32_t height = 0;
91 /** It is a field of view in degrees. */
92 std::optional<float> fov = std::nullopt;
93
94 /** It is a camera orientation in degrees as enum value (@see camera_orientation). */
95 camera_orientation orientation = camera_orientation::deg_270;
96
97 /** This value is responsible for mirroring image during rendering. */
98 bool require_mirroring = false;
99 /** It is a face orientation in degrees. */
100 int face_orientation = 0;
101
102 /**
103 * @return Returns the image size in pixels, i.e. width * height.
104 */
105 uint32_t size() const noexcept;
106
107 /**
108 * Construct a new image format object with default values.
109 *
110 */
111 image_format() = default;
112
113 /**
114 * Construct a new image format object with user's params.
115 *
116 * @param width is a width of image in pixels.
117 * @param height is a height of image in pixels.
118 * @param orientation is a camera orientation in degrees as enum value (@see camera_orientation).
119 * @param require_mirroring is a variable responsible for mirroring image during rendering, i.e. if it is true the image will mirror during rendering and won't in another way.
120 * @param face_orientation is a face orientation in degrees.
121 * @param fov is a field of view in degrees.
122 */
123 image_format(uint32_t width, uint32_t height, camera_orientation orientation, bool require_mirroring, int face_orientation, std::optional<float> fov = std::nullopt);
124 };
125
126
127 /**
128 * A base class for *_image_t classes.
129 *
130 */
131 class BNB_EXPORT base_image_t
132 {
133 public:
134 /**
135 * @brief Construct a new base_image_t object with default values.
136 *
137 */
138 base_image_t() = default;
139
140 /**
141 *
142 * @return Returns a const reference for image format (@see image_format)
143 */
144 const image_format& get_format() const;
145
146 /**
147 * Set the field of view.
148 *
149 * @param fov is a field of view in degrees.
150 */
151 void set_fov(float fov)
152 {
153 m_format.fov = fov;
154 }
155
156 protected:
157 explicit base_image_t(const image_format& format);
158
159 image_format m_format;
160 };
161
162 /**
163 * A class for representing bpc8 images as C++ object.
164 *
165 */
166 class BNB_EXPORT bpc8_image_t final : public base_image_t
167 {
168 public:
169 using pixel_format_t = bnb::interfaces::pixel_format; /** enum value represents pixel format (@see pixel_format) */
170
171 /**
172 * Construct a new bpc8_image_t object with default values.
173 *
174 */
175 bpc8_image_t() = default;
176
177 /**
178 * Construct a new bpc8_image_t object using move semantics.
179 *
180 */
182 bpc8_image_t& operator=(bpc8_image_t&& other) = default;
183
184 /**
185 * Construct a new bpc8_image_t object using copy operation.
186 *
187 */
188 bpc8_image_t(const bpc8_image_t&) = default;
189 bpc8_image_t& operator=(const bpc8_image_t&) = default;
190
191 /**
192 * @brief Construct a new bpc8_image_t object with user's values.
193 *
194 * @param data is a color plane data (@see color_plane).
195 * @param type is a pixel format as enum value (@see pixe_format_t).
196 * @param format is a image format (@see image_format).
197 */
198 bpc8_image_t(color_plane data, pixel_format_t type, const image_format& format);
199
200 /**
201 * @return Returns the pixel format as enum value (@see pixe_format_t).
202 *
203 */
204 pixel_format_t get_pixel_format() const noexcept;
205
206 /**
207 * @return Returns a raw pointer on data of image.
208 */
209 uint8_t* get_data() const noexcept;
210
211 /**
212 * @return Returns count of bytes per pixel for pixel format (@p fmt).
213 */
214 static uint8_t bytes_per_pixel(pixel_format_t fmt);
215 /**
216 * @return Returns offsets for every component of rgb in bytes.
217 */
218 static std::tuple<int, int, int> rgb_offsets(pixel_format_t fmt);
219
220 /**
221 * @return Returns RGB pixel at position
222 */
223 std::tuple<uint8_t, uint8_t, uint8_t> rgb_pixel_at(uint32_t x, uint32_t y) const noexcept;
224
225 /**
226 * Normalize image data if it is required to be mirrored or camera orientation isn't deg_0.
227 */
228 void normalize_orientation(bnb::transformation const& basis_transform, bnb::pixel_rect const& full_roi);
229
230 private:
231 pixel_format_t m_pixel_format;
232 color_plane m_data;
233 };
234
235 /**
236 * Enum class represents color range.
237 *
238 */
239 enum class color_range
240 {
241 video, /** for y values range is 16-235, for u and v values range is 16-240 */
242 full, /** for y, u and v values range is 0-255 */
243 };
244
245 /**
246 * Enum class represents suppotred color standarts.
247 *
248 */
249 enum class color_std
250 {
251 bt601,
252 bt709,
253 };
254
255 /**
256 * Enum class represents supported yuv formats.
257 *
258 */
259 enum class yuv_format
260 {
261 yuv_nv12,
262 yuv_i420,
263 };
264
265 /**
266 * Struture stores all information about yuv format.
267 *
268 */
270 {
271 color_range range; // i.e. "full" or "video"
272 color_std standard; // i.e. BT.601 or BT.709
273 yuv_format format; // i.e. NV12 or I420
274 };
275
276 /**
277 * Clas represents yuv image as C++ object.
278 *
279 */
280 class BNB_EXPORT yuv_image_t final : public base_image_t
281 {
282 public:
283 /**
284 * @return Returns the color plane by its object and yuv image format.
285 */
286 template<size_t index>
287 const color_plane get_plane() const
288 {
289 switch (index) {
290 case 0: {
291 return m_planes[0];
292 }
293 case 1: {
294 return m_planes[1];
295 }
296 case 2: {
297 switch (m_yuv_format.format) {
298 case yuv_format::yuv_nv12: {
299 BNB_THROW(std::invalid_argument, "yuv nv12 format has only 2 planes");
300 }
301 case yuv_format::yuv_i420: {
302 return m_planes[2];
303 }
304 default: {
305 BNB_THROW(std::invalid_argument, "Incorrect yuv format");
306 }
307 }
308 }
309 default: {
310 BNB_THROW(std::invalid_argument, "Incorrect index of plane");
311 }
312 }
313 };
314
315 /**
316 * Construct a new yuv_image_t object with user's values (for yuv_nv12 format).
317 *
318 * @param y_plane is the zeroyth plane of image.
319 * @param uv_plane is the uv plane of image.
320 * @param format is a image format (@see image_format).
321 * @param yuv_format is a yuv image format (@see yuv_image_t).
322 */
323 yuv_image_t(color_plane y_plane, color_plane uv_plane, const image_format& format, const yuv_format_t& yuv_format)
324 : base_image_t(format)
325 , m_yuv_format(yuv_format)
326 {
327 m_planes[0] = std::move(y_plane);
328 m_planes[1] = std::move(uv_plane);
329 }
330
331 /**
332 * Construct a new yuv image t object with user's values (for yuv_i420 format).
333 *
334 * @param y_plane is the y plane of image.
335 * @param u_plane is the u plane of image.
336 * @param v_plane is the v plane of image.
337 * @param format is a image format (@see image_format).
338 * @param yuv_format is a yuv image format (@see yuv_image_t).
339 */
340 yuv_image_t(color_plane y_plane, color_plane u_plane, color_plane v_plane, const image_format& format, const yuv_format_t& yuv_format)
341 : base_image_t(format)
342 , m_yuv_format(yuv_format)
343 {
344 m_planes[0] = std::move(y_plane);
345 m_planes[1] = std::move(u_plane);
346 m_planes[2] = std::move(v_plane);
347 }
348
349 /**
350 * Construct a new yuv image t object wioth user's values but with default yuv image format.
351 *
352 * @param y_plane is the y plane of image.
353 * @param uv_plane is the uv plane of image.
354 * @param format is a image format (@see image_format).
355 */
356 yuv_image_t(color_plane y_plane, color_plane uv_plane, const image_format& format)
357 : base_image_t(format)
358 {
359 m_yuv_format.range = color_range::full;
360 m_yuv_format.format = yuv_format::yuv_nv12;
361 m_yuv_format.standard = color_std::bt601;
362
363 m_planes[0] = std::move(y_plane);
364 m_planes[1] = std::move(uv_plane);
365 }
366
367 /**
368 * @return Returns the size of y plane of image
369 */
370 size_t y_size() const noexcept;
371 /**
372 * @return Returns the size of uv plane of image.
373 */
374 size_t uv_size() const noexcept;
375
376 using conversion_matrix = std::array<float, 16>;
377
378 // NOTE: Matrix should be transposed to multiply vector-row by matrix.
379 virtual conversion_matrix get_yuv_to_rgb_matrix() const;
380 virtual conversion_matrix get_rgb_to_yuv_matrix() const;
381
382 /**
383 * @return Returns the pixel's value of y plane with coords @p xi and @p yi.
384 */
385 uint8_t y_pixel_at(uint32_t xi, uint32_t yi) const noexcept;
386 /**
387 * @return Returns the pixel's value of uv plane with coords @p xi and @p yi.
388 */
389 uint8_t uv_pixel_at(uint32_t xi, uint32_t yi, uint32_t offset) const noexcept;
390
391 /**
392 * @return Returns the pixel's value of u plane with coords @p xi and @p yi.
393 */
394 uint8_t u_pixel_at(uint32_t xi, uint32_t yi) const noexcept;
395 /**
396 * @return Returns the pixel's value of v plane with coords @p xi and @p yi.
397 */
398 uint8_t v_pixel_at(uint32_t xi, uint32_t yi) const noexcept;
399
400 /**
401 * Construct a new yuv_image_t object with default params.
402 *
403 */
404 yuv_image_t() = default;
405
406 /**
407 * Construct a new yuv_image_t object using move semantics.
408 *
409 */
411 yuv_image_t& operator=(yuv_image_t&& other) = default;
412 /**
413 * Construct a new yuv image t object with copy operation.
414 *
415 */
416 yuv_image_t(const yuv_image_t&) = default;
417 yuv_image_t& operator=(const yuv_image_t&) = default;
418
419 /**
420 * Normalize image data if it is required to be mirrored or camera orientation isn't deg_0.
421 */
422 void normalize_orientation(bnb::transformation const& y_basis, bnb::transformation const& uv_basis, bnb::pixel_rect const& full_roi);
423
424 /**
425 * @return Returns the const reference on yuv_format of image (@see yuv_format_t).
426 */
427 const yuv_format_t& get_yuv_format() const noexcept;
428
429 /**
430 * @return Returns conversion matrix (@see conversion_matrix) for @p standard (@see color_std) and @p range (@see color_range) from yuv to rgb.
431 */
432 static const bnb::yuv_image_t::conversion_matrix& get_yuv_to_rgb_matrix(color_std standard, color_range range);
433 /**
434 * @return Returns conversion matrix (@see conversion_matrix) for @p standard (@see color_std) and @p range (@see color_range) from rgb to yuv.
435 */
436 static const bnb::yuv_image_t::conversion_matrix& get_rgb_to_yuv_matrix(color_std standard, color_range range);
437
438 private:
439 yuv_format_t m_yuv_format;
440
441 //[3] planes is optional for i420 formats
442 color_plane m_planes[3];
443 };
444
445 /// basis is the base basis:
446 /// for y/rgb basis use .basis or get_subchannel_basis_transform(1);
447 /// for uv basis use get_subchannel_basis_transform(2);
449 {
450 public:
451 /**
452 * A method for loading video from @p path with/whithout @p alpha.
453 *
454 * @param path is a full path to downloadable image.
455 * @param alpha is value responcible that image includes alpha channel.
456 * @return Returns full_image_t object with data of image from @p path or nullptr.
457 */
458 static full_image_t load(const std::string& path, bool alpha = false);
459
460 /**
461 * Construct a new full_image_t object with default params.
462 *
463 */
465
466 /**
467 * Construct a new full_image_t object from @p image.
468 *
469 * @param image is a C++ bpc8 image ( @see bpc8_image ) representation.
470 */
471 explicit full_image_t(bpc8_image_t image);
472 /**
473 * Construct a new full_image_t object from @p image.
474 *
475 * @param image is a C++ yuv image ( @see yuv_image ) representation.
476 */
477 explicit full_image_t(yuv_image_t image);
478
479 ~full_image_t() override;
480
481 /**
482 * Construct a new full_image_t object using copy operation.
483 *
484 */
486 full_image_t& operator=(const full_image_t&);
487
488 /**
489 * Construct a new full_image_t object using move semantics.
490 *
491 */
493 full_image_t& operator=(full_image_t&& other) noexcept;
494
495 /**
496 * @return Returns image format ( @see image_format ).
497 */
498 image_format get_format() const;
499 /**
500 * @return true if image orientation is landscape and false in another way.
501 */
502 bool is_landscape() const;
503
504 bnb::transformation get_subchannel_basis_transform(float inv_scale = 1.f) const
505 {
506 return basis_transform >> bnb::transformation(1.f / inv_scale, 1.f / inv_scale);
507 }
508
509 /**
510 * @return Returns bassis of image as row-major matrix 3x3 ( @see transformation ).
511 */
513 {
514 using rot_t = transformation::rotate_t;
515 return bnb::transformation(full_roi, full_roi, rot_t::deg_0, get_format().require_mirroring) >> basis_transform;
516 }
517
518 /**
519 * @return Returns the image object if T is yuv or bpc8 image and at the same time yuv or bpc8 image saved.
520 */
521 template<typename T>
522 const T& get_data() const noexcept;
523
524 /**
525 * @return Returns true if T is yuv or bpc8 image and at the same time yuv or bpc8 image saved.
526 */
527 template<typename T>
528 bool has_data() const noexcept;
529
530 /**
531 * @brief Set the field of view ( @p fov ) object.
532 *
533 * @param fov is a field of view in degrees.
534 */
535 void set_fov(float fov);
536
537 /**
538 * Normalize image data if it is required to be mirrored or camera orientation isn't deg_0.
539 */
540 void normalize_orientation();
541
542#if BNB_OS_ANDROID || BNB_OS_EMSCRIPTEN
543 unsigned ext_camera_tex_id = 0; /** external texture for optimisation on android (check this PR: https://bitbucket.org/BanubaLimited/banuba_sdk/pull-requests/4391 )*/
544 unsigned ext_camera_tex_width = 0; /** Width of external texture in pixels. */
545 unsigned ext_camera_tex_height = 0; /** Height of external texture in pixels. */
546#endif
547
548 public:
549 using plane_deleter = std::function<void(uint8_t*)>;
550
551 static full_image_t create_bpc8(
552 const uint8_t* rgb_plane,
553 int32_t rgb_stride,
554 int32_t width,
555 int32_t height,
557 orientation orient,
558 bool mirroring,
559 plane_deleter deleter
560 );
561
562 static full_image_t create_nv12(
563 const uint8_t* y_plane,
564 int32_t y_stride,
565 const uint8_t* uv_plane,
566 int32_t uv_stride,
567 int32_t width,
568 int32_t height,
569 bnb::color_std std,
571 orientation orient,
572 bool mirroring,
573 plane_deleter y_deleter,
574 plane_deleter uv_deleter
575 );
576
577 static full_image_t create_i420(
578 const uint8_t* y_plane,
579 int32_t y_stride,
580 const uint8_t* u_plane,
581 int32_t u_stride,
582 const uint8_t* v_plane,
583 int32_t v_stride,
584 int32_t width,
585 int32_t height,
586 bnb::color_std std,
588 orientation orient,
589 bool mirroring,
590 plane_deleter y_deleter,
591 plane_deleter u_deleter,
592 plane_deleter v_deleter
593 );
594
595 /**
596 * Returns the orientation of the image
597 * @return orientation
598 */
600
601 /**
602 * Returns the mirroring of the image. Mirroring applied after orientation
603 * @return mirroring
604 */
605 bool get_mirroring() const;
606
607 /**
608 * Returns format of the image
609 * @return fortmat of the pixel_buffer
610 */
612
613 /**
614 * Returns yuv color standard of the image
615 * @return color standard
616 */
618
619 /**
620 * Returns yuv color range of the image
621 * @return color range
622 */
624
625 /**
626 * Returns count of the planes
627 */
628 uint32_t get_number_of_planes() const;
629
630 /**
631 * Returns the shared pointer of the first plane
632 */
633 uint8_t* get_base_ptr() const;
634
635 /**
636 * Returns the shared pointer to pixel data of the specified plane
637 * @param plane_num plane number. Must be 0 for bpc8, [0..1] for nv12 and [0..2] for i420 images
638 */
639 uint8_t* get_base_ptr_of_plane(uint32_t plane_num) const;
640
641 /**
642 * Returns the pixel size of the first plane
643 */
644 int32_t get_bytes_per_pixel() const;
645
646 /**
647 * Returns the pixel size of the specified plane
648 * @param plane_num plane number. Must be 0 for bpc8, [0..1] for nv12 and [0..2] for i420 images
649 */
650 int32_t get_bytes_per_pixel_of_plane(uint32_t plane_num) const;
651
652 /**
653 * Returns the stride of the first plane
654 */
655 int32_t get_bytes_per_row() const;
656
657 /**
658 * Returns the stride of the specified plane
659 * @param plane_num plane number. Must be 0 for bpc8, [0..1] for nv12 and [0..2] for i420 images
660 */
661 int32_t get_bytes_per_row_of_plane(uint32_t plane_num) const;
662
663 /**
664 * Returns the width of the first plane
665 */
666 int32_t get_width() const;
667
668 /**
669 * Returns the width of the specified plane
670 * @param plane_num plane number. Must be 0 for bpc8, [0..1] for nv12 and [0..2] for i420 images
671 */
672 int32_t get_width_of_plane(uint32_t plane_num) const;
673
674 /**
675 * Returns the height of the first plane
676 */
677 int32_t get_height() const;
678
679 /**
680 * Returns the height of the specified plane
681 * @param plane_num plane number. Must be 0 for bpc8, [0..1] for nv12 and [0..2] for i420 images
682 */
683 int32_t get_height_of_plane(uint32_t plane_num) const;
684
685 private:
686 void init_planes_data();
687 void init_plane(uint32_t plane_num, uint8_t* data, int32_t stride, int32_t width, int32_t height, int32_t pixel_size);
688 void validate_plane_number(uint32_t plane_num) const;
689
690 private:
691 struct plane_data
692 {
693 uint8_t* data{0};
694 int32_t bytes_per_row{0};
695 int32_t width{0};
696 int32_t height{0};
697 int32_t pixel_size{0};
698 }; /* struct plane_data */
699
700 using image_t = std::variant<yuv_image_t, bpc8_image_t>;
701 image_t m_image;
702 plane_data m_planes_info[3];
703 uint32_t m_plane_count{0};
704 pixel_buffer_format m_pb_format;
705
706 template<typename T>
707 const T& _get_data() const noexcept;
708
709 template<typename T>
710 bool _has_data() const noexcept;
711
712 void update_basis_transform();
713 };
714
715 template<typename T>
716 inline const T& bnb::full_image_t::get_data() const noexcept
717 {
718 static_assert(std::is_base_of<base_image_t, T>::value, "Type is not image_t");
719 BNB_ASSERT(std::holds_alternative<T>(m_image));
720 return *std::get_if<T>(&m_image);
721 }
722
723 template<typename T>
724 inline bool full_image_t::has_data() const noexcept
725 {
726 static_assert(std::is_base_of<base_image_t, T>::value, "Type is not image_t");
727 return std::holds_alternative<T>(m_image);
728 }
729
730 /** @} */ // endgroup types
731
732} // namespace bnb
A base class for *_image_t classes.
base_image_t()=default
Construct a new base_image_t object with default values.
void set_fov(float fov)
Set the field of view.
const image_format & get_format() const
A class for representing bpc8 images as C++ object.
bpc8_image_t(color_plane data, pixel_format_t type, const image_format &format)
Construct a new bpc8_image_t object with user's values.
pixel_format_t get_pixel_format() const noexcept
bpc8_image_t(const bpc8_image_t &)=default
Construct a new bpc8_image_t object using copy operation.
bpc8_image_t()=default
enum value represents pixel format (
bpc8_image_t(bpc8_image_t &&)=default
Construct a new bpc8_image_t object using move semantics.
basis is the base basis: for y/rgb basis use .basis or get_subchannel_basis_transform(1); for uv basi...
int32_t get_bytes_per_row() const
Returns the stride of the first plane.
int32_t get_height_of_plane(uint32_t plane_num) const
Returns the height of the specified plane.
full_image_t(full_image_t &&) noexcept
Construct a new full_image_t object using move semantics.
full_image_t()
Construct a new full_image_t object with default params.
uint8_t * get_base_ptr_of_plane(uint32_t plane_num) const
Returns the shared pointer to pixel data of the specified plane.
static full_image_t load(const std::string &path, bool alpha=false)
A method for loading video from path with/whithout alpha.
uint8_t * get_base_ptr() const
Returns the shared pointer of the first plane.
int32_t get_bytes_per_row_of_plane(uint32_t plane_num) const
Returns the stride of the specified plane.
int32_t get_width_of_plane(uint32_t plane_num) const
Returns the width of the specified plane.
int32_t get_width() const
Returns the width of the first plane.
uint32_t get_number_of_planes() const
Returns count of the planes.
int32_t get_bytes_per_pixel() const
Returns the pixel size of the first plane.
full_image_t(yuv_image_t image)
Construct a new full_image_t object from image.
full_image_t(const full_image_t &)
Construct a new full_image_t object using copy operation.
bool get_mirroring() const
Returns the mirroring of the image.
color_range get_color_range() const
Returns yuv color range of the image.
int32_t get_height() const
Returns the height of the first plane.
bnb::transformation image_basis() const
color_std get_color_standard() const
Returns yuv color standard of the image.
full_image_t(bpc8_image_t image)
Construct a new full_image_t object from image.
orientation get_orientation() const
Returns the orientation of the image.
pixel_buffer_format get_pixel_buffer_format() const
Returns format of the image.
int32_t get_bytes_per_pixel_of_plane(uint32_t plane_num) const
Returns the pixel size of the specified plane.
This class implements affine or perspective 2d transformations Standard usage implies transformation ...
rotate_t
Rotation is counter clockwise(only in standart basis):
Clas represents yuv image as C++ object.
size_t y_size() const noexcept
yuv_image_t(color_plane y_plane, color_plane uv_plane, const image_format &format, const yuv_format_t &yuv_format)
Construct a new yuv_image_t object with user's values (for yuv_nv12 format).
yuv_image_t(color_plane y_plane, color_plane uv_plane, const image_format &format)
Construct a new yuv image t object wioth user's values but with default yuv image format.
const color_plane get_plane() const
yuv_image_t(color_plane y_plane, color_plane u_plane, color_plane v_plane, const image_format &format, const yuv_format_t &yuv_format)
Construct a new yuv image t object with user's values (for yuv_i420 format).
yuv_format
Enum class represents supported yuv formats.
color_std
Enum class represents suppotred color standarts.
camera_orientation
camera image layout is top-left, 0 orientation is portrait, rotation is counterclockwise
color_range
Enum class represents color range.
pixel_buffer_format
bt601 and bt709 - two standards for representing color space that use the same image encoding/decodin...
A structure stores format information about image.
uint32_t size() const noexcept
Struture stores all information about yuv format.