Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
56c133d4
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
56c133d4
编写于
10月 25, 2016
作者:
V
Vladislav Sovrasov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disable redundant border initialization in findContours
上级
c55890f6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
57 addition
and
38 deletion
+57
-38
modules/imgproc/src/contours.cpp
modules/imgproc/src/contours.cpp
+57
-38
未找到文件。
modules/imgproc/src/contours.cpp
浏览文件 @
56c133d4
...
...
@@ -199,10 +199,10 @@ _CvContourScanner;
Initializes scanner structure.
Prepare image for scanning ( clear borders and convert all pixels to 0-1.
*/
CV_IMPL
CvContourScanner
cvStartFindContours
(
void
*
_img
,
CvMemStorage
*
storage
,
static
CvContourScanner
cvStartFindContours
_Impl
(
void
*
_img
,
CvMemStorage
*
storage
,
int
header_size
,
int
mode
,
int
method
,
CvPoint
offset
)
int
method
,
CvPoint
offset
,
int
needFillBorder
)
{
if
(
!
storage
)
CV_Error
(
CV_StsNullPtr
,
""
);
...
...
@@ -310,15 +310,18 @@ cvStartFindContours( void* _img, CvMemStorage* storage,
CV_Assert
(
size
.
height
>=
1
);
/* make zero borders */
int
esz
=
CV_ELEM_SIZE
(
mat
->
type
);
memset
(
img
,
0
,
size
.
width
*
esz
);
memset
(
img
+
static_cast
<
size_t
>
(
step
)
*
(
size
.
height
-
1
),
0
,
size
.
width
*
esz
);
img
+=
step
;
for
(
int
y
=
1
;
y
<
size
.
height
-
1
;
y
++
,
img
+=
step
)
if
(
needFillBorder
)
{
for
(
int
k
=
0
;
k
<
esz
;
k
++
)
img
[
k
]
=
img
[(
size
.
width
-
1
)
*
esz
+
k
]
=
(
schar
)
0
;
int
esz
=
CV_ELEM_SIZE
(
mat
->
type
);
memset
(
img
,
0
,
size
.
width
*
esz
);
memset
(
img
+
static_cast
<
size_t
>
(
step
)
*
(
size
.
height
-
1
),
0
,
size
.
width
*
esz
);
img
+=
step
;
for
(
int
y
=
1
;
y
<
size
.
height
-
1
;
y
++
,
img
+=
step
)
{
for
(
int
k
=
0
;
k
<
esz
;
k
++
)
img
[
k
]
=
img
[(
size
.
width
-
1
)
*
esz
+
k
]
=
(
schar
)
0
;
}
}
/* converts all pixels to 0 or 1 */
...
...
@@ -328,6 +331,14 @@ cvStartFindContours( void* _img, CvMemStorage* storage,
return
scanner
;
}
CV_IMPL
CvContourScanner
cvStartFindContours
(
void
*
_img
,
CvMemStorage
*
storage
,
int
header_size
,
int
mode
,
int
method
,
CvPoint
offset
)
{
return
cvStartFindContours_Impl
(
_img
,
storage
,
header_size
,
mode
,
method
,
offset
,
1
);
}
/*
Final stage of contour processing.
Three variants possible:
...
...
@@ -1796,33 +1807,11 @@ icvFindContoursInInterval( const CvArr* src,
return
count
;
}
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvFindContours
// Purpose:
// Finds all the contours on the bi-level image.
// Context:
// Parameters:
// img - source image.
// Non-zero pixels are considered as 1-pixels
// and zero pixels as 0-pixels.
// step - full width of source image in bytes.
// size - width and height of the image in pixels
// storage - pointer to storage where will the output contours be placed.
// header_size - header size of resulting contours
// mode - mode of contour retrieval.
// method - method of approximation that is applied to contours
// first_contour - pointer to first contour pointer
// Returns:
// CV_OK or error code
// Notes:
//F*/
CV_IMPL
int
cvFindContours
(
void
*
img
,
CvMemStorage
*
storage
,
static
int
cvFindContours_Impl
(
void
*
img
,
CvMemStorage
*
storage
,
CvSeq
**
firstContour
,
int
cntHeaderSize
,
int
mode
,
int
method
,
CvPoint
offset
)
int
method
,
CvPoint
offset
,
int
needFillBorder
)
{
CvContourScanner
scanner
=
0
;
CvSeq
*
contour
=
0
;
...
...
@@ -1845,7 +1834,8 @@ cvFindContours( void* img, CvMemStorage* storage,
{
try
{
scanner
=
cvStartFindContours
(
img
,
storage
,
cntHeaderSize
,
mode
,
method
,
offset
);
scanner
=
cvStartFindContours_Impl
(
img
,
storage
,
cntHeaderSize
,
mode
,
method
,
offset
,
needFillBorder
);
do
{
...
...
@@ -1867,6 +1857,35 @@ cvFindContours( void* img, CvMemStorage* storage,
return
count
;
}
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvFindContours
// Purpose:
// Finds all the contours on the bi-level image.
// Context:
// Parameters:
// img - source image.
// Non-zero pixels are considered as 1-pixels
// and zero pixels as 0-pixels.
// step - full width of source image in bytes.
// size - width and height of the image in pixels
// storage - pointer to storage where will the output contours be placed.
// header_size - header size of resulting contours
// mode - mode of contour retrieval.
// method - method of approximation that is applied to contours
// first_contour - pointer to first contour pointer
// Returns:
// CV_OK or error code
// Notes:
//F*/
CV_IMPL
int
cvFindContours
(
void
*
img
,
CvMemStorage
*
storage
,
CvSeq
**
firstContour
,
int
cntHeaderSize
,
int
mode
,
int
method
,
CvPoint
offset
)
{
return
cvFindContours_Impl
(
img
,
storage
,
firstContour
,
cntHeaderSize
,
mode
,
method
,
offset
,
1
);
}
void
cv
::
findContours
(
InputOutputArray
_image
,
OutputArrayOfArrays
_contours
,
OutputArray
_hierarchy
,
int
mode
,
int
method
,
Point
offset
)
{
...
...
@@ -1885,7 +1904,7 @@ void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours,
CvSeq
*
_ccontours
=
0
;
if
(
_hierarchy
.
needed
()
)
_hierarchy
.
clear
();
cvFindContours
(
&
_cimage
,
storage
,
&
_ccontours
,
sizeof
(
CvContour
),
mode
,
method
,
offset
+
Point
(
-
1
,
-
1
)
);
cvFindContours
_Impl
(
&
_cimage
,
storage
,
&
_ccontours
,
sizeof
(
CvContour
),
mode
,
method
,
offset
+
Point
(
-
1
,
-
1
),
0
);
if
(
!
_ccontours
)
{
_contours
.
clear
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录