Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PointCloud
Flann
提交
8fb53ca2
F
Flann
项目概览
PointCloud
/
Flann
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flann
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8fb53ca2
编写于
12月 21, 2010
作者:
M
Marius Muja
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Windows compilation fixes
上级
c4c1050b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
27 deletion
+38
-27
examples/flann_example.c
examples/flann_example.c
+34
-17
src/cpp/flann/flann.cpp
src/cpp/flann/flann.cpp
+3
-3
src/cpp/flann/flann.h
src/cpp/flann/flann.h
+1
-1
src/cpp/flann/flann_cpp.cpp
src/cpp/flann/flann_cpp.cpp
+0
-6
未找到文件。
examples/flann_example.c
浏览文件 @
8fb53ca2
...
...
@@ -9,22 +9,26 @@
float
*
read_points
(
const
char
*
filename
,
int
rows
,
int
cols
)
{
int
ret
;
float
*
data
;
float
*
p
;
FILE
*
fin
;
int
i
,
j
;
FILE
*
fin
=
fopen
(
filename
,
"r"
);
fin
=
fopen
(
filename
,
"r"
);
if
(
!
fin
)
{
printf
(
"Cannot open input file.
\n
"
);
exit
(
1
);
}
float
*
data
=
(
float
*
)
malloc
(
rows
*
cols
*
sizeof
(
float
));
data
=
(
float
*
)
malloc
(
rows
*
cols
*
sizeof
(
float
));
if
(
!
data
)
{
printf
(
"Cannot allocate memory.
\n
"
);
exit
(
1
);
}
float
*
p
=
data
;
p
=
data
;
for
(
i
nt
i
=
0
;
i
<
rows
;
++
i
)
{
for
(
int
j
=
0
;
j
<
cols
;
++
j
)
{
for
(
i
=
0
;
i
<
rows
;
++
i
)
{
for
(
j
=
0
;
j
<
cols
;
++
j
)
{
ret
=
fscanf
(
fin
,
"%g "
,
p
);
p
++
;
}
...
...
@@ -37,15 +41,19 @@ float* read_points(const char* filename, int rows, int cols)
void
write_results
(
const
char
*
filename
,
int
*
data
,
int
rows
,
int
cols
)
{
FILE
*
fout
=
fopen
(
filename
,
"w"
);
FILE
*
fout
;
int
*
p
;
int
i
,
j
;
fout
=
fopen
(
filename
,
"w"
);
if
(
!
fout
)
{
printf
(
"Cannot open output file.
\n
"
);
exit
(
1
);
}
int
*
p
=
data
;
for
(
i
nt
i
=
0
;
i
<
rows
;
++
i
)
{
for
(
int
j
=
0
;
j
<
cols
;
++
j
)
{
p
=
data
;
for
(
i
=
0
;
i
<
rows
;
++
i
)
{
for
(
j
=
0
;
j
<
cols
;
++
j
)
{
fprintf
(
fout
,
"%d "
,
*
p
);
p
++
;
}
...
...
@@ -58,27 +66,36 @@ void write_results(const char* filename, int *data, int rows, int cols)
int
main
(
int
argc
,
char
**
argv
)
{
float
*
dataset
;
float
*
testset
;
int
nn
;
int
*
result
;
float
*
dists
;
struct
FLANNParameters
p
;
float
speedup
;
flann_index_t
index_id
;
int
rows
=
9000
;
int
cols
=
128
;
int
tcount
=
1000
;
printf
(
"Reading input data file.
\n
"
);
float
*
dataset
=
read_points
(
"dataset.dat"
,
rows
,
cols
);
dataset
=
read_points
(
"dataset.dat"
,
rows
,
cols
);
printf
(
"Reading test data file.
\n
"
);
float
*
testset
=
read_points
(
"testset.dat"
,
tcount
,
cols
);
testset
=
read_points
(
"testset.dat"
,
tcount
,
cols
);
int
nn
=
3
;
int
*
result
=
(
int
*
)
malloc
(
tcount
*
nn
*
sizeof
(
int
));
float
*
dists
=
(
float
*
)
malloc
(
tcount
*
nn
*
sizeof
(
float
));
nn
=
3
;
result
=
(
int
*
)
malloc
(
tcount
*
nn
*
sizeof
(
int
));
dists
=
(
float
*
)
malloc
(
tcount
*
nn
*
sizeof
(
float
));
struct
FLANNParameters
p
=
DEFAULT_FLANN_PARAMETERS
;
p
=
DEFAULT_FLANN_PARAMETERS
;
p
.
algorithm
=
KDTREE
;
p
.
trees
=
8
;
p
.
log_level
=
LOG_INFO
;
p
.
checks
=
64
;
float
speedup
;
printf
(
"Computing index.
\n
"
);
flann_index_t
index_id
=
flann_build_index
(
dataset
,
rows
,
cols
,
&
speedup
,
&
p
);
index_id
=
flann_build_index
(
dataset
,
rows
,
cols
,
&
speedup
,
&
p
);
flann_find_nearest_neighbors_index
(
index_id
,
testset
,
tcount
,
result
,
dists
,
nn
,
&
p
);
write_results
(
"results.dat"
,
result
,
tcount
,
nn
);
...
...
src/cpp/flann/flann.cpp
浏览文件 @
8fb53ca2
...
...
@@ -31,14 +31,14 @@
#ifdef WIN32
#define EXPORTED
extern "C"
__declspec(dllexport)
#define EXPORTED __declspec(dllexport)
#else
#define EXPORTED
extern "C"
#define EXPORTED
#endif
#define FLANN_FIRST_MATCH
struct
FLANNParameters
DEFAULT_FLANN_PARAMETERS
=
{
EXPORTED
struct
FLANNParameters
DEFAULT_FLANN_PARAMETERS
=
{
KDTREE
,
32
,
0.2
,
0.0
,
4
,
4
,
...
...
src/cpp/flann/flann.h
浏览文件 @
8fb53ca2
...
...
@@ -57,7 +57,7 @@ extern "C" {
typedef
void
*
FLANN_INDEX
;
/* deprecated */
typedef
void
*
flann_index_t
;
extern
struct
FLANNParameters
DEFAULT_FLANN_PARAMETERS
;
LIBSPEC
extern
struct
FLANNParameters
DEFAULT_FLANN_PARAMETERS
;
/**
Sets the log level used for all flann functions (unless
...
...
src/cpp/flann/flann_cpp.cpp
浏览文件 @
8fb53ca2
...
...
@@ -40,12 +40,6 @@
#include "flann/algorithms/all_indices.h"
#ifdef WIN32
#define EXPORTED extern "C" __declspec(dllexport)
#else
#define EXPORTED extern "C"
#endif
namespace
flann
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录