Developer Reference for Intel® Integrated Performance Primitives
Converts a bitonal image to a grayscale image and vice versa.
Case 1: Conversion of a bitonal image to a grayscale image
IppStatus ippiBinToGray_1u<dstDataType>_C1R(const Ipp8u* pSrc, int srcStep, int srcBitOffset, Ipp<dstDataType>* pDst, int dstStep, IppiSize roiSize, Ipp<dstDataType> loVal, Ipp<dstDataType> hiVal);
Supported values for dstDataType:
8u | 16u | 16s | 32f |
Case 2: Conversion of a grayscale image to a bitonal image
IppStatus ippiGrayToBin_<srcDataType>1u_C1R(const Ipp<srcDataType>* pSrc, int srcStep, Ipp8u* pDst, int dstStep, int dstBitOffset, IppiSize roiSize, Ipp<sourceDataType> threshold);
Supported values for srcDataType:
8u | 16u | 16s | 32f |
ippi.h
Headers: ippcore.h, ippvm.h, ipps.h
Libraries: ippcore.lib, ippvm.lib, ipps.lib
pSrc |
Pointer to the source image ROI. |
srcStep |
Distance, in bytes, between the starting points of consecutive lines in the source image. |
srcBitOffset |
Offset, in bits, from the first byte of the source image row. |
pDst |
Pointer to the destination image ROI. |
dstStep |
Distance, in bytes, between the starting points of consecutive lines in the destination image. |
dstBitOffset |
Offset, in bits, from the first byte of the destination image row. |
roiSize |
Size of the ROI in pixels. |
loVal |
Destination value that corresponds to the "0" value of the corresponding source element. |
hiVal |
Destination value that corresponds to the "1" value of the corresponding source element. |
threshold |
Threshold level. |
These functions operate with ROI.
The ippiBinToGray function converts a bitonal image to grayscale, and the ippiGrayToBin function converts a grayscale image to bitonal. The data type of the bitonal image is 8u. It means that each byte consists of eight consecutive pixels of the image (1 bit per pixel). You need to specify the start position of the ROI buffer in the srcBitOffset and dstBitOffset parameters.
The ippiBinToGray function transforms each bit of the source image into the pixel of the destination image in the following way:
The ippiGrayToBin function transforms each pixel of the source image into the bit of the destination image in the following way:
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when any of the specified pointers is NULL. |
ippStsStepErr |
Indicates an error when the srcStep or dstStep value is less than, or equal to zero. |
ippStsSizeErr |
Indicates an error when:
|