Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
85880397
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,发现更多精彩内容 >>
提交
85880397
编写于
11月 05, 2012
作者:
J
Jason Newton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
connectedcomponents: use opencv integral types, add to docs, fix up things for a python export
上级
4c0cb257
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
75 addition
and
15 deletion
+75
-15
modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst
...imgproc/doc/structural_analysis_and_shape_descriptors.rst
+42
-0
modules/imgproc/include/opencv2/imgproc/imgproc.hpp
modules/imgproc/include/opencv2/imgproc/imgproc.hpp
+12
-12
modules/imgproc/src/connectedcomponents.cpp
modules/imgproc/src/connectedcomponents.cpp
+11
-1
modules/python/src2/cv2.cpp
modules/python/src2/cv2.cpp
+10
-2
未找到文件。
modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst
浏览文件 @
85880397
...
...
@@ -118,6 +118,48 @@ These values are proved to be invariants to the image scale, rotation, and refle
.. seealso:: :ocv:func:`matchShapes`
connectedComponents
-----------
computes the connected components labeled image of boolean image I with 4 or 8 way connectivity - returns N, the total
number of labels [0, N-1] where 0 represents the background label. L's value type determines the label type, an important
consideration based on the total number of labels or alternatively the total number of pixels.
.. ocv:function:: uint64 connectedComponents(Mat &L, const Mat &I, int connectivity = 8)
.. ocv:function:: uint64 connectedComponentsWithStats(Mat &L, const Mat &I, std::vector<ConnectedComponentStats> &statsv, int connectivity = 8)
:param L: destitination Labeled image
:param I: the image to be labeled
:param connectivity: 8 or 4 for 8-way or 4-way connectivity respectively
:param statsv: statistics for each label, including the background label
Statistics information such as bounding box, area, and centroid is exported via the ``ConnectComponentStats`` structure defined as: ::
class CV_EXPORTS ConnectedComponentStats
{
public:
//! lower left corner column
int lower_x;
//! lower left corner row
int lower_y;
//! upper right corner column
int upper_x;
//! upper right corner row
int upper_y;
//! centroid column
double centroid_x;
//! centroid row
double centroid_y;
//! sum of all columns where the image was non-zero
uint64 integral_x;
//! sum of all rows where the image was non-zero
uint64 integral_y;
//! count of all non-zero pixels
unsigned int area;
};
findContours
----------------
...
...
modules/imgproc/include/opencv2/imgproc/imgproc.hpp
浏览文件 @
85880397
...
...
@@ -1091,24 +1091,24 @@ enum { TM_SQDIFF=0, TM_SQDIFF_NORMED=1, TM_CCORR=2, TM_CCORR_NORMED=3, TM_CCOEFF
CV_EXPORTS_W
void
matchTemplate
(
InputArray
image
,
InputArray
templ
,
OutputArray
result
,
int
method
);
struct
CV_EXPORTS
ConnectedComponentStats
{
int
32_t
lower_x
;
int
32_t
lower_y
;
int
32_t
upper_x
;
int
32_t
upper_y
;
double
centroid_x
;
double
centroid_y
;
uint64
_t
integral_x
;
uint64
_t
integral_y
;
u
int32_t
area
;
int
lower_x
;
//!< lower left corner column
int
lower_y
;
//!< lower left corner row
int
upper_x
;
//!< upper right corner column
int
upper_y
;
//!< upper right corner row
double
centroid_x
;
//!< centroid column
double
centroid_y
;
//!< centroid row
uint64
integral_x
;
//!< sum of all columns where the image was non-zero
uint64
integral_y
;
//!< sum of all rows where the image was non-zero
u
nsigned
int
area
;
//!< count of all non-zero pixels
};
//! computes the connected components labeled image of boolean image I with 4 or 8 way connectivity - returns N, the total
//number of labels [0, N-1] where 0 represents the background label. L's value type determines the label type, an important
//consideration based on the total number of labels or alternatively the total number of pixels.
CV_EXPORTS_W
uint64
_t
connectedComponents
(
Mat
&
L
,
const
Mat
&
I
,
int
connectivity
=
8
);
CV_EXPORTS_W
uint64
_t
connectedComponents
(
Mat
&
L
,
const
Mat
&
I
,
std
::
vector
<
ConnectedComponentStats
>
&
statsv
,
int
connectivity
=
8
);
CV_EXPORTS_W
uint64
connectedComponents
(
CV_OUT
Mat
&
L
,
const
Mat
&
I
,
int
connectivity
=
8
);
CV_EXPORTS_W
uint64
connectedComponentsWithStats
(
CV_OUT
Mat
&
L
,
const
Mat
&
I
,
CV_OUT
std
::
vector
<
ConnectedComponentStats
>
&
statsv
,
int
connectivity
=
8
);
//! mode of the contour retrieval algorithm
...
...
modules/imgproc/src/connectedcomponents.cpp
浏览文件 @
85880397
...
...
@@ -43,6 +43,16 @@
#include "precomp.hpp"
#include <vector>
//It's 2012 and we still let compilers get by without defining standard integer types...
typedef
schar
int8_t
;
typedef
uchar
uint8_t
;
typedef
short
int16_t
;
typedef
unsigned
short
uint16_t
;
typedef
int
int32_t
;
typedef
unsigned
int
uint32_t
;
typedef
int64
int64_t
;
typedef
uint64
uint64_t
;
namespace
cv
{
namespace
connectedcomponents
{
...
...
@@ -463,7 +473,7 @@ uint64_t connectedComponents(Mat &L, const Mat &I, int connectivity){
}
}
uint64_t
connectedComponents
(
Mat
&
L
,
const
Mat
&
I
,
std
::
vector
<
ConnectedComponentStats
>
&
statsv
,
int
connectivity
){
uint64_t
connectedComponents
WithStats
(
Mat
&
L
,
const
Mat
&
I
,
std
::
vector
<
ConnectedComponentStats
>
&
statsv
,
int
connectivity
){
int
lDepth
=
L
.
depth
();
if
(
lDepth
==
CV_8U
){
connectedcomponents
::
CCStatsOp
<
uint8_t
>
sop
(
statsv
);
return
connectedComponents_sub1
(
L
,
I
,
connectivity
,
sop
);
...
...
modules/python/src2/cv2.cpp
浏览文件 @
85880397
...
...
@@ -123,6 +123,7 @@ typedef Ptr<FeatureDetector> Ptr_FeatureDetector;
typedef
Ptr
<
DescriptorExtractor
>
Ptr_DescriptorExtractor
;
typedef
Ptr
<
Feature2D
>
Ptr_Feature2D
;
typedef
Ptr
<
DescriptorMatcher
>
Ptr_DescriptorMatcher
;
typedef
vector
<
ConnectedComponentStats
>
vector_ConnectedComponentStats
;
typedef
SimpleBlobDetector
::
Params
SimpleBlobDetector_Params
;
...
...
@@ -410,7 +411,7 @@ static bool pyopencv_to(PyObject* obj, bool& value, const char* name = "<unknown
static
PyObject
*
pyopencv_from
(
size_t
value
)
{
return
PyLong_From
UnsignedLong
((
unsigned
long
)
value
);
return
PyLong_From
Size_t
(
value
);
}
static
bool
pyopencv_to
(
PyObject
*
obj
,
size_t
&
value
,
const
char
*
name
=
"<unknown>"
)
...
...
@@ -497,9 +498,16 @@ static bool pyopencv_to(PyObject* obj, float& value, const char* name = "<unknow
static
PyObject
*
pyopencv_from
(
int64
value
)
{
return
Py
Float_FromDouble
((
double
)
value
);
return
Py
Long_FromLongLong
(
value
);
}
#if !defined(__LP64__)
static
PyObject
*
pyopencv_from
(
uint64
value
)
{
return
PyLong_FromUnsignedLongLong
(
value
);
}
#endif
static
PyObject
*
pyopencv_from
(
const
string
&
value
)
{
return
PyString_FromString
(
value
.
empty
()
?
""
:
value
.
c_str
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录