xf::cv::convertTo - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

The xf::cv::convertTo function performs bit depth conversion on each individual pixel of the given input image. This method converts the source pixel values to the target data type with appropriate casting.

dst(x,y)= cast<target-data-type>(α(src(x,y)+β))

Note: The output and input Mat cannot be the same. That is, the converted image cannot be stored in the Mat of the input image.

API Syntax

template<int DST_T> void convertTo(xf::cv::Mat<DST_T,ROWS, COLS, NPC> &dst, int ctype, double alpha=1, double beta=0)

Parameter Descriptions

The table below describes the template and function parameters.

Table 266 Table xf::cv::convertTo Parameter Description
Parameter Description
DST_T Output pixel type. Possible values are XF_8UC1, XF_16UC1, XF_16SC1, and XF_32SC1.
ROWS Maximum height of image to be read
COLS Maximum width of image to be read
NPC Number of pixels to be processed per cycle; possible options are XF_NPPC1, XF_NPPC4, and XF_NPPC8 for 1-pixel, 4-pixel, and 8-pixel parallel operations respectively. XF_32SC1 and XF_NPPC8 combination is not supported.
dst Converted xf Mat
ctype

Conversion type : Possible values are listed here.

//Down-convert:
  • XF_CONVERT_16U_TO_8U
  • XF_CONVERT_16S_TO_8U
  • XF_CONVERT_32S_TO_8U
  • XF_CONVERT_32S_TO_16U
  • XF_CONVERT_32S_TO_16S

//Up-convert:

  • XF_CONVERT_8U_TO_16U
  • XF_CONVERT_8U_TO_16S
  • XF_CONVERT_8U_TO_32S
  • XF_CONVERT_16U_TO_32S
  • XF_CONVERT_16S_TO_32S
alpha Optional scale factor
beta Optional delta added to the scaled values