@@ -5019,10 +5019,14 @@ void cv::remap( InputArray _src, OutputArray _dst,
5019
5019
{
5020
5020
if ( interpolation == INTER_LINEAR )
5021
5021
ifunc = linear_tab[depth];
5022
- else if ( interpolation == INTER_CUBIC )
5022
+ else if ( interpolation == INTER_CUBIC ){
5023
5023
ifunc = cubic_tab[depth];
5024
- else if ( interpolation == INTER_LANCZOS4 )
5024
+ CV_Assert ( _src.channels () <= 4 );
5025
+ }
5026
+ else if ( interpolation == INTER_LANCZOS4 ){
5025
5027
ifunc = lanczos4_tab[depth];
5028
+ CV_Assert ( _src.channels () <= 4 );
5029
+ }
5026
5030
else
5027
5031
CV_Error ( CV_StsBadArg, " Unknown interpolation method" );
5028
5032
CV_Assert ( ifunc != 0 );
@@ -6003,6 +6007,10 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
6003
6007
{
6004
6008
CV_INSTRUMENT_REGION ()
6005
6009
6010
+ int interpolation = flags & INTER_MAX;
6011
+ CV_Assert ( _src.channels () <= 4 || (interpolation != INTER_LANCZOS4 &&
6012
+ interpolation != INTER_CUBIC) );
6013
+
6006
6014
CV_OCL_RUN (_src.dims () <= 2 && _dst.isUMat () &&
6007
6015
_src.cols () <= SHRT_MAX && _src.rows () <= SHRT_MAX,
6008
6016
ocl_warpTransform_cols4 (_src, _dst, _M0, dsize, flags, borderType,
@@ -6021,7 +6029,6 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
6021
6029
6022
6030
double M[6 ];
6023
6031
Mat matM (2 , 3 , CV_64F, M);
6024
- int interpolation = flags & INTER_MAX;
6025
6032
if ( interpolation == INTER_AREA )
6026
6033
interpolation = INTER_LINEAR;
6027
6034
0 commit comments