Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
8aca8d90
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,发现更多精彩内容 >>
提交
8aca8d90
编写于
8月 03, 2017
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
akaze: replace ceil()
- integer division => divUp() - cast to 'int' => cvCeil()
上级
9ca39821
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
38 deletion
+50
-38
modules/features2d/src/akaze.cpp
modules/features2d/src/akaze.cpp
+2
-2
modules/features2d/src/kaze/AKAZEFeatures.cpp
modules/features2d/src/kaze/AKAZEFeatures.cpp
+46
-34
modules/features2d/src/kaze/fed.cpp
modules/features2d/src/kaze/fed.cpp
+1
-1
modules/features2d/src/kaze/nldiffusion_functions.cpp
modules/features2d/src/kaze/nldiffusion_functions.cpp
+1
-1
未找到文件。
modules/features2d/src/akaze.cpp
浏览文件 @
8aca8d90
...
...
@@ -113,12 +113,12 @@ namespace cv
if
(
descriptor_size
==
0
)
{
int
t
=
(
6
+
36
+
120
)
*
descriptor_channels
;
return
(
int
)
ceil
(
t
/
8.
);
return
divUp
(
t
,
8
);
}
else
{
// We use the random bit selection length binary descriptor
return
(
int
)
ceil
(
descriptor_size
/
8.
);
return
divUp
(
descriptor_size
,
8
);
}
default:
...
...
modules/features2d/src/kaze/AKAZEFeatures.cpp
浏览文件 @
8aca8d90
...
...
@@ -106,7 +106,7 @@ void AKAZEFeatures::Allocate_Memory_Evolution(void) {
*/
static
inline
int
getGaussianKernelSize
(
float
sigma
)
{
// Compute an appropriate kernel size according to the specified sigma
int
ksize
=
(
int
)
ceil
(
2.0
f
*
(
1.0
f
+
(
sigma
-
0.8
f
)
/
(
0.3
f
)));
int
ksize
=
(
int
)
c
vC
eil
(
2.0
f
*
(
1.0
f
+
(
sigma
-
0.8
f
)
/
(
0.3
f
)));
ksize
|=
1
;
// kernel should be odd
return
ksize
;
}
...
...
@@ -1131,20 +1131,17 @@ void AKAZEFeatures::Compute_Descriptors(std::vector<KeyPoint>& kpts, OutputArray
}
// Allocate memory for the matrix with the descriptors
if
(
options_
.
descriptor
<
AKAZE
::
DESCRIPTOR_MLDB_UPRIGHT
)
{
descriptors
.
create
((
int
)
kpts
.
size
(),
64
,
CV_32FC1
);
}
else
{
// We use the full length binary descriptor -> 486 bits
if
(
options_
.
descriptor_size
==
0
)
{
int
t
=
(
6
+
36
+
120
)
*
options_
.
descriptor_channels
;
descriptors
.
create
((
int
)
kpts
.
size
(),
(
int
)
ceil
(
t
/
8.
),
CV_8UC1
);
}
else
{
// We use the random bit selection length binary descriptor
descriptors
.
create
((
int
)
kpts
.
size
(),
(
int
)
ceil
(
options_
.
descriptor_size
/
8.
),
CV_8UC1
);
}
int
descriptor_size
=
64
;
int
descriptor_type
=
CV_32FC1
;
if
(
options_
.
descriptor
>=
AKAZE
::
DESCRIPTOR_MLDB_UPRIGHT
)
{
int
descriptor_bits
=
(
options_
.
descriptor_size
==
0
)
?
(
6
+
36
+
120
)
*
options_
.
descriptor_channels
// the full length binary descriptor -> 486 bits
:
options_
.
descriptor_size
;
// the random bit selection length binary descriptor
descriptor_size
=
divUp
(
descriptor_bits
,
8
);
descriptor_type
=
CV_8UC1
;
}
descriptors
.
create
((
int
)
kpts
.
size
(),
descriptor_size
,
descriptor_type
);
Mat
desc
=
descriptors
.
getMat
();
...
...
@@ -1701,10 +1698,11 @@ void Upright_MLDB_Full_Descriptor_Invoker::Get_Upright_MLDB_Full_Descriptor(cons
// For 2x2 grid, 3x3 grid and 4x4 grid
const
int
pattern_size
=
options_
->
descriptor_pattern_size
;
int
sample_step
[
3
]
=
{
CV_Assert
((
pattern_size
&
1
)
==
0
);
const
int
sample_step
[
3
]
=
{
pattern_size
,
static_cast
<
int
>
(
ceil
(
pattern_size
*
2.
/
3.
)
),
pattern_size
/
2
divUp
(
pattern_size
*
2
,
3
),
divUp
(
pattern_size
,
2
)
};
// For the three grids
...
...
@@ -1873,8 +1871,16 @@ void MLDB_Full_Descriptor_Invoker::Get_MLDB_Full_Descriptor(const KeyPoint& kpt,
const
int
max_channels
=
3
;
CV_Assert
(
options_
->
descriptor_channels
<=
max_channels
);
const
int
pattern_size
=
options_
->
descriptor_pattern_size
;
float
values
[
16
*
max_channels
];
const
double
size_mult
[
3
]
=
{
1
,
2.0
/
3.0
,
1.0
/
2.0
};
CV_Assert
((
pattern_size
&
1
)
==
0
);
//const double size_mult[3] = {1, 2.0/3.0, 1.0/2.0};
const
int
sample_step
[
3
]
=
{
// static_cast<int>(ceil(pattern_size * size_mult[lvl]))
pattern_size
,
divUp
(
pattern_size
*
2
,
3
),
divUp
(
pattern_size
,
2
)
};
float
ratio
=
(
float
)(
1
<<
kpt
.
octave
);
float
scale
=
(
float
)
fRound
(
0.5
f
*
kpt
.
size
/
ratio
);
...
...
@@ -1883,14 +1889,12 @@ void MLDB_Full_Descriptor_Invoker::Get_MLDB_Full_Descriptor(const KeyPoint& kpt,
float
angle
=
(
kpt
.
angle
*
static_cast
<
float
>
(
CV_PI
))
/
180.
f
;
float
co
=
cos
(
angle
);
float
si
=
sin
(
angle
);
int
pattern_size
=
options_
->
descriptor_pattern_size
;
int
dpos
=
0
;
for
(
int
lvl
=
0
;
lvl
<
3
;
lvl
++
)
{
int
val_count
=
(
lvl
+
2
)
*
(
lvl
+
2
);
int
sample_step
=
static_cast
<
int
>
(
ceil
(
pattern_size
*
size_mult
[
lvl
]));
MLDB_Fill_Values
(
values
,
sample_step
,
kpt
.
class_id
,
xf
,
yf
,
co
,
si
,
scale
);
MLDB_Fill_Values
(
values
,
sample_step
[
lvl
],
kpt
.
class_id
,
xf
,
yf
,
co
,
si
,
scale
);
MLDB_Binary_Comparisons
(
values
,
desc
,
val_count
,
dpos
);
}
}
...
...
@@ -1930,14 +1934,18 @@ void MLDB_Descriptor_Subset_Invoker::Get_MLDB_Descriptor_Subset(const KeyPoint&
Mat
values
((
4
+
9
+
16
)
*
options
.
descriptor_channels
,
1
,
CV_32FC1
);
// Sample everything, but only do the comparisons
vector
<
int
>
steps
(
3
);
steps
.
at
(
0
)
=
options
.
descriptor_pattern_size
;
steps
.
at
(
1
)
=
(
int
)
ceil
(
2.
f
*
options
.
descriptor_pattern_size
/
3.
f
);
steps
.
at
(
2
)
=
options
.
descriptor_pattern_size
/
2
;
const
int
pattern_size
=
options
.
descriptor_pattern_size
;
CV_Assert
((
pattern_size
&
1
)
==
0
);
const
int
sample_steps
[
3
]
=
{
pattern_size
,
divUp
(
pattern_size
*
2
,
3
),
divUp
(
pattern_size
,
2
)
};
for
(
int
i
=
0
;
i
<
descriptorSamples_
.
rows
;
i
++
)
{
const
int
*
coords
=
descriptorSamples_
.
ptr
<
int
>
(
i
);
int
sample_step
=
steps
.
at
(
coords
[
0
]);
CV_Assert
(
coords
[
0
]
>=
0
&&
coords
[
0
]
<
3
);
const
int
sample_step
=
sample_steps
[
coords
[
0
]];
di
=
0.0
f
;
dx
=
0.0
f
;
dy
=
0.0
f
;
...
...
@@ -2025,14 +2033,18 @@ void Upright_MLDB_Descriptor_Subset_Invoker::Get_Upright_MLDB_Descriptor_Subset(
// Allocate memory for the matrix of values
Mat
values
((
4
+
9
+
16
)
*
options
.
descriptor_channels
,
1
,
CV_32FC1
);
vector
<
int
>
steps
(
3
);
steps
.
at
(
0
)
=
options
.
descriptor_pattern_size
;
steps
.
at
(
1
)
=
static_cast
<
int
>
(
ceil
(
2.
f
*
options
.
descriptor_pattern_size
/
3.
f
));
steps
.
at
(
2
)
=
options
.
descriptor_pattern_size
/
2
;
const
int
pattern_size
=
options
.
descriptor_pattern_size
;
CV_Assert
((
pattern_size
&
1
)
==
0
);
const
int
sample_steps
[
3
]
=
{
pattern_size
,
divUp
(
pattern_size
*
2
,
3
),
divUp
(
pattern_size
,
2
)
};
for
(
int
i
=
0
;
i
<
descriptorSamples_
.
rows
;
i
++
)
{
const
int
*
coords
=
descriptorSamples_
.
ptr
<
int
>
(
i
);
int
sample_step
=
steps
.
at
(
coords
[
0
]);
CV_Assert
(
coords
[
0
]
>=
0
&&
coords
[
0
]
<
3
);
int
sample_step
=
sample_steps
[
coords
[
0
]];
di
=
0.0
f
,
dx
=
0.0
f
,
dy
=
0.0
f
;
for
(
int
k
=
coords
[
1
];
k
<
coords
[
1
]
+
sample_step
;
k
++
)
{
...
...
@@ -2120,7 +2132,7 @@ void generateDescriptorSubsample(Mat& sampleList, Mat& comparisons, int nbits,
for
(
int
i
=
0
,
c
=
0
;
i
<
3
;
i
++
)
{
int
gdiv
=
i
+
2
;
//grid divisions, per row
int
gsz
=
gdiv
*
gdiv
;
int
psz
=
(
int
)
ceil
(
2.
f
*
pattern_size
/
(
float
)
gdiv
);
int
psz
=
divUp
(
2
*
pattern_size
,
gdiv
);
for
(
int
j
=
0
;
j
<
gsz
;
j
++
)
{
for
(
int
k
=
j
+
1
;
k
<
gsz
;
k
++
,
c
++
)
{
...
...
@@ -2134,12 +2146,12 @@ void generateDescriptorSubsample(Mat& sampleList, Mat& comparisons, int nbits,
}
RNG
rng
(
1024
);
Mat_
<
int
>
comps
=
Mat_
<
int
>
(
nchannels
*
(
int
)
ceil
(
nbits
/
(
float
)
nchannels
),
2
);
const
int
npicks
=
divUp
(
nbits
,
nchannels
);
Mat_
<
int
>
comps
=
Mat_
<
int
>
(
nchannels
*
npicks
,
2
);
comps
=
1000
;
// Select some samples. A sample includes all channels
int
count
=
0
;
int
npicks
=
(
int
)
ceil
(
nbits
/
(
float
)
nchannels
);
Mat_
<
int
>
samples
(
29
,
3
);
Mat_
<
int
>
fullcopy
=
fullM
.
clone
();
samples
=
-
1
;
...
...
modules/features2d/src/kaze/fed.cpp
浏览文件 @
8aca8d90
...
...
@@ -72,7 +72,7 @@ int fed_tau_by_cycle_time(const float& t, const float& tau_max,
float
scale
=
0.0
;
// Ratio of t we search to maximal t
// Compute necessary number of time steps
n
=
(
int
)(
ceilf
(
sqrtf
(
3.0
f
*
t
/
tau_max
+
0.25
f
)
-
0.5
f
-
1.0e-8
f
)
+
0.5
f
);
n
=
cvCeil
(
sqrtf
(
3.0
f
*
t
/
tau_max
+
0.25
f
)
-
0.5
f
-
1.0e-8
f
);
scale
=
3.0
f
*
t
/
(
tau_max
*
(
float
)(
n
*
(
n
+
1
)));
// Call internal FED time step creation routine
...
...
modules/features2d/src/kaze/nldiffusion_functions.cpp
浏览文件 @
8aca8d90
...
...
@@ -49,7 +49,7 @@ void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst, int ksize_x, int
// Compute an appropriate kernel size according to the specified sigma
if
(
sigma
>
ksize_x
||
sigma
>
ksize_y
||
ksize_x
==
0
||
ksize_y
==
0
)
{
ksize_x_
=
(
int
)
c
eil
(
2.0
f
*
(
1.0
f
+
(
sigma
-
0.8
f
)
/
(
0.3
f
)));
ksize_x_
=
cvC
eil
(
2.0
f
*
(
1.0
f
+
(
sigma
-
0.8
f
)
/
(
0.3
f
)));
ksize_y_
=
ksize_x_
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录