Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
2c1f3487
O
Opencv
项目概览
Greenplum
/
Opencv
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
2c1f3487
编写于
8月 18, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18037 from danielenricocahall:improve-brisk-init-perf
上级
acc6189d
ac177b84
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
59 addition
and
37 deletion
+59
-37
modules/features2d/src/brisk.cpp
modules/features2d/src/brisk.cpp
+59
-37
未找到文件。
modules/features2d/src/brisk.cpp
浏览文件 @
2c1f3487
...
...
@@ -353,13 +353,30 @@ BRISK_Impl::generateKernel(const std::vector<float> &radiusList,
const
int
rings
=
(
int
)
radiusList
.
size
();
CV_Assert
(
radiusList
.
size
()
!=
0
&&
radiusList
.
size
()
==
numberList
.
size
());
points_
=
0
;
// remember the total number of points
double
sineThetaLookupTable
[
n_rot_
];
double
cosThetaLookupTable
[
n_rot_
];
for
(
int
ring
=
0
;
ring
<
rings
;
ring
++
)
{
points_
+=
numberList
[
ring
];
}
// using a sine/cosine approximation for the lookup table
// utilizes the trig identities:
// sin(a + b) = sin(a)cos(b) + cos(a)sin(b)
// cos(a + b) = cos(a)cos(b) - sin(a)sin(b)
// and the fact that sin(0) = 0, cos(0) = 1
double
cosval
=
1.
,
sinval
=
0.
;
double
dcos
=
cos
(
2
*
CV_PI
/
double
(
n_rot_
)),
dsin
=
sin
(
2
*
CV_PI
/
double
(
n_rot_
));
for
(
size_t
rot
=
0
;
rot
<
n_rot_
;
++
rot
)
{
sineThetaLookupTable
[
rot
]
=
sinval
;
cosThetaLookupTable
[
rot
]
=
cosval
;
double
t
=
sinval
*
dcos
+
cosval
*
dsin
;
cosval
=
cosval
*
dcos
-
sinval
*
dsin
;
sinval
=
t
;
}
// set up the patterns
patternPoints_
=
new
BriskPatternPoint
[
points_
*
scales_
*
n_rot_
];
BriskPatternPoint
*
patternIterator
=
patternPoints_
;
// define the scale discretization:
static
const
float
lb_scale
=
(
float
)(
std
::
log
(
scalerange_
)
/
std
::
log
(
2.0
));
...
...
@@ -370,46 +387,51 @@ BRISK_Impl::generateKernel(const std::vector<float> &radiusList,
const
float
sigma_scale
=
1.3
f
;
for
(
unsigned
int
scale
=
0
;
scale
<
scales_
;
++
scale
)
{
scaleList_
[
scale
]
=
(
float
)
std
::
pow
((
double
)
2.0
,
(
double
)
(
scale
*
lb_scale_step
));
sizeList_
[
scale
]
=
0
;
// generate the pattern points look-up
double
alpha
,
theta
;
for
(
size_t
rot
=
0
;
rot
<
n_rot_
;
++
rot
)
{
theta
=
double
(
rot
)
*
2
*
CV_PI
/
double
(
n_rot_
);
// this is the rotation of the feature
for
(
int
ring
=
0
;
ring
<
rings
;
++
ring
)
{
for
(
int
num
=
0
;
num
<
numberList
[
ring
];
++
num
)
{
// the actual coordinates on the circle
alpha
=
(
double
(
num
))
*
2
*
CV_PI
/
double
(
numberList
[
ring
]);
patternIterator
->
x
=
(
float
)(
scaleList_
[
scale
]
*
radiusList
[
ring
]
*
cos
(
alpha
+
theta
));
// feature rotation plus angle of the point
patternIterator
->
y
=
(
float
)(
scaleList_
[
scale
]
*
radiusList
[
ring
]
*
sin
(
alpha
+
theta
));
// and the gaussian kernel sigma
if
(
ring
==
0
)
{
patternIterator
->
sigma
=
sigma_scale
*
scaleList_
[
scale
]
*
0.5
f
;
}
else
{
patternIterator
->
sigma
=
(
float
)(
sigma_scale
*
scaleList_
[
scale
]
*
(
double
(
radiusList
[
ring
]))
*
sin
(
CV_PI
/
numberList
[
ring
]));
for
(
unsigned
int
scale
=
0
;
scale
<
scales_
;
++
scale
)
{
scaleList_
[
scale
]
=
(
float
)
std
::
pow
((
double
)
2.0
,
(
double
)
(
scale
*
lb_scale_step
));
sizeList_
[
scale
]
=
0
;
BriskPatternPoint
*
patternIteratorOuter
=
patternPoints_
+
(
scale
*
n_rot_
*
points_
);
// generate the pattern points look-up
for
(
int
ring
=
0
;
ring
<
rings
;
++
ring
)
{
double
scaleRadiusProduct
=
scaleList_
[
scale
]
*
radiusList
[
ring
];
float
patternSigma
=
0.0
f
;
if
(
ring
==
0
)
{
patternSigma
=
sigma_scale
*
scaleList_
[
scale
]
*
0.5
f
;
}
else
{
patternSigma
=
(
float
)
(
sigma_scale
*
scaleList_
[
scale
]
*
(
double
(
radiusList
[
ring
]))
*
sin
(
CV_PI
/
numberList
[
ring
]));
}
// adapt the sizeList if necessary
const
unsigned
int
size
=
cvCeil
(((
scaleList_
[
scale
]
*
radiusList
[
ring
])
+
patternIterator
->
sigma
))
+
1
;
if
(
sizeList_
[
scale
]
<
size
)
{
sizeList_
[
scale
]
=
size
;
const
unsigned
int
size
=
cvCeil
(((
scaleList_
[
scale
]
*
radiusList
[
ring
])
+
patternSigma
))
+
1
;
if
(
sizeList_
[
scale
]
<
size
)
{
sizeList_
[
scale
]
=
size
;
}
for
(
int
num
=
0
;
num
<
numberList
[
ring
];
++
num
)
{
BriskPatternPoint
*
patternIterator
=
patternIteratorOuter
;
double
alpha
=
(
double
(
num
))
*
2
*
CV_PI
/
double
(
numberList
[
ring
]);
double
sine_alpha
=
sin
(
alpha
);
double
cosine_alpha
=
cos
(
alpha
);
for
(
size_t
rot
=
0
;
rot
<
n_rot_
;
++
rot
)
{
double
cosine_theta
=
cosThetaLookupTable
[
rot
];
double
sine_theta
=
sineThetaLookupTable
[
rot
];
// the actual coordinates on the circle
// sin(a + b) = sin(a) cos(b) + cos(a) sin(b)
// cos(a + b) = cos(a) cos(b) - sin(a) sin(b)
patternIterator
->
x
=
(
float
)
(
scaleRadiusProduct
*
(
cosine_theta
*
cosine_alpha
-
sine_theta
*
sine_alpha
));
// feature rotation plus angle of the point
patternIterator
->
y
=
(
float
)
(
scaleRadiusProduct
*
(
sine_theta
*
cosine_alpha
+
cosine_theta
*
sine_alpha
));
patternIterator
->
sigma
=
patternSigma
;
// and the gaussian kernel sigma
// increment the iterator
patternIterator
+=
points_
;
}
++
patternIteratorOuter
;
}
// increment the iterator
++
patternIterator
;
}
}
}
}
// now also generate pairings
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录