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 312 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 355 of file full_image.hpp.

356  : base_image_t(format)
357  , m_yuv_format(yuv_format)
358  {
359  m_planes[0] = std::move(y_plane);
360  m_planes[1] = std::move(uv_plane);
361  }

◆ 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 372 of file full_image.hpp.

373  : base_image_t(format)
374  , m_yuv_format(yuv_format)
375  {
376  m_planes[0] = std::move(y_plane);
377  m_planes[1] = std::move(u_plane);
378  m_planes[2] = std::move(v_plane);
379  }

◆ 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 388 of file full_image.hpp.

389  : base_image_t(format)
390  {
391  m_yuv_format.range = color_range::full;
392  m_yuv_format.format = yuv_format::yuv_nv12;
393  m_yuv_format.standard = color_std::bt601;
394 
395  m_planes[0] = std::move(y_plane);
396  m_planes[1] = std::move(uv_plane);
397  }

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 319 of file full_image.hpp.

320  {
321  switch (index) {
322  case 0: {
323  return m_planes[0];
324  }
325  case 1: {
326  return m_planes[1];
327  }
328  case 2: {
329  switch (m_yuv_format.format) {
330  case yuv_format::yuv_nv12: {
331  BNB_THROW(std::invalid_argument, "yuv nv12 format has only 2 planes");
332  }
333  case yuv_format::yuv_i420: {
334  return m_planes[2];
335  }
336  default: {
337  BNB_THROW(std::invalid_argument, "Incorrect yuv format");
338  }
339  }
340  }
341  default: {
342  BNB_THROW(std::invalid_argument, "Incorrect index of plane");
343  }
344  }
345  };

◆ 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:291
bnb::color_range::full
@ full
for y values range is 16-235, for u and v values range is 16-240