Computes bilinear transform coefficients to map the source ROI to the quadrangle with the specified vertex coordinates.
IppStatus ippiGetBilinearTransform(IppiRect srcRoi, const double quad[4][2], double coeffs[2][4]);
srcRoi |
Region of interest in the source image (of the IppiRect type). |
quad |
Vertex coordinates of the quadrangle, to which the source ROI is mapped by the bilinear transform function. |
coeffs |
Output array. Contains the target bilinear transform coefficients. |
The function ippiGetBilinearTransform is declared in the ippi.h file. It operates with ROI (see ROI Processing in Geometric Transforms).
This function is used as a support function for ippiWarpBilinear. It computes the coefficients coeffs of the bilinear transform that maps the source rectangular ROI to the quadrangle with the specified vertex coordinates quad.
The first dimension [4] of the array quad[4][2] is equal to the number of vertices, and the second dimension [2] means x and y coordinates of the vertex. Quadrangle vertices have the following meaning:
quad[0] corresponds to the transformed top-left corner of the source ROI,
quad[1] corresponds to the transformed top-right corner of the source ROI,
quad[2] corresponds to the transformed bottom-right corner of the source ROI,
quad[3] corresponds to the transformed bottom-left corner of the source ROI.
Example “Using Intel IPP Functions for Bilinear Transform” shows how to use the function ippiGetBilinearTransform.
ippStsNoErr |
Indicates no error. Any other value indicates an error. |
ippStsSizeErr |
Indicates an error condition if srcRoi has a size field with zero or negative value. |
ippStsCoeffErr |
Indicates an error condition if coefficient values are invalid. |
ippStsRectErr |
Indicates an error condition if width or height of the srcRoi is less than or equal to 1. |
void func_WarpBilinear()
{
int step;
Ipp32f pSrc[8*8] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 5.0, 5.0, 1.0, 1.0, 1.0,
1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 1.0, 1.0,
1.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 1.0,
1.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 1.0,
1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 1.0, 1.0,
1.0, 1.0, 1.0, 5.0, 5.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
int srcStep = 8*sizeof(Ipp32f);
IppiSize srcSize = { 8, 8};
IppiRect srcRoi = {0, 0, 8, 8};
Ipp32f pDst[8*8];
Ipp32f pDstB[8*8];
int dstStep = 8*sizeof(ipp32f);
IppiRect dstRoi = {0, 0, 8, 8};
IppiSize dstSize = {8, 8};
int dstbStep = 8*sizeof(ipp32f);
IppiRect dstbRoi = {0, 0, 8, 8};
double quad[4][2] = {{1.0, 1.0},
{8.0, 0.0},
{6.0, 8.0},
{2.0, 6.0}};
double coeffs[2][4];
ippiSet_32f_C1R(2,pDst,srcStep,srcSize);
ippiSet_32f_C1R(3,pDstB,srcStep,srcSize);
ippiGetBilinearTransform(srcRoi, quad, coeffs);
ippiWarpBilinear_32f_C1R( pSrc, srcSize, srcStep, srcRoi, pDst, dstStep, dstRoi, coeffs, IPPI_INTER_NN);
ippiWarpBilinearBack_32f_C1R( pDst, dstSize, dstStep, dstRoi, pDstB, dstbStep, dstbRoi, coeffs, IPPI_INTER_NN);
}
Result:
pSrc
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 5.0 5.0 1.0 1.0 1.0
1.0 1.0 5.0 5.0 5.0 5.0 1.0 1.0
1.0 5.0 5.0 5.0 5.0 5.0 5.0 1.0
1.0 5.0 5.0 5.0 5.0 5.0 5.0 1.0
1.0 1.0 5.0 5.0 5.0 5.0 1.0 1.0
1.0 1.0 1.0 5.0 5.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
pDst
2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
2.0 1.0 1.0 1.0 1.0 5.0 1.0 1.0
2.0 2.0 1.0 5.0 5.0 5.0 5.0 1.0
2.0 2.0 5.0 5.0 5.0 5.0 5.0 1.0
2.0 2.0 5.0 5.0 5.0 5.0 5.0 1.0
2.0 2.0 1.0 5.0 5.0 5.0 5.0 2.0
2.0 2.0 1.0 1.0 5.0 1.0 1.0 2.0
2.0 2.0 2.0 2.0 1.0 1.0 1.0 2.0
pDstB
1.0 1.0 1.0 1.0 2.0 2.0 2.0 3.0
2.0 1.0 5.0 1.0 5.0 1.0 1.0 3.0
2.0 1.0 5.0 5.0 5.0 5.0 1.0 3.0
2.0 5.0 5.0 5.0 5.0 5.0 5.0 3.0
5.0 5.0 5.0 5.0 5.0 5.0 5.0 2.0
1.0 1.0 5.0 5.0 5.0 5.0 1.0 2.0
1.0 1.0 1.0 5.0 5.0 1.0 1.0 1.0
1.0 1.0 2.0 1.0 3.0 3.0 3.0 3.0
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.