mirror of
https://github.com/opencv/opencv.git
synced 2025-07-24 14:06:27 +08:00
Added assertios to remap and warpAffine functions
Remap and warpAffine functions do not support more than 4 channels in Bicubic and Lanczos4 interpolation modes. Assertions were added. resolve #8272
This commit is contained in:
parent
6f39f9a6a0
commit
c4ae5c0ee5
@ -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 );
|
||||
@ -5962,6 +5966,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,
|
||||
@ -5980,7 +5988,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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user