From f7292a1589631db6ca4f7507210911190e11c4da Mon Sep 17 00:00:00 2001 From: Michael Nosov Date: Wed, 22 Sep 2021 16:53:52 +0300 Subject: [PATCH 1/3] [OV20] NV12toRGB and NV12toBGR operations specification --- docs/doxygen/ie_docs.xml | 2 + docs/ops/image/NV12toBGR_8.md | 82 +++++++++++++++++++++++++ docs/ops/image/NV12toRGB_8.md | 109 ++++++++++++++++++++++++++++++++++ docs/ops/opset8.md | 2 + 4 files changed, 195 insertions(+) create mode 100644 docs/ops/image/NV12toBGR_8.md create mode 100644 docs/ops/image/NV12toRGB_8.md diff --git a/docs/doxygen/ie_docs.xml b/docs/doxygen/ie_docs.xml index a4ae8c245ee5ba..0132ecede25af1 100644 --- a/docs/doxygen/ie_docs.xml +++ b/docs/doxygen/ie_docs.xml @@ -211,6 +211,8 @@ limitations under the License. + + diff --git a/docs/ops/image/NV12toBGR_8.md b/docs/ops/image/NV12toBGR_8.md new file mode 100644 index 00000000000000..00c74c6b2ea0fc --- /dev/null +++ b/docs/ops/image/NV12toBGR_8.md @@ -0,0 +1,82 @@ +## NV12toBGR {#openvino_docs_ops_image_NV12toBGR_8} + +**Versioned name**: *NV12toBGR-8* + +**Category**: *Image processing* + +**Short description**: *NV12toBGR* performs image conversion from NV12 format to BGR. + +**Detailed description**: + +Similar to *NV12toRGB* but output channels for each pixel are reversed so that: first channel is `blue`, second one is `green`, last one is `red`. See detailed conversion formulas at [NV12toRGB](NV12toRGB_8.md) + +**Inputs:** + +Same as specified for [NV12toRGB](NV12toRGB_8.md) operation. + +**Outputs:** + +* **1**: A tensor of type *T* representing converted image in BGR format. Dimensions: + * `N` - batch dimension + * `H` - height dimension is same as image height + * `W` - width dimension is same as image width + * `C` - channels dimension equals to 3. First channel is Blue, second one is Green, last one is Red + +**Types:** + +* *T*: `uint8` or `float32` type. + + +**Examples:** + +*Example 1* + +```xml + + + + 1 + 720 + 640 + 1 + + + + + 1 + 480 + 640 + 3 + + + +``` + +*Example 2* + +```xml + + + + 1 + 480 + 640 + 1 + + + 1 + 240 + 320 + 2 + + + + + 1 + 480 + 640 + 3 + + + +``` diff --git a/docs/ops/image/NV12toRGB_8.md b/docs/ops/image/NV12toRGB_8.md new file mode 100644 index 00000000000000..4960477f7fad4c --- /dev/null +++ b/docs/ops/image/NV12toRGB_8.md @@ -0,0 +1,109 @@ +## NV12toRGB {#openvino_docs_ops_image_NV12toRGB_8} + +**Versioned name**: *NV12toRGB-8* + +**Category**: *Image processing* + +**Short description**: *NV12toRGB* performs image conversion from NV12 format to RGB format. + +**Detailed description:** + +Conversion of each pixel from NV12 (YUV) to RGB space is represented by following formulas: + +\f[ +\begin{aligned} +& R = 1.164 \cdot (Y - 16) + 1.596 \cdot (V - 128) \\ +& G = 1.164 \cdot (Y - 16) - 0.813 \cdot (V - 128) - 0.391 \cdot (U - 128) \\ +& B = 1.164 \cdot (Y - 16) + 2.018 \cdot (U - 128) +\end{aligned} +\f] + +Then R, G, B values are clipped to range (0, 255) + +**Inputs:** + +Input NV12 image tensor shall have `NHWC (a.k.a NYXC)` layout and can be represented in two ways: +* *Single plane*: + * **1**: Tensor of type *T*. **Required.** Dimensions: + * `N` - batch dimension + * `H` - height dimension is 1.5x bigger than image height + * `W` - width dimension is same as image width + * `C` - channels dimension equals to 1 (one plane) +* *Two separate planes: Y and UV*: In this way + * **1**: Tensor of type *T* representing Y plane. **Required.** Dimensions: + * `N` - batch dimension + * `H` - height dimension is same as image height + * `W` - width dimension is same as image width + * `C` - channels dimension equals to 1 (only Y channel) + * **2**: Tensor of type *T* representing UV plane. **Required.** Dimensions: + * `N` - batch dimension. Shall be same as batch dimension for Y plane + * `H` - height dimension shall be half of image height (i.e. `image_height / 2`) + * `W` - width dimension shall be half of image width (i.e. `image_width / 2`) + * `C` - channels dimension shall be equal to 2 (U channel and V channel) + +**Outputs:** + +* **1**: A tensor of type *T* representing converted image in RGB format. Dimensions: + * `N` - batch dimension + * `H` - height dimension is same as image height + * `W` - width dimension is same as image width + * `C` - channels dimension equals to 3. First channel is Red, second one is Green, last one is Blue + +**Types:** + +* *T*: `uint8` or `float32` type. + + +**Examples:** + +*Example 1* + +```xml + + + + 1 + 720 + 640 + 1 + + + + + 1 + 480 + 640 + 3 + + + +``` + +*Example 2* + +```xml + + + + 1 + 480 + 640 + 1 + + + 1 + 240 + 320 + 2 + + + + + 1 + 480 + 640 + 3 + + + +``` diff --git a/docs/ops/opset8.md b/docs/ops/opset8.md index 4c71a0bb2fa7fc..385dfa173a5d9f 100644 --- a/docs/ops/opset8.md +++ b/docs/ops/opset8.md @@ -106,6 +106,8 @@ declared in `namespace opset8`. * [NonZero](condition/NonZero_3.md) * [NormalizeL2](normalization/NormalizeL2_1.md) * [NotEqual](comparison/NotEqual_1.md) +* [NV12toBGR](image/NV12toBGR_8.md) +* [NV12toRGB](image/NV12toRGB_8.md) * [OneHot](sequence/OneHot_1.md) * [Pad](movement/Pad_1.md) * [Parameter](infrastructure/Parameter_1.md) From bfa92d5420fa6b644728f807209c69a4749d27c1 Mon Sep 17 00:00:00 2001 From: Michael Nosov Date: Wed, 22 Sep 2021 21:57:11 +0300 Subject: [PATCH 2/3] Changed supported type to "`uint8` or any supported floating-point type" --- docs/ops/image/NV12toBGR_8.md | 2 +- docs/ops/image/NV12toRGB_8.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ops/image/NV12toBGR_8.md b/docs/ops/image/NV12toBGR_8.md index 00c74c6b2ea0fc..7538d3d76b77e8 100644 --- a/docs/ops/image/NV12toBGR_8.md +++ b/docs/ops/image/NV12toBGR_8.md @@ -24,7 +24,7 @@ Same as specified for [NV12toRGB](NV12toRGB_8.md) operation. **Types:** -* *T*: `uint8` or `float32` type. +* *T*: `uint8` or any supported floating-point type. **Examples:** diff --git a/docs/ops/image/NV12toRGB_8.md b/docs/ops/image/NV12toRGB_8.md index 4960477f7fad4c..f8ca44207e7585 100644 --- a/docs/ops/image/NV12toRGB_8.md +++ b/docs/ops/image/NV12toRGB_8.md @@ -51,7 +51,7 @@ Input NV12 image tensor shall have `NHWC (a.k.a NYXC)` layout and can be represe **Types:** -* *T*: `uint8` or `float32` type. +* *T*: `uint8` or any supported floating-point type. **Examples:** From 6af521cdf253bf152ec6535ed5b5faa9b0aabdb7 Mon Sep 17 00:00:00 2001 From: Mikhail Nosov Date: Thu, 23 Sep 2021 17:51:59 +0300 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Tatiana Savina --- docs/ops/image/NV12toBGR_8.md | 12 ++++++------ docs/ops/image/NV12toRGB_8.md | 36 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/ops/image/NV12toBGR_8.md b/docs/ops/image/NV12toBGR_8.md index 7538d3d76b77e8..f4009a1aa2871a 100644 --- a/docs/ops/image/NV12toBGR_8.md +++ b/docs/ops/image/NV12toBGR_8.md @@ -4,11 +4,11 @@ **Category**: *Image processing* -**Short description**: *NV12toBGR* performs image conversion from NV12 format to BGR. +**Short description**: *NV12toBGR* performs image conversion from NV12 to BGR format. **Detailed description**: -Similar to *NV12toRGB* but output channels for each pixel are reversed so that: first channel is `blue`, second one is `green`, last one is `red`. See detailed conversion formulas at [NV12toRGB](NV12toRGB_8.md) +Similar to *NV12toRGB* but output channels for each pixel are reversed so that the first channel is `blue`, the second one is `green`, the last one is `red`. See detailed conversion formulas in the [NV12toRGB description](NV12toRGB_8.md). **Inputs:** @@ -16,11 +16,11 @@ Same as specified for [NV12toRGB](NV12toRGB_8.md) operation. **Outputs:** -* **1**: A tensor of type *T* representing converted image in BGR format. Dimensions: +* **1**: A tensor of type *T* representing an image converted in BGR format. Dimensions: * `N` - batch dimension - * `H` - height dimension is same as image height - * `W` - width dimension is same as image width - * `C` - channels dimension equals to 3. First channel is Blue, second one is Green, last one is Red + * `H` - height dimension is the same as the image height + * `W` - width dimension is the same as the image width + * `C` - channels dimension is equal to 3. The first channel is Blue, the second one is Green, the last one is Red **Types:** diff --git a/docs/ops/image/NV12toRGB_8.md b/docs/ops/image/NV12toRGB_8.md index f8ca44207e7585..0d5b3480443450 100644 --- a/docs/ops/image/NV12toRGB_8.md +++ b/docs/ops/image/NV12toRGB_8.md @@ -4,11 +4,11 @@ **Category**: *Image processing* -**Short description**: *NV12toRGB* performs image conversion from NV12 format to RGB format. +**Short description**: *NV12toRGB* performs image conversion from NV12 to RGB format. **Detailed description:** -Conversion of each pixel from NV12 (YUV) to RGB space is represented by following formulas: +Conversion of each pixel from NV12 (YUV) to RGB space is represented by the following formulas: \f[ \begin{aligned} @@ -18,36 +18,36 @@ Conversion of each pixel from NV12 (YUV) to RGB space is represented by followin \end{aligned} \f] -Then R, G, B values are clipped to range (0, 255) +Then R, G, B values are clipped to range (0, 255). **Inputs:** -Input NV12 image tensor shall have `NHWC (a.k.a NYXC)` layout and can be represented in two ways: +Input NV12 image tensor shall have `NHWC (also known as NYXC)` layout and can be represented in two ways: * *Single plane*: * **1**: Tensor of type *T*. **Required.** Dimensions: * `N` - batch dimension - * `H` - height dimension is 1.5x bigger than image height - * `W` - width dimension is same as image width - * `C` - channels dimension equals to 1 (one plane) -* *Two separate planes: Y and UV*: In this way + * `H` - height dimension is 1.5x bigger than the image height + * `W` - width dimension is the same as the image width + * `C` - channels dimension is equal to 1 (one plane) +* *Two separate planes - Y and UV*: * **1**: Tensor of type *T* representing Y plane. **Required.** Dimensions: * `N` - batch dimension - * `H` - height dimension is same as image height - * `W` - width dimension is same as image width - * `C` - channels dimension equals to 1 (only Y channel) + * `H` - height dimension is the same as the image height + * `W` - width dimension is the same as the image width + * `C` - channels dimension is equal to 1 (only Y channel) * **2**: Tensor of type *T* representing UV plane. **Required.** Dimensions: - * `N` - batch dimension. Shall be same as batch dimension for Y plane - * `H` - height dimension shall be half of image height (i.e. `image_height / 2`) - * `W` - width dimension shall be half of image width (i.e. `image_width / 2`) + * `N` - batch dimension. Shall be the same as the batch dimension for Y plane + * `H` - height dimension shall be half of the image height (for example, `image_height / 2`) + * `W` - width dimension shall be half of the image width (for example, `image_width / 2`) * `C` - channels dimension shall be equal to 2 (U channel and V channel) **Outputs:** -* **1**: A tensor of type *T* representing converted image in RGB format. Dimensions: +* **1**: A tensor of type *T* representing an image converted in RGB format. Dimensions: * `N` - batch dimension - * `H` - height dimension is same as image height - * `W` - width dimension is same as image width - * `C` - channels dimension equals to 3. First channel is Red, second one is Green, last one is Blue + * `H` - height dimension is the same as the image height + * `W` - width dimension is the same as the image width + * `C` - channels dimension is equal to 3. The first channel is Red, the second one is Green, the last one is Blue **Types:**