Merge pull request #8377 from ottogin:interpMultichannelImg

This commit is contained in:
Vadim Pisarevsky 2017-05-24 12:38:41 +00:00
commit 057c10baac
2 changed files with 12 additions and 3 deletions

View File

@ -5019,10 +5019,14 @@ void cv::remap( InputArray _src, OutputArray _dst,
{
if( interpolation == INTER_LINEAR )
ifunc = linear_tab[depth];
else if( interpolation == INTER_CUBIC )
else if( interpolation == INTER_CUBIC ){
ifunc = cubic_tab[depth];
else if( interpolation == INTER_LANCZOS4 )
CV_Assert( _src.channels() <= 4 );
}
else if( interpolation == INTER_LANCZOS4 ){
ifunc = lanczos4_tab[depth];
CV_Assert( _src.channels() <= 4 );
}
else
CV_Error( CV_StsBadArg, "Unknown interpolation method" );
CV_Assert( ifunc != 0 );
@ -6003,6 +6007,10 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
{
CV_INSTRUMENT_REGION()
int interpolation = flags & INTER_MAX;
CV_Assert( _src.channels() <= 4 || (interpolation != INTER_LANCZOS4 &&
interpolation != INTER_CUBIC) );
CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat() &&
_src.cols() <= SHRT_MAX && _src.rows() <= SHRT_MAX,
ocl_warpTransform_cols4(_src, _dst, _M0, dsize, flags, borderType,
@ -6021,7 +6029,6 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
double M[6];
Mat matM(2, 3, CV_64F, M);
int interpolation = flags & INTER_MAX;
if( interpolation == INTER_AREA )
interpolation = INTER_LINEAR;

View File

@ -1703,6 +1703,8 @@ TEST(Imgproc_Warp, multichannel)
int width = rng.uniform(3, 333);
int height = rng.uniform(3, 333);
int cn = rng.uniform(1, 15);
if(inter == INTER_CUBIC || inter == INTER_LANCZOS4)
cn = rng.uniform(1, 5);
Mat src(height, width, CV_8UC(cn)), dst;
//randu(src, 0, 256);
src.setTo(0.);