Banuba SDK
Public Types | Public Member Functions | Static Public Member Functions | List of all members
bnb::yuv_image_t Class Referencefinal

Clas represents yuv image as C++ object. More...

#include <full_image.hpp>

Inheritance diagram for bnb::yuv_image_t:
bnb::base_image_t

Public Types

using conversion_matrix = std::array< float, 16 >
 

Public Member Functions

template<size_t index>
const color_plane get_plane () const
 
 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). More...
 
 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). More...
 
 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. More...
 
size_t y_size () const noexcept
 
size_t uv_size () const noexcept
 
virtual conversion_matrix get_yuv_to_rgb_matrix () const
 
virtual conversion_matrix get_rgb_to_yuv_matrix () const
 
uint8_t y_pixel_at (uint32_t xi, uint32_t yi) const noexcept
 
uint8_t uv_pixel_at (uint32_t xi, uint32_t yi, uint32_t offset) const noexcept
 
uint8_t u_pixel_at (uint32_t xi, uint32_t yi) const noexcept
 
uint8_t v_pixel_at (uint32_t xi, uint32_t yi) const noexcept
 
 yuv_image_t ()=default
 Construct a new yuv_image_t object with default params.
 
 yuv_image_t (yuv_image_t &&)=default
 Construct a new yuv_image_t object using move semantics.
 
yuv_image_toperator= (yuv_image_t &&other)=default
 
 yuv_image_t (const yuv_image_t &)=default
 Construct a new yuv image t object with copy operation.
 
yuv_image_toperator= (const yuv_image_t &)=default
 
void normalize_orientation (bnb::transformation const &y_basis, bnb::transformation const &uv_basis, bnb::pixel_rect const &full_roi)
 Normalize image data if it is required to be mirrored or camera orientation isn't deg_0.
 
const yuv_format_tget_yuv_format () const noexcept
 
- Public Member Functions inherited from bnb::base_image_t
 base_image_t ()=default
 Construct a new base_image_t object with default values.
 
const image_formatget_format () const
 
void set_fov (float fov)
 Set the field of view. More...
 

Static Public Member Functions

static const bnb::yuv_image_t::conversion_matrix & get_yuv_to_rgb_matrix (color_std standard, color_range range)
 
static const bnb::yuv_image_t::conversion_matrix & get_rgb_to_yuv_matrix (color_std standard, color_range range)
 

Additional Inherited Members

- Protected Member Functions inherited from bnb::base_image_t
 base_image_t (const image_format &format)
 
- Protected Attributes inherited from bnb::base_image_t
image_format m_format
 

Detailed Description

Clas represents yuv image as C++ object.

Definition at line 280 of file full_image.hpp.

Constructor & Destructor Documentation

◆ yuv_image_t() [1/3]

bnb::yuv_image_t::yuv_image_t ( color_plane  y_plane,
color_plane  uv_plane,
const image_format format,
const yuv_format_t yuv_format 
)
inline

Construct a new yuv_image_t object with user's values (for yuv_nv12 format).

Parameters
y_planeis the zeroyth plane of image.
uv_planeis the uv plane of image.
formatis a image format (
See also
image_format).
Parameters
yuv_formatis a yuv image format (
See also
yuv_image_t).

Definition at line 323 of file full_image.hpp.

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  }

◆ yuv_image_t() [2/3]

bnb::yuv_image_t::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 
)
inline

Construct a new yuv image t object with user's values (for yuv_i420 format).

Parameters
y_planeis the y plane of image.
u_planeis the u plane of image.
v_planeis the v plane of image.
formatis a image format (
See also
image_format).
Parameters
yuv_formatis a yuv image format (
See also
yuv_image_t).

Definition at line 340 of file full_image.hpp.

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  }

◆ yuv_image_t() [3/3]

bnb::yuv_image_t::yuv_image_t ( color_plane  y_plane,
color_plane  uv_plane,
const image_format format 
)
inline

Construct a new yuv image t object wioth user's values but with default yuv image format.

Parameters
y_planeis the y plane of image.
uv_planeis the uv plane of image.
formatis a image format (
See also
image_format).

Definition at line 356 of file full_image.hpp.

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  }

Member Function Documentation

◆ get_plane()

template<size_t index>
const color_plane bnb::yuv_image_t::get_plane ( ) const
inline
Returns
Returns the color plane by its object and yuv image format.

Definition at line 287 of file full_image.hpp.

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  };

◆ get_rgb_to_yuv_matrix()

static const bnb::yuv_image_t::conversion_matrix& bnb::yuv_image_t::get_rgb_to_yuv_matrix ( color_std  standard,
color_range  range 
)
static
Returns
Returns conversion matrix (
See also
conversion_matrix) for standard (
color_std) and range (
color_range) from rgb to yuv.

◆ get_yuv_format()

const yuv_format_t& bnb::yuv_image_t::get_yuv_format ( ) const
noexcept
Returns
Returns the const reference on yuv_format of image (
See also
yuv_format_t).

◆ get_yuv_to_rgb_matrix()

static const bnb::yuv_image_t::conversion_matrix& bnb::yuv_image_t::get_yuv_to_rgb_matrix ( color_std  standard,
color_range  range 
)
static
Returns
Returns conversion matrix (
See also
conversion_matrix) for standard (
color_std) and range (
color_range) from yuv to rgb.

◆ u_pixel_at()

uint8_t bnb::yuv_image_t::u_pixel_at ( uint32_t  xi,
uint32_t  yi 
) const
noexcept
Returns
Returns the pixel's value of u plane with coords xi and yi.

◆ uv_pixel_at()

uint8_t bnb::yuv_image_t::uv_pixel_at ( uint32_t  xi,
uint32_t  yi,
uint32_t  offset 
) const
noexcept
Returns
Returns the pixel's value of uv plane with coords xi and yi.

◆ uv_size()

size_t bnb::yuv_image_t::uv_size ( ) const
noexcept
Returns
Returns the size of uv plane of image.

◆ v_pixel_at()

uint8_t bnb::yuv_image_t::v_pixel_at ( uint32_t  xi,
uint32_t  yi 
) const
noexcept
Returns
Returns the pixel's value of v plane with coords xi and yi.

◆ y_pixel_at()

uint8_t bnb::yuv_image_t::y_pixel_at ( uint32_t  xi,
uint32_t  yi 
) const
noexcept
Returns
Returns the pixel's value of y plane with coords xi and yi.

◆ y_size()

size_t bnb::yuv_image_t::y_size ( ) const
noexcept
Returns
Returns the size of y plane of image

The documentation for this class was generated from the following file:
bnb::base_image_t::base_image_t
base_image_t()=default
Construct a new base_image_t object with default values.
bnb::yuv_format
yuv_format
Enum class represents supported yuv formats.
Definition: full_image.hpp:259
bnb::color_range::full
@ full
for y values range is 16-235, for u and v values range is 16-240