Class ov::op::util::ConvertColorI420Base#

class ConvertColorI420Base : public ov::op::Op#

Base class for color conversion operation from I420 to RGB/BGR format. Input:

  • Operation expects input shape in NHWC layout.

  • Input NV12 image can be represented in a two ways: a) Single plane: NV12 height dimension is 1.5x bigger than image height. ‘C’ dimension shall be 1 b) Three separate planes: Y, U and V. In this case b1) Y plane has height same as image height. ‘C’ dimension equals to 1 b2) U plane has dimensions: ‘H’ = image_h / 2; ‘W’ = image_w / 2; ‘C’ = 1. b3) V plane has dimensions: ‘H’ = image_h / 2; ‘W’ = image_w / 2; ‘C’ = 1.

  • Supported element types: u8 or any supported floating-point type. Output:

  • Output node will have NHWC layout and shape HxW same as image spatial dimensions.

  • Number of output channels ‘C’ will be 3

    Conversion of each pixel from I420 (YUV) to RGB space is represented by following formulas: R = 1.164 * (Y - 16) + 1.596 * (V - 128) G = 1.164 * (Y - 16) - 0.813 * (V - 128) - 0.391 * (U - 128) B = 1.164 * (Y - 16) + 2.018 * (U - 128) Then R, G, B values are clipped to range (0, 255)

Subclassed by ov::op::v8::I420toBGR, ov::op::v8::I420toRGB

Public Types

enum class ColorConversion : int#

Exact conversion format details Currently supports conversion from I420 to RGB or BGR.

Values:

enumerator I420_TO_RGB#
enumerator I420_TO_BGR#

Public Functions

virtual void validate_and_infer_types() override#

Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.

Throws if the node is invalid.