Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
87eb1b8f
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
87eb1b8f
编写于
4月 16, 2014
作者:
I
Ilya Lavrenov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes in imgproc
上级
6f9ca3d7
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
141 addition
and
132 deletion
+141
-132
modules/imgproc/src/color.cpp
modules/imgproc/src/color.cpp
+28
-25
modules/imgproc/src/imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+19
-23
modules/imgproc/src/moments.cpp
modules/imgproc/src/moments.cpp
+49
-49
modules/imgproc/src/morph.cpp
modules/imgproc/src/morph.cpp
+9
-3
modules/imgproc/src/smooth.cpp
modules/imgproc/src/smooth.cpp
+8
-7
modules/imgproc/src/templmatch.cpp
modules/imgproc/src/templmatch.cpp
+12
-17
modules/imgproc/test/ocl/test_color.cpp
modules/imgproc/test/ocl/test_color.cpp
+16
-8
未找到文件。
modules/imgproc/src/color.cpp
浏览文件 @
87eb1b8f
...
@@ -310,8 +310,8 @@ static ippiReorderFunc ippiSwapChannelsC4RTab[] =
...
@@ -310,8 +310,8 @@ static ippiReorderFunc ippiSwapChannelsC4RTab[] =
static
ippiColor2GrayFunc
ippiColor2GrayC3Tab
[]
=
static
ippiColor2GrayFunc
ippiColor2GrayC3Tab
[]
=
{
{
/*(ippiColor2GrayFunc)ippiColorToGray_8u_C3C1R*/
0
,
0
,
/*(ippiColor2GrayFunc)ippiColorToGray_16u_C3C1R*/
0
,
0
,
(
ippiColor2GrayFunc
)
ippiColorToGray_8u_C3C1R
,
0
,
(
ippiColor2GrayFunc
)
ippiColorToGray_16u_C3C1R
,
0
,
0
,
/*(ippiColor2GrayFunc)ippiColorToGray_32f_C3C1R*/
0
,
0
,
0
0
,
(
ippiColor2GrayFunc
)
ippiColorToGray_32f_C3C1R
,
0
,
0
};
};
static
ippiColor2GrayFunc
ippiColor2GrayC4Tab
[]
=
static
ippiColor2GrayFunc
ippiColor2GrayC4Tab
[]
=
...
@@ -341,18 +341,18 @@ static ippiGeneralFunc ippiCopyP3C3RTab[] =
...
@@ -341,18 +341,18 @@ static ippiGeneralFunc ippiCopyP3C3RTab[] =
static
ippiGeneralFunc
ippiRGB2XYZTab
[]
=
static
ippiGeneralFunc
ippiRGB2XYZTab
[]
=
{
{
(
ippiGeneralFunc
)
ippiRGBToXYZ_8u_C3R
,
0
,
(
ippiGeneralFunc
)
ippiRGBToXYZ_16u_C3R
,
0
,
(
ippiGeneralFunc
)
ippiRGBToXYZ_8u_C3R
,
0
,
(
ippiGeneralFunc
)
ippiRGBToXYZ_16u_C3R
,
0
,
0
,
/*(ippiGeneralFunc)ippiRGBToXYZ_32f_C3R*/
0
,
0
,
0
0
,
(
ippiGeneralFunc
)
ippiRGBToXYZ_32f_C3R
,
0
,
0
};
};
static
ippiGeneralFunc
ippiXYZ2RGBTab
[]
=
static
ippiGeneralFunc
ippiXYZ2RGBTab
[]
=
{
{
(
ippiGeneralFunc
)
ippiXYZToRGB_8u_C3R
,
0
,
(
ippiGeneralFunc
)
ippiXYZToRGB_16u_C3R
,
0
,
(
ippiGeneralFunc
)
ippiXYZToRGB_8u_C3R
,
0
,
(
ippiGeneralFunc
)
ippiXYZToRGB_16u_C3R
,
0
,
0
,
/*(ippiGeneralFunc)ippiXYZToRGB_32f_C3R*/
0
,
0
,
0
0
,
(
ippiGeneralFunc
)
ippiXYZToRGB_32f_C3R
,
0
,
0
};
};
static
ippiGeneralFunc
ippiRGB2HSVTab
[]
=
static
ippiGeneralFunc
ippiRGB2HSVTab
[]
=
{
{
/*(ippiGeneralFunc)ippiRGBToHSV_8u_C3R*/
0
,
0
,
/*(ippiGeneralFunc)ippiRGBToHSV_16u_C3R*/
0
,
0
,
(
ippiGeneralFunc
)
ippiRGBToHSV_8u_C3R
,
0
,
(
ippiGeneralFunc
)
ippiRGBToHSV_16u_C3R
,
0
,
0
,
0
,
0
,
0
0
,
0
,
0
,
0
};
};
...
@@ -3345,13 +3345,16 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
...
@@ -3345,13 +3345,16 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY)
#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY)
CV_SUPPRESS_DEPRECATED_START
CV_SUPPRESS_DEPRECATED_START
#if 0
if (code == CV_BGR2BGR565 && scn == 3)
if (code == CV_BGR2BGR565 && scn == 3)
{
{
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R)))
if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R)))
return;
return;
setIppErrorStatus();
setIppErrorStatus();
}
}
else
if
(
code
==
CV_BGRA2BGR565
)
else
#endif
if
(
code
==
CV_BGRA2BGR565
&&
scn
==
4
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
...
@@ -3359,14 +3362,14 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
...
@@ -3359,14 +3362,14 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_RGB2BGR565
)
else
if
(
code
==
CV_RGB2BGR565
&&
scn
==
3
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC3RTab
[
depth
],
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC3RTab
[
depth
],
(
ippiGeneralFunc
)
ippiBGRToBGR565_8u16u_C3R
,
2
,
1
,
0
,
depth
))
)
(
ippiGeneralFunc
)
ippiBGRToBGR565_8u16u_C3R
,
2
,
1
,
0
,
depth
))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_RGBA2BGR565
)
else
if
(
code
==
CV_RGBA2BGR565
&&
scn
==
4
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
(
ippiGeneralFunc
)
ippiBGRToBGR565_8u16u_C3R
,
2
,
1
,
0
,
depth
))
)
(
ippiGeneralFunc
)
ippiBGRToBGR565_8u16u_C3R
,
2
,
1
,
0
,
depth
))
)
...
@@ -3399,27 +3402,27 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
...
@@ -3399,27 +3402,27 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY)
#if defined HAVE_IPP && !defined(HAVE_IPP_ICV_ONLY)
CV_SUPPRESS_DEPRECATED_START
CV_SUPPRESS_DEPRECATED_START
if
(
code
==
CV_BGR5652BGR
)
if
(
code
==
CV_BGR5652BGR
&&
dcn
==
3
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
)))
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
)))
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_BGR5652RGB
)
else
if
(
code
==
CV_BGR5652RGB
&&
dcn
==
3
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
,
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
,
ippiSwapChannelsC3RTab
[
depth
],
2
,
1
,
0
,
depth
)))
ippiSwapChannelsC3RTab
[
depth
],
2
,
1
,
0
,
depth
)))
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
if
(
code
==
CV_BGR5652BGRA
)
else
if
(
code
==
CV_BGR5652BGRA
&&
dcn
==
4
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
,
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
,
ippiSwapChannelsC3C4RTab
[
depth
],
0
,
1
,
2
,
depth
)))
ippiSwapChannelsC3C4RTab
[
depth
],
0
,
1
,
2
,
depth
)))
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_BGR5652RGBA
)
else
if
(
code
==
CV_BGR5652RGBA
&&
dcn
==
4
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
,
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
((
ippiGeneralFunc
)
ippiBGR565ToBGR_16u8u_C3R
,
ippiSwapChannelsC3C4RTab
[
depth
],
2
,
1
,
0
,
depth
)))
ippiSwapChannelsC3C4RTab
[
depth
],
2
,
1
,
0
,
depth
)))
...
@@ -3443,25 +3446,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
...
@@ -3443,25 +3446,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
dst
=
_dst
.
getMat
();
dst
=
_dst
.
getMat
();
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if
(
code
==
CV_BGR2GRAY
)
if
(
code
==
CV_BGR2GRAY
&&
depth
==
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPColor2GrayFunctor
(
ippiColor2GrayC3Tab
[
depth
]))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPColor2GrayFunctor
(
ippiColor2GrayC3Tab
[
depth
]))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_RGB2GRAY
)
else
if
(
code
==
CV_RGB2GRAY
&&
depth
==
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2GrayC3Tab
[
depth
]))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2GrayC3Tab
[
depth
]))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_BGRA2GRAY
)
else
if
(
code
==
CV_BGRA2GRAY
&&
depth
==
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPColor2GrayFunctor
(
ippiColor2GrayC4Tab
[
depth
]))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPColor2GrayFunctor
(
ippiColor2GrayC4Tab
[
depth
]))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_RGBA2GRAY
)
else
if
(
code
==
CV_RGBA2GRAY
&&
depth
==
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2GrayC4Tab
[
depth
]))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2GrayC4Tab
[
depth
]))
)
return
;
return
;
...
@@ -3654,25 +3657,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
...
@@ -3654,25 +3657,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
dst
=
_dst
.
getMat
();
dst
=
_dst
.
getMat
();
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if
(
code
==
CV_BGR2XYZ
&&
scn
==
3
)
if
(
code
==
CV_BGR2XYZ
&&
scn
==
3
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC3RTab
[
depth
],
ippiRGB2XYZTab
[
depth
],
2
,
1
,
0
,
depth
))
)
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC3RTab
[
depth
],
ippiRGB2XYZTab
[
depth
],
2
,
1
,
0
,
depth
))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_BGR2XYZ
&&
scn
==
4
)
else
if
(
code
==
CV_BGR2XYZ
&&
scn
==
4
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
ippiRGB2XYZTab
[
depth
],
2
,
1
,
0
,
depth
))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
ippiRGB2XYZTab
[
depth
],
2
,
1
,
0
,
depth
))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_RGB2XYZ
&&
scn
==
3
)
else
if
(
code
==
CV_RGB2XYZ
&&
scn
==
3
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2XYZTab
[
depth
]))
)
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2XYZTab
[
depth
]))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_RGB2XYZ
&&
scn
==
4
)
else
if
(
code
==
CV_RGB2XYZ
&&
scn
==
4
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
ippiRGB2XYZTab
[
depth
],
0
,
1
,
2
,
depth
))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPReorderGeneralFunctor
(
ippiSwapChannelsC4C3RTab
[
depth
],
ippiRGB2XYZTab
[
depth
],
0
,
1
,
2
,
depth
))
)
return
;
return
;
...
@@ -3697,25 +3700,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
...
@@ -3697,25 +3700,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
dst
=
_dst
.
getMat
();
dst
=
_dst
.
getMat
();
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if
(
code
==
CV_XYZ2BGR
&&
dcn
==
3
)
if
(
code
==
CV_XYZ2BGR
&&
dcn
==
3
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralReorderFunctor
(
ippiXYZ2RGBTab
[
depth
],
ippiSwapChannelsC3RTab
[
depth
],
2
,
1
,
0
,
depth
))
)
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralReorderFunctor
(
ippiXYZ2RGBTab
[
depth
],
ippiSwapChannelsC3RTab
[
depth
],
2
,
1
,
0
,
depth
))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_XYZ2BGR
&&
dcn
==
4
)
else
if
(
code
==
CV_XYZ2BGR
&&
dcn
==
4
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
(
ippiXYZ2RGBTab
[
depth
],
ippiSwapChannelsC3C4RTab
[
depth
],
2
,
1
,
0
,
depth
))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
(
ippiXYZ2RGBTab
[
depth
],
ippiSwapChannelsC3C4RTab
[
depth
],
2
,
1
,
0
,
depth
))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
if
(
code
==
CV_XYZ2RGB
&&
dcn
==
3
)
if
(
code
==
CV_XYZ2RGB
&&
dcn
==
3
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralFunctor
(
ippiXYZ2RGBTab
[
depth
]))
)
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralFunctor
(
ippiXYZ2RGBTab
[
depth
]))
)
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_XYZ2RGB
&&
dcn
==
4
)
else
if
(
code
==
CV_XYZ2RGB
&&
dcn
==
4
&&
depth
!=
CV_32F
)
{
{
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
(
ippiXYZ2RGBTab
[
depth
],
ippiSwapChannelsC3C4RTab
[
depth
],
0
,
1
,
2
,
depth
))
)
if
(
CvtColorIPPLoop
(
src
,
dst
,
IPPGeneralReorderFunctor
(
ippiXYZ2RGBTab
[
depth
],
ippiSwapChannelsC3C4RTab
[
depth
],
0
,
1
,
2
,
depth
))
)
return
;
return
;
...
@@ -3758,7 +3761,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
...
@@ -3758,7 +3761,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
return
;
return
;
setIppErrorStatus
();
setIppErrorStatus
();
}
}
else
if
(
code
==
CV_RGB2HSV_FULL
&&
scn
==
3
)
else
if
(
code
==
CV_RGB2HSV_FULL
&&
scn
==
3
&&
depth
==
CV_16U
)
{
{
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2HSVTab
[
depth
]))
)
if
(
CvtColorIPPLoopCopy
(
src
,
dst
,
IPPGeneralFunctor
(
ippiRGB2HSVTab
[
depth
]))
)
return
;
return
;
...
...
modules/imgproc/src/imgwarp.cpp
浏览文件 @
87eb1b8f
...
@@ -1876,19 +1876,18 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
...
@@ -1876,19 +1876,18 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
return
k
;
return
k
;
}
}
#define CHECK_IPP_FUNC(FUNC) if( FUNC==0 ) { *ok = false; return;}
#define CHECK_IPP_STATUS(STATUS) if (STATUS < 0) { *ok = false; return; }
#define CHECK_IPP_STATUS(STATUS) if( STATUS!=ippStsNoErr ) { *ok = false; return;}
#define SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN) \
#define SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN) \
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R;
CHECK_IPP_FUNC(func);
\
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; \
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
specBuf.allocate(specSize);\
specBuf.allocate(specSize);\
pSpec = (uchar*)specBuf;\
pSpec = (uchar*)specBuf;\
CHECK_IPP_STATUS(ippiResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_32f*)pSpec));
CHECK_IPP_STATUS(ippiResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_32f*)pSpec));
#define SET_IPP_RESIZE_LINEAR_FUNC_64_PTR(TYPE, CN) \
#define SET_IPP_RESIZE_LINEAR_FUNC_64_PTR(TYPE, CN) \
if (mode
==(int)ippCubic) { *ok = false; return;}
\
if (mode
== (int)ippCubic) { *ok = false; return; }
\
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R;
CHECK_IPP_FUNC(func);
\
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; \
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
specBuf.allocate(specSize);\
specBuf.allocate(specSize);\
pSpec = (uchar*)specBuf;\
pSpec = (uchar*)specBuf;\
...
@@ -1897,19 +1896,19 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
...
@@ -1897,19 +1896,19 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
getSrcOffsetFunc = (ippiResizeGetSrcOffset) ippiResizeGetBufferSize_##TYPE;
getSrcOffsetFunc = (ippiResizeGetSrcOffset) ippiResizeGetBufferSize_##TYPE;
#define SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN) \
#define SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN) \
func = (ippiResizeFunc)ippiResizeCubic_##TYPE##_##CN##R;
CHECK_IPP_FUNC(func);
\
func = (ippiResizeFunc)ippiResizeCubic_##TYPE##_##CN##R; \
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
specBuf.allocate(specSize);\
specBuf.allocate(specSize);\
pSpec = (uchar*)specBuf;\
pSpec = (uchar*)specBuf;\
AutoBuffer<uchar> buf(initSize);\
AutoBuffer<uchar> buf(initSize);\
uchar* pInit = (uchar*)buf;\
uchar* pInit = (uchar*)buf;\
CHECK_IPP_STATUS(ippiResizeCubicInit_##TYPE(srcSize, dstSize,
0.f, 0.75f, (IppiResizeSpec_32f*)pSpec, pInit));
CHECK_IPP_STATUS(ippiResizeCubicInit_##TYPE(srcSize, dstSize, 0.f, 0.75f, (IppiResizeSpec_32f*)pSpec, pInit));
#define SET_IPP_RESIZE_PTR(TYPE, CN) \
#define SET_IPP_RESIZE_PTR(TYPE, CN) \
if (mode == (int)ippLinear) { SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN);}\
if (mode == (int)ippLinear) { SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN);}
\
else if (mode == (int)ippCubic) { SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN);}\
else if (mode == (int)ippCubic) { SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN);}
\
else { *ok = false; return;
}
\
else { *ok = false; return;
}
\
getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\
getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;
\
getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE;
getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE;
#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701
#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701
...
@@ -2392,29 +2391,26 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
...
@@ -2392,29 +2391,26 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
return
;
return
;
#endif
#endif
int
depth
=
src
.
depth
(),
cn
=
src
.
channels
(
);
int
type
=
src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
double
scale_x
=
1.
/
inv_scale_x
,
scale_y
=
1.
/
inv_scale_y
;
double
scale_x
=
1.
/
inv_scale_x
,
scale_y
=
1.
/
inv_scale_y
;
int
k
,
sx
,
sy
,
dx
,
dy
;
int
k
,
sx
,
sy
,
dx
,
dy
;
#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701
#if !defined(HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 701
#define IPP_RESIZE_EPS
1.
e-10
#define IPP_RESIZE_EPS
1
e-10
double
ex
=
fabs
((
double
)
dsize
.
width
/
src
.
cols
-
inv_scale_x
)
/
inv_scale_x
;
double
ex
=
fabs
((
double
)
dsize
.
width
/
src
.
cols
-
inv_scale_x
)
/
inv_scale_x
;
double
ey
=
fabs
((
double
)
dsize
.
height
/
src
.
rows
-
inv_scale_y
)
/
inv_scale_y
;
double
ey
=
fabs
((
double
)
dsize
.
height
/
src
.
rows
-
inv_scale_y
)
/
inv_scale_y
;
if
(
(
ex
<
IPP_RESIZE_EPS
&&
ey
<
IPP_RESIZE_EPS
&&
depth
!=
CV_64F
)
||
if
(
((
ex
<
IPP_RESIZE_EPS
&&
ey
<
IPP_RESIZE_EPS
&&
depth
!=
CV_64F
)
||
(
ex
==
0
&&
ey
==
0
&&
depth
==
CV_64F
))
&&
(
ex
==
0
&&
ey
==
0
&&
depth
==
CV_64F
))
(
interpolation
==
INTER_LINEAR
||
interpolation
==
INTER_CUBIC
))
{
{
int
mode
=
0
;
int
mode
=
-
1
;
if
(
interpolation
==
INTER_LINEAR
&&
src
.
rows
>=
2
&&
src
.
cols
>=
2
)
if
(
interpolation
==
INTER_LINEAR
&&
src
.
rows
>=
2
&&
src
.
cols
>=
2
)
{
mode
=
ippLinear
;
mode
=
ippLinear
;
}
else
if
(
interpolation
==
INTER_CUBIC
&&
src
.
rows
>=
4
&&
src
.
cols
>=
4
)
else
if
(
interpolation
==
INTER_CUBIC
&&
src
.
rows
>=
4
&&
src
.
cols
>=
4
)
{
mode
=
ippCubic
;
mode
=
ippCubic
;
}
if
(
mode
!=
0
&&
(
cn
==
1
||
cn
==
3
||
cn
==
4
)
&&
if
(
mode
>=
0
&&
(
cn
==
1
||
cn
==
3
||
cn
==
4
)
&&
(
depth
==
CV_8U
||
depth
==
CV_16U
||
depth
==
CV_16S
||
depth
==
CV_32F
||
(
depth
==
CV_8U
||
depth
==
CV_16U
||
depth
==
CV_16S
||
depth
==
CV_32F
||
(
depth
==
CV_64F
&&
mode
==
ippLinear
)))
(
depth
==
CV_64F
&&
mode
==
ippLinear
)))
{
{
...
...
modules/imgproc/src/moments.cpp
浏览文件 @
87eb1b8f
...
@@ -444,19 +444,15 @@ cv::Moments cv::moments( InputArray _src, bool binary )
...
@@ -444,19 +444,15 @@ cv::Moments cv::moments( InputArray _src, bool binary )
MomentsInTileFunc
func
=
0
;
MomentsInTileFunc
func
=
0
;
uchar
nzbuf
[
TILE_SIZE
*
TILE_SIZE
];
uchar
nzbuf
[
TILE_SIZE
*
TILE_SIZE
];
Moments
m
;
Moments
m
;
int
type
=
_src
.
type
();
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
int
depth
=
CV_MAT_DEPTH
(
type
);
int
cn
=
CV_MAT_CN
(
type
);
Size
size
=
_src
.
size
();
Size
size
=
_src
.
size
();
if
(
size
.
width
<=
0
||
size
.
height
<=
0
)
if
(
size
.
width
<=
0
||
size
.
height
<=
0
)
return
m
;
return
m
;
#ifdef HAVE_OPENCL
#ifdef HAVE_OPENCL
if
(
ocl
::
useOpenCL
()
&&
type
==
CV_8UC1
&&
!
binary
&&
if
(
!
(
ocl
::
useOpenCL
()
&&
type
==
CV_8UC1
&&
!
binary
&&
_src
.
isUMat
()
&&
ocl_moments
(
_src
,
m
)
)
_src
.
isUMat
()
&&
ocl_moments
(
_src
,
m
))
)
;
else
#endif
#endif
{
{
Mat
mat
=
_src
.
getMat
();
Mat
mat
=
_src
.
getMat
();
...
@@ -469,57 +465,61 @@ cv::Moments cv::moments( InputArray _src, bool binary )
...
@@ -469,57 +465,61 @@ cv::Moments cv::moments( InputArray _src, bool binary )
#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY
#if IPP_VERSION_X100 >= 801 && !defined HAVE_IPP_ICV_ONLY
if
(
!
binary
)
if
(
!
binary
)
{
{
IppiSize
roi
=
{
mat
.
cols
,
mat
.
rows
};
IppiSize
roi
=
{
mat
.
cols
,
mat
.
rows
};
IppiMomentState_64f
*
moment
;
IppiMomentState_64f
*
moment
=
NULL
;
// ippiMomentInitAlloc_64f, ippiMomentFree_64f are deprecated in 8.1, but there are not another way
// ippiMomentInitAlloc_64f, ippiMomentFree_64f are deprecated in 8.1, but there are not another way
// to initialize IppiMomentState_64f. When GetStateSize and Init functions will appear we have to
// to initialize IppiMomentState_64f. When GetStateSize and Init functions will appear we have to
// change our code.
// change our code.
CV_SUPPRESS_DEPRECATED_START
CV_SUPPRESS_DEPRECATED_START
if
(
0
<=
ippiMomentInitAlloc_64f
(
&
moment
,
ippAlgHintAccurate
)
)
if
(
ippiMomentInitAlloc_64f
(
&
moment
,
ippAlgHintAccurate
)
>=
0
)
{
{
IppStatus
sts
=
(
IppStatus
)(
-
1
);
typedef
IppStatus
(
CV_STDCALL
*
ippiMoments
)(
const
void
*
pSrc
,
int
srcStep
,
IppiSize
roiSize
,
IppiMomentState_64f
*
pCtx
);
if
(
depth
==
CV_8U
)
ippiMoments
ippFunc
=
sts
=
ippiMoments64f_8u_C1R
((
const
Ipp8u
*
)
mat
.
data
,
(
int
)
mat
.
step
,
roi
,
moment
);
type
==
CV_8UC1
?
(
ippiMoments
)
ippiMoments64f_8u_C1R
:
else
if
(
depth
==
CV_16U
)
type
==
CV_16UC1
?
(
ippiMoments
)
ippiMoments64f_16u_C1R
:
sts
=
ippiMoments64f_16u_C1R
((
const
Ipp16u
*
)
mat
.
data
,
(
int
)
mat
.
step
,
roi
,
moment
);
type
==
CV_32FC1
?
(
ippiMoments
)
ippiMoments64f_32f_C1R
:
0
;
else
if
(
depth
==
CV_32F
)
sts
=
ippiMoments64f_32f_C1R
((
const
Ipp32f
*
)
mat
.
data
,
(
int
)
mat
.
step
,
roi
,
moment
);
if
(
ippFunc
)
if
(
0
<=
sts
)
{
{
IppiPoint
point
=
{
0
,
0
};
if
(
ippFunc
(
mat
.
data
,
(
int
)
mat
.
step
,
roi
,
moment
)
>=
0
)
ippiGetSpatialMoment_64f
(
moment
,
0
,
0
,
0
,
point
,
&
m
.
m00
);
{
ippiGetSpatialMoment_64f
(
moment
,
1
,
0
,
0
,
point
,
&
m
.
m10
);
IppiPoint
point
=
{
0
,
0
};
ippiGetSpatialMoment_64f
(
moment
,
0
,
1
,
0
,
point
,
&
m
.
m01
);
ippiGetSpatialMoment_64f
(
moment
,
0
,
0
,
0
,
point
,
&
m
.
m00
);
ippiGetSpatialMoment_64f
(
moment
,
1
,
0
,
0
,
point
,
&
m
.
m10
);
ippiGetSpatialMoment_64f
(
moment
,
2
,
0
,
0
,
point
,
&
m
.
m20
);
ippiGetSpatialMoment_64f
(
moment
,
0
,
1
,
0
,
point
,
&
m
.
m01
);
ippiGetSpatialMoment_64f
(
moment
,
1
,
1
,
0
,
point
,
&
m
.
m11
);
ippiGetSpatialMoment_64f
(
moment
,
0
,
2
,
0
,
point
,
&
m
.
m02
);
ippiGetSpatialMoment_64f
(
moment
,
2
,
0
,
0
,
point
,
&
m
.
m20
);
ippiGetSpatialMoment_64f
(
moment
,
1
,
1
,
0
,
point
,
&
m
.
m11
);
ippiGetSpatialMoment_64f
(
moment
,
3
,
0
,
0
,
point
,
&
m
.
m30
);
ippiGetSpatialMoment_64f
(
moment
,
0
,
2
,
0
,
point
,
&
m
.
m02
);
ippiGetSpatialMoment_64f
(
moment
,
2
,
1
,
0
,
point
,
&
m
.
m21
);
ippiGetSpatialMoment_64f
(
moment
,
1
,
2
,
0
,
point
,
&
m
.
m12
);
ippiGetSpatialMoment_64f
(
moment
,
3
,
0
,
0
,
point
,
&
m
.
m30
);
ippiGetSpatialMoment_64f
(
moment
,
0
,
3
,
0
,
point
,
&
m
.
m03
);
ippiGetSpatialMoment_64f
(
moment
,
2
,
1
,
0
,
point
,
&
m
.
m21
);
ippiGetCentralMoment_64f
(
moment
,
2
,
0
,
0
,
&
m
.
mu20
);
ippiGetSpatialMoment_64f
(
moment
,
1
,
2
,
0
,
point
,
&
m
.
m12
);
ippiGetCentralMoment_64f
(
moment
,
1
,
1
,
0
,
&
m
.
mu11
);
ippiGetSpatialMoment_64f
(
moment
,
0
,
3
,
0
,
point
,
&
m
.
m03
);
ippiGetCentralMoment_64f
(
moment
,
0
,
2
,
0
,
&
m
.
mu02
);
ippiGetCentralMoment_64f
(
moment
,
2
,
0
,
0
,
&
m
.
mu20
);
ippiGetCentralMoment_64f
(
moment
,
3
,
0
,
0
,
&
m
.
mu30
);
ippiGetCentralMoment_64f
(
moment
,
1
,
1
,
0
,
&
m
.
mu11
);
ippiGetCentralMoment_64f
(
moment
,
2
,
1
,
0
,
&
m
.
mu21
);
ippiGetCentralMoment_64f
(
moment
,
0
,
2
,
0
,
&
m
.
mu02
);
ippiGetCentralMoment_64f
(
moment
,
1
,
2
,
0
,
&
m
.
mu12
);
ippiGetCentralMoment_64f
(
moment
,
3
,
0
,
0
,
&
m
.
mu30
);
ippiGetCentralMoment_64f
(
moment
,
0
,
3
,
0
,
&
m
.
mu03
);
ippiGetCentralMoment_64f
(
moment
,
2
,
1
,
0
,
&
m
.
mu21
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
2
,
0
,
0
,
&
m
.
nu20
);
ippiGetCentralMoment_64f
(
moment
,
1
,
2
,
0
,
&
m
.
mu12
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
1
,
1
,
0
,
&
m
.
nu11
);
ippiGetCentralMoment_64f
(
moment
,
0
,
3
,
0
,
&
m
.
mu03
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
0
,
2
,
0
,
&
m
.
nu02
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
2
,
0
,
0
,
&
m
.
nu20
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
3
,
0
,
0
,
&
m
.
nu30
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
1
,
1
,
0
,
&
m
.
nu11
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
2
,
1
,
0
,
&
m
.
nu21
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
0
,
2
,
0
,
&
m
.
nu02
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
1
,
2
,
0
,
&
m
.
nu12
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
3
,
0
,
0
,
&
m
.
nu30
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
0
,
3
,
0
,
&
m
.
nu03
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
2
,
1
,
0
,
&
m
.
nu21
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
1
,
2
,
0
,
&
m
.
nu12
);
ippiMomentFree_64f
(
moment
);
ippiGetNormalizedCentralMoment_64f
(
moment
,
0
,
3
,
0
,
&
m
.
nu03
);
return
m
;
ippiMomentFree_64f
(
moment
);
return
m
;
}
setIppErrorStatus
();
}
}
ippiMomentFree_64f
(
moment
);
ippiMomentFree_64f
(
moment
);
}
}
setIppErrorStatus
();
else
setIppErrorStatus
();
CV_SUPPRESS_DEPRECATED_END
CV_SUPPRESS_DEPRECATED_END
}
}
#endif
#endif
...
...
modules/imgproc/src/morph.cpp
浏览文件 @
87eb1b8f
...
@@ -1269,10 +1269,13 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
...
@@ -1269,10 +1269,13 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
int
borderType
,
const
Scalar
&
borderValue
)
int
borderType
,
const
Scalar
&
borderValue
)
{
{
Mat
src
=
_src
.
getMat
(),
kernel
=
_kernel
;
Mat
src
=
_src
.
getMat
(),
kernel
=
_kernel
;
if
(
!
(
src
.
depth
()
==
CV_8U
||
src
.
depth
()
==
CV_32F
)
||
(
iterations
>
1
)
||
int
type
=
src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
if
(
!
(
depth
==
CV_8U
||
depth
==
CV_32F
)
||
!
(
cn
==
1
||
cn
==
3
||
cn
==
4
)
||
!
(
borderType
==
cv
::
BORDER_REPLICATE
||
(
borderType
==
cv
::
BORDER_CONSTANT
&&
borderValue
==
morphologyDefaultBorderValue
())
)
!
(
borderType
==
cv
::
BORDER_REPLICATE
||
(
borderType
==
cv
::
BORDER_CONSTANT
&&
borderValue
==
morphologyDefaultBorderValue
())
)
||
!
(
op
==
MORPH_DILATE
||
op
==
MORPH_ERODE
)
)
||
!
(
op
==
MORPH_DILATE
||
op
==
MORPH_ERODE
)
)
return
false
;
return
false
;
if
(
borderType
==
cv
::
BORDER_CONSTANT
&&
kernel
.
data
)
if
(
borderType
==
cv
::
BORDER_CONSTANT
&&
kernel
.
data
)
{
{
int
x
,
y
;
int
x
,
y
;
...
@@ -1331,7 +1334,11 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
...
@@ -1331,7 +1334,11 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
if
(
iterations
>
1
)
if
(
iterations
>
1
)
return
false
;
return
false
;
return
IPPMorphReplicate
(
op
,
src
,
dst
,
kernel
,
ksize
,
anchor
,
rectKernel
);
if
(
IPPMorphReplicate
(
op
,
src
,
dst
,
kernel
,
ksize
,
anchor
,
rectKernel
))
return
true
;
setIppErrorStatus
();
return
false
;
}
}
#endif
#endif
...
@@ -1466,7 +1473,6 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
...
@@ -1466,7 +1473,6 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
#if IPP_VERSION_X100 >= 801
#if IPP_VERSION_X100 >= 801
if
(
IPPMorphOp
(
op
,
_src
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
)
)
if
(
IPPMorphOp
(
op
,
_src
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
)
)
return
;
return
;
setIppErrorStatus
();
#endif
#endif
if
(
iterations
==
0
||
kernel
.
rows
*
kernel
.
cols
==
1
)
if
(
iterations
==
0
||
kernel
.
rows
*
kernel
.
cols
==
1
)
...
...
modules/imgproc/src/smooth.cpp
浏览文件 @
87eb1b8f
...
@@ -867,11 +867,11 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
...
@@ -867,11 +867,11 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
ippAnchor
.
y
=
ksize
.
height
/
2
-
(
ksize
.
height
%
2
==
0
?
1
:
0
);
ippAnchor
.
y
=
ksize
.
height
/
2
-
(
ksize
.
height
%
2
==
0
?
1
:
0
);
if
(
normalize
&&
!
src
.
isSubmatrix
()
&&
ddepth
==
sdepth
&&
if
(
normalize
&&
!
src
.
isSubmatrix
()
&&
ddepth
==
sdepth
&&
(
ippBorderType
==
BORDER_REPLICATE
||
ippBorderType
==
BORDER_CONSTANT
)
&&
(
/*ippBorderType == BORDER_REPLICATE ||*/
/* returns ippStsStepErr: Step value is not valid */
ocvAnchor
==
ippAnchor
)
ippBorderType
==
BORDER_CONSTANT
)
&&
ocvAnchor
==
ippAnchor
)
{
{
Ipp32s
bufSize
;
Ipp32s
bufSize
=
0
;
IppiSize
roiSize
=
ippiSize
(
dst
.
cols
,
dst
.
rows
),
maskSize
=
ippiSize
(
ksize
.
width
,
ksize
.
height
)
;
IppiSize
roiSize
=
{
dst
.
cols
,
dst
.
rows
},
maskSize
=
{
ksize
.
width
,
ksize
.
height
}
;
#define IPP_FILTER_BOX_BORDER(ippType, ippDataType, flavor) \
#define IPP_FILTER_BOX_BORDER(ippType, ippDataType, flavor) \
do \
do \
...
@@ -880,11 +880,12 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
...
@@ -880,11 +880,12 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
{ \
{ \
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
ippType borderValue[4] = { 0, 0, 0, 0 }; \
ippType borderValue[4] = { 0, 0, 0, 0 }; \
ippBorderType = ippBorderType == BORDER_CONSTANT ? ippBorderConst : ippBorder
Type == BORDER_REPLICATE ? ippBorderRepl : -1
; \
ippBorderType = ippBorderType == BORDER_CONSTANT ? ippBorderConst : ippBorder
Repl
; \
CV_Assert(ippBorderType >= 0);
\
IppStatus status = ippiFilterBoxBorder_##flavor((const ippType *)src.data, (int)src.step, (ippType *)dst.data,
\
IppStatus status = ippiFilterBoxBorder_##flavor((ippType *)src.data, (int)src.step, (ippType *)dst.data,
(int)dst.step, roiSize, maskSize, \
(int)dst.step, roiSize, maskSize, \
(IppiBorderType)ippBorderType, borderValue, buffer); \
(IppiBorderType)ippBorderType, borderValue, buffer); \
ippsFree(buffer); \
ippsFree(buffer); \
printf("%s %d %d\n", ippGetStatusString(status), (int)src.step, (int)dst.step); \
if (status >= 0) \
if (status >= 0) \
return; \
return; \
} \
} \
...
...
modules/imgproc/src/templmatch.cpp
浏览文件 @
87eb1b8f
...
@@ -347,9 +347,6 @@ typedef IppStatus (CV_STDCALL * ippimatchTemplate)(const void*, int, IppiSize, c
...
@@ -347,9 +347,6 @@ typedef IppStatus (CV_STDCALL * ippimatchTemplate)(const void*, int, IppiSize, c
static
bool
ipp_crossCorr
(
const
Mat
&
src
,
const
Mat
&
tpl
,
Mat
&
dst
)
static
bool
ipp_crossCorr
(
const
Mat
&
src
,
const
Mat
&
tpl
,
Mat
&
dst
)
{
{
if
(
src
.
channels
()
!=
1
)
return
false
;
IppStatus
status
;
IppStatus
status
;
IppiSize
srcRoiSize
=
{
src
.
cols
,
src
.
rows
};
IppiSize
srcRoiSize
=
{
src
.
cols
,
src
.
rows
};
...
@@ -383,9 +380,6 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst)
...
@@ -383,9 +380,6 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst)
static
bool
ipp_sqrDistance
(
const
Mat
&
src
,
const
Mat
&
tpl
,
Mat
&
dst
)
static
bool
ipp_sqrDistance
(
const
Mat
&
src
,
const
Mat
&
tpl
,
Mat
&
dst
)
{
{
if
(
src
.
channels
()
!=
1
)
return
false
;
IppStatus
status
;
IppStatus
status
;
IppiSize
srcRoiSize
=
{
src
.
cols
,
src
.
rows
};
IppiSize
srcRoiSize
=
{
src
.
cols
,
src
.
rows
};
...
@@ -423,12 +417,6 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
...
@@ -423,12 +417,6 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
Size
corrsize
,
int
ctype
,
Size
corrsize
,
int
ctype
,
Point
anchor
,
double
delta
,
int
borderType
)
Point
anchor
,
double
delta
,
int
borderType
)
{
{
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
if
(
ipp_crossCorr
(
img
,
_templ
,
corr
))
return
;
setIppErrorStatus
();
#endif
const
double
blockScale
=
4.5
;
const
double
blockScale
=
4.5
;
const
int
minBlockSize
=
256
;
const
int
minBlockSize
=
256
;
std
::
vector
<
uchar
>
buf
;
std
::
vector
<
uchar
>
buf
;
...
@@ -613,8 +601,9 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
...
@@ -613,8 +601,9 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
void
cv
::
matchTemplate
(
InputArray
_img
,
InputArray
_templ
,
OutputArray
_result
,
int
method
)
void
cv
::
matchTemplate
(
InputArray
_img
,
InputArray
_templ
,
OutputArray
_result
,
int
method
)
{
{
int
type
=
_img
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
CV_Assert
(
CV_TM_SQDIFF
<=
method
&&
method
<=
CV_TM_CCOEFF_NORMED
);
CV_Assert
(
CV_TM_SQDIFF
<=
method
&&
method
<=
CV_TM_CCOEFF_NORMED
);
CV_Assert
(
(
_img
.
depth
()
==
CV_8U
||
_img
.
depth
()
==
CV_32F
)
&&
_img
.
type
()
==
_templ
.
type
()
&&
_img
.
dims
()
<=
2
);
CV_Assert
(
(
depth
==
CV_8U
||
depth
==
CV_32F
)
&&
type
==
_templ
.
type
()
&&
_img
.
dims
()
<=
2
);
bool
needswap
=
_img
.
size
().
height
<
_templ
.
size
().
height
||
_img
.
size
().
width
<
_templ
.
size
().
width
;
bool
needswap
=
_img
.
size
().
height
<
_templ
.
size
().
height
||
_img
.
size
().
width
<
_templ
.
size
().
width
;
if
(
needswap
)
if
(
needswap
)
...
@@ -645,7 +634,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
...
@@ -645,7 +634,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
#endif
#endif
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
if
(
method
==
CV_TM_SQDIFF
)
if
(
method
==
CV_TM_SQDIFF
&&
cn
==
1
)
{
{
if
(
ipp_sqrDistance
(
img
,
templ
,
result
))
if
(
ipp_sqrDistance
(
img
,
templ
,
result
))
return
;
return
;
...
@@ -653,10 +642,16 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
...
@@ -653,10 +642,16 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
}
}
#endif
#endif
int
cn
=
img
.
channels
();
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
if
(
!
ipp_crossCorr
(
img
,
templ
,
result
))
if
(
cn
==
1
)
{
if
(
!
ipp_crossCorr
(
img
,
templ
,
result
))
{
setIppErrorStatus
();
crossCorr
(
img
,
templ
,
result
,
result
.
size
(),
result
.
type
(),
Point
(
0
,
0
),
0
,
0
);
}
}
else
#endif
#endif
crossCorr
(
img
,
templ
,
result
,
result
.
size
(),
result
.
type
(),
Point
(
0
,
0
),
0
,
0
);
crossCorr
(
img
,
templ
,
result
,
result
.
size
(),
result
.
type
(),
Point
(
0
,
0
),
0
,
0
);
...
...
modules/imgproc/test/ocl/test_color.cpp
浏览文件 @
87eb1b8f
...
@@ -175,17 +175,25 @@ OCL_TEST_P(CvtColor, XYZ2BGRA) { performTest(3, 4, CVTCODE(XYZ2BGR), IPP_EPS); }
...
@@ -175,17 +175,25 @@ OCL_TEST_P(CvtColor, XYZ2BGRA) { performTest(3, 4, CVTCODE(XYZ2BGR), IPP_EPS); }
// RGB <-> HSV
// RGB <-> HSV
#if IPP_VERSION_X100 > 0
#define IPP_EPS depth <= CV_32S ? 1 : 4e-5
#else
#define IPP_EPS 1e-3
#endif
typedef
CvtColor
CvtColor8u32f
;
typedef
CvtColor
CvtColor8u32f
;
OCL_TEST_P
(
CvtColor8u32f
,
RGB2HSV
)
{
performTest
(
3
,
3
,
CVTCODE
(
RGB2HSV
));
}
OCL_TEST_P
(
CvtColor8u32f
,
RGB2HSV
)
{
performTest
(
3
,
3
,
CVTCODE
(
RGB2HSV
)
,
IPP_EPS
);
}
OCL_TEST_P
(
CvtColor8u32f
,
BGR2HSV
)
{
performTest
(
3
,
3
,
CVTCODE
(
BGR2HSV
));
}
OCL_TEST_P
(
CvtColor8u32f
,
BGR2HSV
)
{
performTest
(
3
,
3
,
CVTCODE
(
BGR2HSV
)
,
IPP_EPS
);
}
OCL_TEST_P
(
CvtColor8u32f
,
RGBA2HSV
)
{
performTest
(
4
,
3
,
CVTCODE
(
RGB2HSV
));
}
OCL_TEST_P
(
CvtColor8u32f
,
RGBA2HSV
)
{
performTest
(
4
,
3
,
CVTCODE
(
RGB2HSV
)
,
IPP_EPS
);
}
OCL_TEST_P
(
CvtColor8u32f
,
BGRA2HSV
)
{
performTest
(
4
,
3
,
CVTCODE
(
BGR2HSV
));
}
OCL_TEST_P
(
CvtColor8u32f
,
BGRA2HSV
)
{
performTest
(
4
,
3
,
CVTCODE
(
BGR2HSV
)
,
IPP_EPS
);
}
OCL_TEST_P
(
CvtColor8u32f
,
RGB2HSV_FULL
)
{
performTest
(
3
,
3
,
CVTCODE
(
RGB2HSV_FULL
));
}
OCL_TEST_P
(
CvtColor8u32f
,
RGB2HSV_FULL
)
{
performTest
(
3
,
3
,
CVTCODE
(
RGB2HSV_FULL
),
IPP_EPS
);
}
OCL_TEST_P
(
CvtColor8u32f
,
BGR2HSV_FULL
)
{
performTest
(
3
,
3
,
CVTCODE
(
BGR2HSV_FULL
));
}
OCL_TEST_P
(
CvtColor8u32f
,
BGR2HSV_FULL
)
{
performTest
(
3
,
3
,
CVTCODE
(
BGR2HSV_FULL
),
IPP_EPS
);
}
OCL_TEST_P
(
CvtColor8u32f
,
RGBA2HSV_FULL
)
{
performTest
(
4
,
3
,
CVTCODE
(
RGB2HSV_FULL
));
}
OCL_TEST_P
(
CvtColor8u32f
,
RGBA2HSV_FULL
)
{
performTest
(
4
,
3
,
CVTCODE
(
RGB2HSV_FULL
),
IPP_EPS
);
}
OCL_TEST_P
(
CvtColor8u32f
,
BGRA2HSV_FULL
)
{
performTest
(
4
,
3
,
CVTCODE
(
BGR2HSV_FULL
));
}
OCL_TEST_P
(
CvtColor8u32f
,
BGRA2HSV_FULL
)
{
performTest
(
4
,
3
,
CVTCODE
(
BGR2HSV_FULL
),
IPP_EPS
);
}
#undef IPP_EPS
OCL_TEST_P
(
CvtColor8u32f
,
HSV2RGB
)
{
performTest
(
3
,
3
,
CVTCODE
(
HSV2RGB
),
depth
==
CV_8U
?
1
:
4e-1
);
}
OCL_TEST_P
(
CvtColor8u32f
,
HSV2RGB
)
{
performTest
(
3
,
3
,
CVTCODE
(
HSV2RGB
),
depth
==
CV_8U
?
1
:
4e-1
);
}
OCL_TEST_P
(
CvtColor8u32f
,
HSV2BGR
)
{
performTest
(
3
,
3
,
CVTCODE
(
HSV2BGR
),
depth
==
CV_8U
?
1
:
4e-1
);
}
OCL_TEST_P
(
CvtColor8u32f
,
HSV2BGR
)
{
performTest
(
3
,
3
,
CVTCODE
(
HSV2BGR
),
depth
==
CV_8U
?
1
:
4e-1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录