cv::warpPerspective and cv::warpAffine
This commit is contained in:
parent
5600bc54f4
commit
f1b38c4198
@ -177,13 +177,17 @@ macro(ipp_set_variables _LATEST_VERSION)
|
|||||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
||||||
message(SEND_ERROR "Intel compiler EM64T libraries not found")
|
message(SEND_ERROR "Intel compiler EM64T libraries not found")
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT APPLE)
|
||||||
set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
||||||
message(SEND_ERROR "Intel compiler IA32 libraries not found")
|
message(SEND_ERROR "Intel compiler IA32 libraries not found")
|
||||||
endif()
|
endif()
|
||||||
|
if (NOT APLLE)
|
||||||
set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
set(INTEL_COMPILER_LIBRARY_DIR ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}irc${CMAKE_SHARED_LIBRARY_SUFFIX})
|
list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}irc${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}imf${CMAKE_SHARED_LIBRARY_SUFFIX})
|
list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}imf${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}svml${CMAKE_SHARED_LIBRARY_SUFFIX})
|
list(APPEND IPP_LIBRARIES ${INTEL_COMPILER_LIBRARY_DIR}/${IPP_LIB_PREFIX}svml${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
|
@ -63,7 +63,7 @@ namespace cv
|
|||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||||
typedef IppStatus (CV_STDCALL* ippiSetFunc)(const void*, void *, int, IppiSize);
|
typedef IppStatus (CV_STDCALL* ippiSetFunc)(const void*, void *, int, IppiSize);
|
||||||
typedef IppStatus (CV_STDCALL* ippiWarpPerspectiveBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [3][3], int);
|
typedef IppStatus (CV_STDCALL* ippiWarpPerspectiveFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [3][3], int);
|
||||||
typedef IppStatus (CV_STDCALL* ippiWarpAffineBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [2][3], int);
|
typedef IppStatus (CV_STDCALL* ippiWarpAffineBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [2][3], int);
|
||||||
|
|
||||||
template <int channels, typename Type>
|
template <int channels, typename Type>
|
||||||
@ -75,7 +75,7 @@ namespace cv
|
|||||||
return func(values, dataPointer, step, size) >= 0;
|
return func(values, dataPointer, step, size) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IPPSet(const cv::Scalar &value, void *dataPointer, int step, IppiSize &size, int channels, int depth)
|
static bool IPPSet(const cv::Scalar &value, void *dataPointer, int step, IppiSize &size, int channels, int depth)
|
||||||
{
|
{
|
||||||
if( channels == 1 )
|
if( channels == 1 )
|
||||||
{
|
{
|
||||||
@ -3892,11 +3892,11 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
|||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
class warpAffineInvoker :
|
class WarpAffineInvoker :
|
||||||
public ParallelLoopBody
|
public ParallelLoopBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
warpAffineInvoker(const Mat &_src, Mat &_dst, int _interpolation, int _borderType,
|
WarpAffineInvoker(const Mat &_src, Mat &_dst, int _interpolation, int _borderType,
|
||||||
const Scalar &_borderValue, int *_adelta, int *_bdelta, double *_M) :
|
const Scalar &_borderValue, int *_adelta, int *_bdelta, double *_M) :
|
||||||
ParallelLoopBody(), src(_src), dst(_dst), interpolation(_interpolation),
|
ParallelLoopBody(), src(_src), dst(_dst), interpolation(_interpolation),
|
||||||
borderType(_borderType), borderValue(_borderValue), adelta(_adelta), bdelta(_bdelta),
|
borderType(_borderType), borderValue(_borderValue), adelta(_adelta), bdelta(_bdelta),
|
||||||
@ -4013,13 +4013,16 @@ private:
|
|||||||
double *M;
|
double *M;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
/*
|
||||||
class IPPwarpAffineInvoker :
|
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 IPP_VERSION_MINOR >= 1
|
||||||
|
class IPPWarpAffineInvoker :
|
||||||
public ParallelLoopBody
|
public ParallelLoopBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IPPwarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpAffineBackFunc _func, bool *_ok) :
|
IPPWarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int _borderType,
|
||||||
ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
|
const Scalar &_borderValue, ippiWarpAffineBackFunc _func, bool *_ok) :
|
||||||
|
ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs),
|
||||||
|
borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
|
||||||
{
|
{
|
||||||
*ok = true;
|
*ok = true;
|
||||||
}
|
}
|
||||||
@ -4040,21 +4043,27 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( func( src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode ) < 0) ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
|
|
||||||
|
////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
|
||||||
|
IppStatus status = func( src.data, srcsize, (int)src.step[0], srcroi, dst.data,
|
||||||
|
(int)dst.step[0], dstroi, coeffs, mode );
|
||||||
|
printf("%d\n", status);
|
||||||
|
if( status != ippStsNoErr)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Mat &src;
|
Mat &src;
|
||||||
Mat &dst;
|
Mat &dst;
|
||||||
double (&coeffs)[2][3];
|
|
||||||
int mode;
|
int mode;
|
||||||
|
double (&coeffs)[2][3];
|
||||||
int borderType;
|
int borderType;
|
||||||
Scalar borderValue;
|
Scalar borderValue;
|
||||||
ippiWarpAffineBackFunc func;
|
ippiWarpAffineBackFunc func;
|
||||||
bool *ok;
|
bool *ok;
|
||||||
const IPPwarpAffineInvoker& operator= (const IPPwarpAffineInvoker&);
|
const IPPWarpAffineInvoker& operator= (const IPPWarpAffineInvoker&);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
|
|
||||||
@ -4204,16 +4213,19 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
|
|||||||
int* adelta = &_abdelta[0], *bdelta = adelta + dst.cols;
|
int* adelta = &_abdelta[0], *bdelta = adelta + dst.cols;
|
||||||
const int AB_BITS = MAX(10, (int)INTER_BITS);
|
const int AB_BITS = MAX(10, (int)INTER_BITS);
|
||||||
const int AB_SCALE = 1 << AB_BITS;
|
const int AB_SCALE = 1 << AB_BITS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 IPP_VERSION_MINOR >= 1
|
||||||
int depth = src.depth();
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
int channels = src.channels();
|
|
||||||
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
|
if( ( depth == CV_8U || depth == CV_16U || depth == CV_32F ) &&
|
||||||
( channels == 1 || channels == 3 || channels == 4 ) &&
|
( cn == 1 || cn == 3 || cn == 4 ) &&
|
||||||
( borderType == cv::BORDER_TRANSPARENT || ( borderType == cv::BORDER_CONSTANT ) ) )
|
( interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC) &&
|
||||||
|
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT) )
|
||||||
{
|
{
|
||||||
int type = src.type();
|
ippiWarpAffineBackFunc ippFunc = 0;
|
||||||
ippiWarpAffineBackFunc ippFunc =
|
if ((flags & WARP_INVERSE_MAP) != 0)
|
||||||
|
{
|
||||||
|
ippFunc =
|
||||||
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C1R :
|
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C1R :
|
||||||
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C3R :
|
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C3R :
|
||||||
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C4R :
|
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C4R :
|
||||||
@ -4224,31 +4236,43 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
|
|||||||
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C3R :
|
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C3R :
|
||||||
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C4R :
|
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C4R :
|
||||||
0;
|
0;
|
||||||
int mode =
|
}
|
||||||
flags == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
else
|
||||||
flags == INTER_NEAREST ? IPPI_INTER_NN :
|
|
||||||
flags == INTER_CUBIC ? IPPI_INTER_CUBIC :
|
|
||||||
0;
|
|
||||||
if( mode && ippFunc )
|
|
||||||
{
|
{
|
||||||
|
ippFunc =
|
||||||
|
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C1R :
|
||||||
|
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C3R :
|
||||||
|
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_8u_C4R :
|
||||||
|
type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C1R :
|
||||||
|
type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C3R :
|
||||||
|
type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_16u_C4R :
|
||||||
|
type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C1R :
|
||||||
|
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C3R :
|
||||||
|
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffine_32f_C4R :
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
int mode =
|
||||||
|
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
||||||
|
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
||||||
|
interpolation == INTER_CUBIC ? IPPI_INTER_CUBIC :
|
||||||
|
0;
|
||||||
|
CV_Assert(mode && ippFunc);
|
||||||
|
|
||||||
double coeffs[2][3];
|
double coeffs[2][3];
|
||||||
for( int i = 0; i < 2; i++ )
|
for( int i = 0; i < 2; i++ )
|
||||||
{
|
|
||||||
for( int j = 0; j < 3; j++ )
|
for( int j = 0; j < 3; j++ )
|
||||||
{
|
|
||||||
coeffs[i][j] = matM.at<double>(i, j);
|
coeffs[i][j] = matM.at<double>(i, j);
|
||||||
}
|
|
||||||
}
|
|
||||||
bool ok;
|
bool ok;
|
||||||
Range range(0, dst.rows);
|
Range range(0, dst.rows);
|
||||||
IPPwarpAffineInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
IPPWarpAffineInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
if( ok )
|
if( ok )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for( x = 0; x < dst.cols; x++ )
|
for( x = 0; x < dst.cols; x++ )
|
||||||
{
|
{
|
||||||
adelta[x] = saturate_cast<int>(M[0]*x*AB_SCALE);
|
adelta[x] = saturate_cast<int>(M[0]*x*AB_SCALE);
|
||||||
@ -4256,7 +4280,7 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Range range(0, dst.rows);
|
Range range(0, dst.rows);
|
||||||
warpAffineInvoker invoker(src, dst, interpolation, borderType,
|
WarpAffineInvoker invoker(src, dst, interpolation, borderType,
|
||||||
borderValue, adelta, bdelta, M);
|
borderValue, adelta, bdelta, M);
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
}
|
}
|
||||||
@ -4265,12 +4289,12 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
|
|||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
class warpPerspectiveInvoker :
|
class WarpPerspectiveInvoker :
|
||||||
public ParallelLoopBody
|
public ParallelLoopBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
warpPerspectiveInvoker(const Mat &_src, Mat &_dst, double *_M, int _interpolation,
|
WarpPerspectiveInvoker(const Mat &_src, Mat &_dst, double *_M, int _interpolation,
|
||||||
int _borderType, const Scalar &_borderValue) :
|
int _borderType, const Scalar &_borderValue) :
|
||||||
ParallelLoopBody(), src(_src), dst(_dst), M(_M), interpolation(_interpolation),
|
ParallelLoopBody(), src(_src), dst(_dst), M(_M), interpolation(_interpolation),
|
||||||
borderType(_borderType), borderValue(_borderValue)
|
borderType(_borderType), borderValue(_borderValue)
|
||||||
@ -4356,13 +4380,16 @@ private:
|
|||||||
Scalar borderValue;
|
Scalar borderValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
/*
|
||||||
class IPPwarpPerspectiveInvoker :
|
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
|
||||||
|
class IPPWarpPerspectiveInvoker :
|
||||||
public ParallelLoopBody
|
public ParallelLoopBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IPPwarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpPerspectiveBackFunc _func, bool *_ok) :
|
IPPWarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation,
|
||||||
ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
|
int &_borderType, const Scalar &_borderValue, ippiWarpPerspectiveFunc _func, bool *_ok) :
|
||||||
|
ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs),
|
||||||
|
borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
|
||||||
{
|
{
|
||||||
*ok = true;
|
*ok = true;
|
||||||
}
|
}
|
||||||
@ -4384,22 +4411,26 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0)
|
|
||||||
|
IppStatus status = func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode);
|
||||||
|
printf("%d\n", status);
|
||||||
|
if (status != ippStsNoErr)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Mat &src;
|
Mat &src;
|
||||||
Mat &dst;
|
Mat &dst;
|
||||||
double (&coeffs)[3][3];
|
|
||||||
int mode;
|
int mode;
|
||||||
|
double (&coeffs)[3][3];
|
||||||
int borderType;
|
int borderType;
|
||||||
const Scalar borderValue;
|
const Scalar borderValue;
|
||||||
ippiWarpPerspectiveBackFunc func;
|
ippiWarpPerspectiveFunc func;
|
||||||
bool *ok;
|
bool *ok;
|
||||||
const IPPwarpPerspectiveInvoker& operator= (const IPPwarpPerspectiveInvoker&);
|
|
||||||
|
const IPPWarpPerspectiveInvoker& operator= (const IPPWarpPerspectiveInvoker&);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
|
void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
|
||||||
@ -4432,55 +4463,65 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !(flags & WARP_INVERSE_MAP) )
|
|
||||||
invert(matM, matM);
|
|
||||||
/*
|
/*
|
||||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
#if defined (HAVE_IPP) && IPP_VERSION_MAJOR >= 8 && IPP_VERSION_MINOR >= 1
|
||||||
int depth = src.depth();
|
int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||||
int channels = src.channels();
|
|
||||||
if( (depth == CV_8U || depth == CV_16U || depth == CV_32F) &&
|
if( (depth == CV_8U || depth == CV_16U || depth == CV_32F) &&
|
||||||
( channels == 1 || channels == 3 || channels == 4 ) &&
|
(cn == 1 || cn == 3 || cn == 4) &&
|
||||||
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT ) )
|
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT ) &&
|
||||||
|
(interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC))
|
||||||
{
|
{
|
||||||
int type = src.type();
|
ippiWarpPerspectiveFunc ippFunc = 0;
|
||||||
ippiWarpPerspectiveBackFunc ippFunc =
|
if ((flags & WARP_INVERSE_MAP) != 0)
|
||||||
type == CV_8UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C1R :
|
{
|
||||||
type == CV_8UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C3R :
|
ippFunc = type == CV_8UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C1R :
|
||||||
type == CV_8UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C4R :
|
type == CV_8UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C3R :
|
||||||
type == CV_16UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C1R :
|
type == CV_8UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_8u_C4R :
|
||||||
type == CV_16UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C3R :
|
type == CV_16UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C1R :
|
||||||
type == CV_16UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C4R :
|
type == CV_16UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C3R :
|
||||||
type == CV_32FC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C1R :
|
type == CV_16UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_16u_C4R :
|
||||||
type == CV_32FC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C3R :
|
type == CV_32FC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C1R :
|
||||||
type == CV_32FC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C4R :
|
type == CV_32FC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C3R :
|
||||||
0;
|
type == CV_32FC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspectiveBack_32f_C4R : 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ippFunc = type == CV_8UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C1R :
|
||||||
|
type == CV_8UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C3R :
|
||||||
|
type == CV_8UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_8u_C4R :
|
||||||
|
type == CV_16UC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C1R :
|
||||||
|
type == CV_16UC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C3R :
|
||||||
|
type == CV_16UC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_16u_C4R :
|
||||||
|
type == CV_32FC1 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C1R :
|
||||||
|
type == CV_32FC3 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C3R :
|
||||||
|
type == CV_32FC4 ? (ippiWarpPerspectiveFunc)ippiWarpPerspective_32f_C4R : 0;
|
||||||
|
}
|
||||||
int mode =
|
int mode =
|
||||||
flags == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
interpolation == INTER_NEAREST ? IPPI_INTER_NN :
|
||||||
flags == INTER_NEAREST ? IPPI_INTER_NN :
|
interpolation == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
||||||
flags == INTER_CUBIC ? IPPI_INTER_CUBIC :
|
interpolation == INTER_CUBIC ? IPPI_INTER_CUBIC : 0;
|
||||||
0;
|
CV_Assert(mode && ippFunc);
|
||||||
if( mode && ippFunc )
|
|
||||||
{
|
|
||||||
double coeffs[3][3];
|
double coeffs[3][3];
|
||||||
for( int i = 0; i < 3; i++ )
|
for( int i = 0; i < 3; i++ )
|
||||||
{
|
|
||||||
for( int j = 0; j < 3; j++ )
|
for( int j = 0; j < 3; j++ )
|
||||||
{
|
|
||||||
coeffs[i][j] = matM.at<double>(i, j);
|
coeffs[i][j] = matM.at<double>(i, j);
|
||||||
}
|
|
||||||
}
|
|
||||||
bool ok;
|
bool ok;
|
||||||
Range range(0, dst.rows);
|
Range range(0, dst.rows);
|
||||||
IPPwarpPerspectiveInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
IPPWarpPerspectiveInvoker invoker(src, dst, coeffs, mode, borderType, borderValue, ippFunc, &ok);
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
if( ok )
|
if( ok )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if( !(flags & WARP_INVERSE_MAP) )
|
||||||
|
invert(matM, matM);
|
||||||
|
|
||||||
Range range(0, dst.rows);
|
Range range(0, dst.rows);
|
||||||
warpPerspectiveInvoker invoker(src, dst, M, interpolation, borderType, borderValue);
|
WarpPerspectiveInvoker invoker(src, dst, M, interpolation, borderType, borderValue);
|
||||||
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user