|
|
|
@ -91,13 +91,11 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) |
|
|
|
|
switch( type ) |
|
|
|
|
{ |
|
|
|
|
case THRESH_TRUNC: |
|
|
|
|
#ifndef HAVE_IPP_ICV_ONLY |
|
|
|
|
if (_src.data == _dst.data && ippiThreshold_GT_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (ippiThreshold_GT_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
@ -106,13 +104,11 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) |
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
break; |
|
|
|
|
case THRESH_TOZERO: |
|
|
|
|
#ifndef HAVE_IPP_ICV_ONLY |
|
|
|
|
if (_src.data == _dst.data && ippiThreshold_LTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (ippiThreshold_LTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
@ -121,13 +117,11 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) |
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
break; |
|
|
|
|
case THRESH_TOZERO_INV: |
|
|
|
|
#ifndef HAVE_IPP_ICV_ONLY |
|
|
|
|
if (_src.data == _dst.data && ippiThreshold_GTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (ippiThreshold_GTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
@ -434,13 +428,11 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) |
|
|
|
|
switch( type ) |
|
|
|
|
{ |
|
|
|
|
case THRESH_TRUNC: |
|
|
|
|
#ifndef HAVE_IPP_ICV_ONLY |
|
|
|
|
if (_src.data == _dst.data && ippiThreshold_GT_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (ippiThreshold_GT_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
@ -449,13 +441,11 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) |
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
break; |
|
|
|
|
case THRESH_TOZERO: |
|
|
|
|
#ifndef HAVE_IPP_ICV_ONLY |
|
|
|
|
if (_src.data == _dst.data && ippiThreshold_LTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh + 1, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (ippiThreshold_LTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+1, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
@ -464,13 +454,11 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) |
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
break; |
|
|
|
|
case THRESH_TOZERO_INV: |
|
|
|
|
#ifndef HAVE_IPP_ICV_ONLY |
|
|
|
|
if (_src.data == _dst.data && ippiThreshold_GTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (ippiThreshold_GTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0) |
|
|
|
|
{ |
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
@ -1188,7 +1176,7 @@ thresh_64f(const Mat& _src, Mat& _dst, double thresh, double maxval, int type) |
|
|
|
|
#ifdef HAVE_IPP |
|
|
|
|
static bool ipp_getThreshVal_Otsu_8u( const unsigned char* _src, int step, Size size, unsigned char &thresh) |
|
|
|
|
{ |
|
|
|
|
#if IPP_VERSION_X100 >= 810 && !HAVE_ICV |
|
|
|
|
#if IPP_VERSION_X100 >= 810 |
|
|
|
|
int ippStatus = -1; |
|
|
|
|
IppiSize srcSize = { size.width, size.height }; |
|
|
|
|
CV_SUPPRESS_DEPRECATED_START |
|
|
|
@ -1218,7 +1206,7 @@ getThreshVal_Otsu_8u( const Mat& _src ) |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_IPP |
|
|
|
|
unsigned char thresh; |
|
|
|
|
CV_IPP_RUN(IPP_VERSION_X100 >= 810 && !HAVE_ICV, ipp_getThreshVal_Otsu_8u(_src.ptr(), step, size, thresh), thresh); |
|
|
|
|
CV_IPP_RUN(IPP_VERSION_X100 >= 810, ipp_getThreshVal_Otsu_8u(_src.ptr(), step, size, thresh), thresh); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
const int N = 256; |
|
|
|
|