Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PointCloud
Flann
提交
f4ee0100
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,发现更多精彩内容 >>
提交
f4ee0100
编写于
3月 27, 2018
作者:
J
Jannik Boll Nielsen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added python wrapper for add_points and remove_point methods.
上级
27f9d933
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
0 deletion
+46
-0
src/python/pyflann/flann_ctypes.py
src/python/pyflann/flann_ctypes.py
+23
-0
src/python/pyflann/index.py
src/python/pyflann/index.py
+23
-0
未找到文件。
src/python/pyflann/flann_ctypes.py
浏览文件 @
f4ee0100
...
@@ -256,6 +256,29 @@ flannlib.flann_load_index_%(C)s.argtypes = [
...
@@ -256,6 +256,29 @@ flannlib.flann_load_index_%(C)s.argtypes = [
flann.load_index[%(numpy)s] = flannlib.flann_load_index_%(C)s
flann.load_index[%(numpy)s] = flannlib.flann_load_index_%(C)s
"""
)
"""
)
flann
.
add_points
=
{}
define_functions
(
r
"""
flannlib.flann_add_points_%(C)s.restype = None
flannlib.flann_add_points_%(C)s.argtypes = [
FLANN_INDEX, # index_id
ndpointer(%(numpy)s, ndim = 2, flags='aligned, c_contiguous'), # dataset
c_int, # rows
c_int, # cols
c_float, # rebuild_threshhold
]
flann.add_points[%(numpy)s] = flannlib.flann_add_points_%(C)s
"""
)
flann
.
remove_point
=
{}
define_functions
(
r
"""
flannlib.flann_remove_point_%(C)s.restype = None
flannlib.flann_remove_point_%(C)s.argtypes = [
FLANN_INDEX, # index_id
c_uint, # point_id
]
flann.remove_point[%(numpy)s] = flannlib.flann_remove_point_%(C)s
"""
)
flann
.
find_nearest_neighbors
=
{}
flann
.
find_nearest_neighbors
=
{}
define_functions
(
r
"""
define_functions
(
r
"""
flannlib.flann_find_nearest_neighbors_%(C)s.restype = c_int
flannlib.flann_find_nearest_neighbors_%(C)s.restype = c_int
...
...
src/python/pyflann/index.py
浏览文件 @
f4ee0100
...
@@ -211,6 +211,29 @@ class FLANN(object):
...
@@ -211,6 +211,29 @@ class FLANN(object):
c_char_p
(
to_bytes
(
filename
)),
pts
,
npts
,
dim
)
c_char_p
(
to_bytes
(
filename
)),
pts
,
npts
,
dim
)
self
.
__curindex_data
=
pts
self
.
__curindex_data
=
pts
self
.
__curindex_type
=
pts
.
dtype
.
type
self
.
__curindex_type
=
pts
.
dtype
.
type
def
add_points
(
self
,
pts
,
rebuild_threshold
=
2.0
):
"""
Adds points to pre-built index.
Params:
pts: 2D numpy array of points.
\n
rebuild_threshold: reallocs index when it grows by factor of
\
`rebuild_threshold`. A smaller value results is more space
\
efficient but less computationally efficient. Must be greater
\
than 1.
"""
if
not
pts
.
dtype
.
type
in
allowed_types
:
raise
FLANNException
(
"Cannot handle type: %s"
%
pts
.
dtype
)
pts
=
ensure_2d_array
(
pts
,
default_flags
)
npts
,
dim
=
pts
.
shape
flann
.
add_points
[
self
.
__curindex_type
](
self
.
__curindex
,
pts
,
npts
,
dim
,
rebuild_threshold
)
def
remove_point
(
self
,
idx
):
"""
Removes a point from a pre-built index.
"""
flann
.
remove_point
[
self
.
__curindex_type
](
self
.
__curindex
,
idx
)
def
nn_index
(
self
,
qpts
,
num_neighbors
=
1
,
**
kwargs
):
def
nn_index
(
self
,
qpts
,
num_neighbors
=
1
,
**
kwargs
):
"""
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录