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 following table describes the template and function parameters.
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.
//Up-convert:
|
alpha | Optional scale factor |
beta | Optional delta added to the scaled values |